summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Young <chris@unsatisfactorysoftware.co.uk>2008-09-15 18:56:11 +0000
committerChris Young <chris@unsatisfactorysoftware.co.uk>2008-09-15 18:56:11 +0000
commit5c9f7937f5b4779e903eb39385907f3f793a723e (patch)
tree9289833a50ff10f610ecb28e07c0f3ef927f5745
parentcaafa2704e01539dc4db3f2589ee2cec2b86b935 (diff)
downloadnetsurf-5c9f7937f5b4779e903eb39385907f3f793a723e.tar.gz
netsurf-5c9f7937f5b4779e903eb39385907f3f793a723e.tar.bz2
Fixed bold/italic styles
svn path=/trunk/netsurf/; revision=5328
-rw-r--r--amiga/font.c49
1 files changed, 42 insertions, 7 deletions
diff --git a/amiga/font.c b/amiga/font.c
index ae0b205e6..21a85c522 100644
--- a/amiga/font.c
+++ b/amiga/font.c
@@ -28,10 +28,17 @@
#include "desktop/options.h"
#include "amiga/utf8.h"
#include "utils/utf8.h"
+
#include <diskfont/diskfonttag.h>
#include <diskfont/oterrors.h>
#include <proto/Picasso96API.h>
+#include <proto/ttengine.h>
+#include <proto/exec.h>
+
+struct Library *TTEngineBase = NULL;
+struct TTEngineIFace *ITTEngine = NULL;
+
static bool nsfont_width(const struct css_style *style,
const char *string, size_t length,
int *width);
@@ -94,24 +101,27 @@ bool nsfont_position_in_string(const struct css_style *style,
{
struct TextExtent extent;
struct TextFont *tfont = ami_open_font(style);
+/*
char *buffer;
utf8_to_local_encoding(string,length,&buffer);
if(buffer)
{
- *char_offset = TextFit(currp,buffer,strlen(buffer),
+*/
+ *char_offset = TextFit(currp,string,length,
&extent,NULL,1,x,32767);
*actual_x = extent.te_Extent.MaxX;
+/*
}
else
{
*char_offset = 0;
*actual_x = 0;
}
-
+*/
ami_close_font(tfont);
- ami_utf8_free(buffer);
+// ami_utf8_free(buffer);
return true;
}
@@ -206,11 +216,8 @@ struct TextFont *ami_open_font(struct css_style *style)
switch(style->font_style)
{
case CSS_FONT_STYLE_ITALIC:
- tattr.tta_Style = FSB_ITALIC;
- break;
-
case CSS_FONT_STYLE_OBLIQUE:
- tattr.tta_Style = FSB_BOLD;
+ tattr.tta_Style = FSF_ITALIC;
break;
default:
@@ -218,6 +225,14 @@ struct TextFont *ami_open_font(struct css_style *style)
break;
}
+ switch(style->font_weight)
+ {
+ case CSS_FONT_WEIGHT_BOLD:
+ case CSS_FONT_WEIGHT_BOLDER:
+ tattr.tta_Style |= FSF_BOLD;
+ break;
+ }
+
/* not supported
switch(style->font_variant)
{
@@ -439,3 +454,23 @@ rendering bitmap. */
ami_close_outline_font(ofont);
}
+
+bool ami_open_tte(void)
+{
+ if(TTEngineBase = OpenLibrary("ttengine.library",0))
+ {
+ if(ITTEngine = (struct TTEngineIFace *)GetInterface(TTEngineBase,"main",1,NULL))
+ {
+ return true;
+ }
+ }
+
+ ami_close_tte();
+ return false;
+}
+
+void ami_close_tte(void)
+{
+ if(ITTEngine) DropInterface((struct Interface *)ITTEngine);
+ if(TTEngineBase) CloseLibrary(TTEngineBase);
+}