r5328 chris_y - /trunk/netsurf/amiga/font.c

netsurf at semichrome.net netsurf at semichrome.net
Mon Sep 15 19:56:11 BST 2008


Author: chris_y
Date: Mon Sep 15 13:56:11 2008
New Revision: 5328

URL: http://source.netsurf-browser.org?rev=5328&view=rev
Log:
Fixed bold/italic styles

Modified:
    trunk/netsurf/amiga/font.c

Modified: trunk/netsurf/amiga/font.c
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/font.c?rev=5328&r1=5327&r2=5328&view=diff
==============================================================================
--- trunk/netsurf/amiga/font.c (original)
+++ trunk/netsurf/amiga/font.c Mon Sep 15 13:56:11 2008
@@ -28,9 +28,16 @@
 #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,
@@ -94,24 +101,27 @@
 {
 	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,15 +216,20 @@
 	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:
 			tattr.tta_Style = FS_NORMAL;
+		break;
+	}
+
+	switch(style->font_weight)
+	{
+		case CSS_FONT_WEIGHT_BOLD:
+		case CSS_FONT_WEIGHT_BOLDER:
+			tattr.tta_Style |= FSF_BOLD;
 		break;
 	}
 
@@ -439,3 +454,23 @@
 
 	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);
+}




More information about the netsurf-commits mailing list