You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by hi...@apache.org on 2006/07/17 20:34:19 UTC
svn commit: r422782 -
/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/linuxfont/linux/LinuxNativeFont.c
Author: hindessm
Date: Mon Jul 17 11:34:19 2006
New Revision: 422782
URL: http://svn.apache.org/viewvc?rev=422782&view=rev
Log:
Fixed linux font library to work with FreeType 2.2.
Modified:
incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/linuxfont/linux/LinuxNativeFont.c
Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/linuxfont/linux/LinuxNativeFont.c
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/linuxfont/linux/LinuxNativeFont.c?rev=422782&r1=422781&r2=422782&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/linuxfont/linux/LinuxNativeFont.c (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/linuxfont/linux/LinuxNativeFont.c Mon Jul 17 11:34:19 2006
@@ -24,7 +24,23 @@
#include <X11/Xft/Xft.h>
#include <freetype/tttables.h>
#include <freetype/t1tables.h>
+#if (FREETYPE_MAJOR >= 2 && FREETYPE_MINOR >= 2)
+
+#undef HAS_FREETYPE_INTERNAL
+#include <freetype/ftsizes.h>
+#include <freetype/ftglyph.h>
+#ifndef FALSE
+#define FALSE (0)
+#define TRUE (1)
+#endif /* FALSE */
+
+#else /* FREETYPE_MAJOR ... */
+
+#define HAS_FREETYPE_INTERNAL 1
#include <freetype/internal/tttypes.h>
+
+#endif /* FREETYPE_MAJOR ... */
+
#include <freetype/ftsnames.h>
#include <stdio.h>
@@ -707,8 +723,10 @@
jfloat italicAngle = 0.0;
XftFont *xftFnt = (XftFont *)fnt;
FT_Face face;
+#if HAS_FREETYPE_INTERNAL
TT_Face tt_face;
- TT_HoriHeader hh;
+#endif
+ TT_HoriHeader* hh;
float rise;
float run;
PS_FontInfoRec afont_info;
@@ -718,10 +736,14 @@
face = XftLockFace(xftFnt);
if (fontType == FONT_TYPE_TT){
+#if HAS_FREETYPE_INTERNAL
tt_face = (TT_Face)face;
- hh = tt_face->horizontal;
- rise = (float)hh.caret_Slope_Rise;
- run = (float)hh.caret_Slope_Run;
+ hh = &(tt_face->horizontal);
+#else
+ hh = (TT_HoriHeader*)FT_Get_Sfnt_Table(face, ft_sfnt_hhea);
+#endif
+ rise = (float)hh->caret_Slope_Rise;
+ run = (float)hh->caret_Slope_Run;
italicAngle = run / rise ;
} else {
@@ -871,11 +893,13 @@
XftFont *xftFnt = (XftFont *)fnt;
FT_Face face;
- TT_OS2 os2;
+ TT_OS2* os2;
+#if HAS_FREETYPE_INTERNAL
TT_Face tt_face;
+#endif
int units_per_EM;
- FT_Size_Metrics size_metrics;
- FT_Size size;
+ FT_Size_Metrics size_metrics;
+ FT_Size size;
float mltpl;
#ifdef DEBUG
@@ -897,11 +921,15 @@
values[4] = (float)(face->underline_position) * mltpl; // Underline position value
if (fontType == FONT_TYPE_TT){
+#if HAS_FREETYPE_INTERNAL
tt_face = (TT_Face)face;
+ os2 = &(tt_face->os2);
+#else
+ os2 = (TT_OS2*)FT_Get_Sfnt_Table(face, ft_sfnt_os2);
+#endif
- os2 = tt_face->os2;
- values[5] = (float)(os2.yStrikeoutSize) * mltpl; // Strikeout size value
- values[6] = (float)(os2.yStrikeoutPosition) * mltpl; // Strikeout position value
+ values[5] = (float)(os2->yStrikeoutSize) * mltpl; // Strikeout size value
+ values[6] = (float)(os2->yStrikeoutPosition) * mltpl; // Strikeout position value
} else {
values[5] = values[3];
// !!Workaround: for Type1 fonts strikethrough position = (-ascent+descent)/2