summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/freetype/src
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/freetype/src')
-rw-r--r--src/3rdparty/freetype/src/autofit/afcjk.c59
-rw-r--r--src/3rdparty/freetype/src/autofit/afhints.c8
-rw-r--r--src/3rdparty/freetype/src/autofit/aflatin.c55
-rw-r--r--src/3rdparty/freetype/src/autofit/aflatin2.c10
-rw-r--r--src/3rdparty/freetype/src/autofit/aftypes.h7
-rw-r--r--src/3rdparty/freetype/src/autofit/module.mk2
-rw-r--r--src/3rdparty/freetype/src/base/Jamfile25
-rw-r--r--src/3rdparty/freetype/src/base/ftadvanc.c163
-rw-r--r--src/3rdparty/freetype/src/base/ftbase.c5
-rw-r--r--src/3rdparty/freetype/src/base/ftbase.h57
-rw-r--r--src/3rdparty/freetype/src/base/ftbitmap.c35
-rw-r--r--src/3rdparty/freetype/src/base/ftcalc.c134
-rw-r--r--src/3rdparty/freetype/src/base/ftcid.c56
-rw-r--r--src/3rdparty/freetype/src/base/ftdbgmem.c7
-rw-r--r--src/3rdparty/freetype/src/base/ftdebug.c2
-rw-r--r--src/3rdparty/freetype/src/base/ftfstype.c62
-rw-r--r--src/3rdparty/freetype/src/base/ftglyph.c64
-rw-r--r--src/3rdparty/freetype/src/base/ftinit.c6
-rw-r--r--src/3rdparty/freetype/src/base/ftlcdfil.c12
-rw-r--r--src/3rdparty/freetype/src/base/ftmac.c205
-rw-r--r--src/3rdparty/freetype/src/base/ftmm.c4
-rw-r--r--src/3rdparty/freetype/src/base/ftobjs.c286
-rw-r--r--src/3rdparty/freetype/src/base/ftotval.c3
-rw-r--r--src/3rdparty/freetype/src/base/ftoutln.c62
-rw-r--r--src/3rdparty/freetype/src/base/ftpatent.c4
-rw-r--r--src/3rdparty/freetype/src/base/ftpfr.c33
-rw-r--r--src/3rdparty/freetype/src/base/ftrfork.c18
-rw-r--r--src/3rdparty/freetype/src/base/ftstream.c5
-rw-r--r--src/3rdparty/freetype/src/base/ftstroke.c137
-rw-r--r--src/3rdparty/freetype/src/base/ftsynth.c30
-rw-r--r--src/3rdparty/freetype/src/base/ftsystem.c4
-rw-r--r--src/3rdparty/freetype/src/base/rules.mk18
-rw-r--r--src/3rdparty/freetype/src/bdf/bdfdrivr.c13
-rw-r--r--src/3rdparty/freetype/src/bdf/bdflib.c9
-rw-r--r--src/3rdparty/freetype/src/bdf/module.mk2
-rw-r--r--src/3rdparty/freetype/src/bdf/rules.mk7
-rw-r--r--src/3rdparty/freetype/src/cache/ftccmap.c20
-rw-r--r--src/3rdparty/freetype/src/cache/ftcmanag.c9
-rw-r--r--src/3rdparty/freetype/src/cache/rules.mk10
-rw-r--r--src/3rdparty/freetype/src/cff/cffdrivr.c105
-rw-r--r--src/3rdparty/freetype/src/cff/cffgload.c491
-rw-r--r--src/3rdparty/freetype/src/cff/cffgload.h1
-rw-r--r--src/3rdparty/freetype/src/cff/cffload.c13
-rw-r--r--src/3rdparty/freetype/src/cff/cffload.h5
-rw-r--r--src/3rdparty/freetype/src/cff/cffobjs.c243
-rw-r--r--src/3rdparty/freetype/src/cff/cffparse.c17
-rw-r--r--src/3rdparty/freetype/src/cff/module.mk2
-rw-r--r--src/3rdparty/freetype/src/cid/cidload.c34
-rw-r--r--src/3rdparty/freetype/src/cid/cidobjs.c81
-rw-r--r--src/3rdparty/freetype/src/cid/cidriver.c49
-rw-r--r--src/3rdparty/freetype/src/cid/cidtoken.h13
-rw-r--r--src/3rdparty/freetype/src/cid/module.mk2
-rw-r--r--src/3rdparty/freetype/src/gxvalid/gxvcommn.c12
-rw-r--r--src/3rdparty/freetype/src/gxvalid/gxvcommn.h8
-rw-r--r--src/3rdparty/freetype/src/gxvalid/gxvmort.c2
-rw-r--r--src/3rdparty/freetype/src/gxvalid/gxvmorx.c5
-rw-r--r--src/3rdparty/freetype/src/gxvalid/module.mk2
-rw-r--r--src/3rdparty/freetype/src/gzip/ftgzip.c6
-rw-r--r--src/3rdparty/freetype/src/gzip/inftrees.c3
-rw-r--r--src/3rdparty/freetype/src/lzw/ftlzw.c5
-rw-r--r--src/3rdparty/freetype/src/otvalid/Jamfile2
-rw-r--r--src/3rdparty/freetype/src/otvalid/module.mk2
-rw-r--r--src/3rdparty/freetype/src/otvalid/otvalid.h1
-rw-r--r--src/3rdparty/freetype/src/otvalid/otvcommn.h10
-rw-r--r--src/3rdparty/freetype/src/otvalid/otvgdef.c5
-rw-r--r--src/3rdparty/freetype/src/otvalid/otvgpos.c9
-rw-r--r--src/3rdparty/freetype/src/otvalid/otvmath.c4
-rw-r--r--src/3rdparty/freetype/src/otvalid/otvmod.c4
-rw-r--r--src/3rdparty/freetype/src/pcf/module.mk2
-rw-r--r--src/3rdparty/freetype/src/pcf/pcfdrivr.c17
-rw-r--r--src/3rdparty/freetype/src/pcf/pcfread.c14
-rw-r--r--src/3rdparty/freetype/src/pcf/rules.mk11
-rw-r--r--src/3rdparty/freetype/src/pfr/module.mk2
-rw-r--r--src/3rdparty/freetype/src/pfr/pfrdrivr.c11
-rw-r--r--src/3rdparty/freetype/src/pfr/pfrobjs.c11
-rw-r--r--src/3rdparty/freetype/src/psaux/afmparse.c9
-rw-r--r--src/3rdparty/freetype/src/psaux/module.mk2
-rw-r--r--src/3rdparty/freetype/src/psaux/psobjs.c46
-rw-r--r--src/3rdparty/freetype/src/psaux/t1decode.c17
-rw-r--r--src/3rdparty/freetype/src/pshinter/module.mk2
-rw-r--r--src/3rdparty/freetype/src/pshinter/pshalgo.c4
-rw-r--r--src/3rdparty/freetype/src/psnames/module.mk2
-rw-r--r--src/3rdparty/freetype/src/psnames/psmodule.c95
-rw-r--r--src/3rdparty/freetype/src/psnames/pstables.h9
-rw-r--r--src/3rdparty/freetype/src/raster/ftmisc.h5
-rw-r--r--src/3rdparty/freetype/src/raster/ftraster.c447
-rw-r--r--src/3rdparty/freetype/src/raster/module.mk2
-rw-r--r--src/3rdparty/freetype/src/raster/rules.mk3
-rw-r--r--src/3rdparty/freetype/src/sfnt/Jamfile2
-rw-r--r--src/3rdparty/freetype/src/sfnt/module.mk2
-rw-r--r--src/3rdparty/freetype/src/sfnt/rules.mk9
-rw-r--r--src/3rdparty/freetype/src/sfnt/sfdriver.c29
-rw-r--r--src/3rdparty/freetype/src/sfnt/sfobjs.c278
-rw-r--r--src/3rdparty/freetype/src/sfnt/ttcmap.c160
-rw-r--r--src/3rdparty/freetype/src/sfnt/ttkern.c29
-rw-r--r--src/3rdparty/freetype/src/sfnt/ttload.c181
-rw-r--r--src/3rdparty/freetype/src/sfnt/ttmtx.c14
-rw-r--r--src/3rdparty/freetype/src/sfnt/ttpost.c15
-rw-r--r--src/3rdparty/freetype/src/sfnt/ttsbit.c23
-rw-r--r--src/3rdparty/freetype/src/sfnt/ttsbit.h4
-rw-r--r--src/3rdparty/freetype/src/sfnt/ttsbit0.c129
-rw-r--r--src/3rdparty/freetype/src/smooth/ftgrays.c285
-rw-r--r--src/3rdparty/freetype/src/smooth/ftsmooth.c8
-rw-r--r--src/3rdparty/freetype/src/smooth/module.mk6
-rw-r--r--src/3rdparty/freetype/src/tools/docmaker/content.py14
-rw-r--r--src/3rdparty/freetype/src/tools/docmaker/sources.py10
-rw-r--r--src/3rdparty/freetype/src/tools/docmaker/tohtml.py106
-rw-r--r--src/3rdparty/freetype/src/tools/ftrandom/ftrandom.c10
-rw-r--r--src/3rdparty/freetype/src/tools/glnames.py13
-rw-r--r--src/3rdparty/freetype/src/truetype/module.mk2
-rw-r--r--src/3rdparty/freetype/src/truetype/ttdriver.c68
-rw-r--r--src/3rdparty/freetype/src/truetype/ttgload.c120
-rw-r--r--src/3rdparty/freetype/src/truetype/ttgload.h16
-rw-r--r--src/3rdparty/freetype/src/truetype/ttgxvar.c14
-rw-r--r--src/3rdparty/freetype/src/truetype/ttinterp.c35
-rw-r--r--src/3rdparty/freetype/src/truetype/ttobjs.c94
-rw-r--r--src/3rdparty/freetype/src/truetype/ttobjs.h6
-rw-r--r--src/3rdparty/freetype/src/truetype/ttpload.c59
-rw-r--r--src/3rdparty/freetype/src/type1/module.mk2
-rw-r--r--src/3rdparty/freetype/src/type1/t1afm.c9
-rw-r--r--src/3rdparty/freetype/src/type1/t1driver.c58
-rw-r--r--src/3rdparty/freetype/src/type1/t1gload.c77
-rw-r--r--src/3rdparty/freetype/src/type1/t1gload.h9
-rw-r--r--src/3rdparty/freetype/src/type1/t1load.c70
-rw-r--r--src/3rdparty/freetype/src/type1/t1objs.c134
-rw-r--r--src/3rdparty/freetype/src/type1/t1tokens.h13
-rw-r--r--src/3rdparty/freetype/src/type42/module.mk2
-rw-r--r--src/3rdparty/freetype/src/type42/rules.mk5
-rw-r--r--src/3rdparty/freetype/src/type42/t42drivr.c56
-rw-r--r--src/3rdparty/freetype/src/type42/t42objs.c76
-rw-r--r--src/3rdparty/freetype/src/type42/t42parse.c10
-rw-r--r--src/3rdparty/freetype/src/type42/t42types.h6
-rw-r--r--src/3rdparty/freetype/src/winfonts/module.mk2
-rw-r--r--src/3rdparty/freetype/src/winfonts/winfnt.c35
134 files changed, 3754 insertions, 2046 deletions
diff --git a/src/3rdparty/freetype/src/autofit/afcjk.c b/src/3rdparty/freetype/src/autofit/afcjk.c
index 7e9438b22..de3ce11d5 100644
--- a/src/3rdparty/freetype/src/autofit/afcjk.c
+++ b/src/3rdparty/freetype/src/autofit/afcjk.c
@@ -4,7 +4,7 @@
/* */
/* Auto-fitter hinting routines for CJK script (body). */
/* */
-/* Copyright 2006, 2007 by */
+/* Copyright 2006, 2007, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -1253,10 +1253,15 @@
else if ( after >= edge_limit )
af_cjk_align_serif_edge( hints, before, edge );
else
- edge->pos = before->pos +
- FT_MulDiv( edge->fpos - before->fpos,
- after->pos - before->pos,
- after->fpos - before->fpos );
+ {
+ if ( after->fpos == before->fpos )
+ edge->pos = before->pos;
+ else
+ edge->pos = before->pos +
+ FT_MulDiv( edge->fpos - before->fpos,
+ after->pos - before->pos,
+ after->fpos - before->fpos );
+ }
}
}
}
@@ -1436,29 +1441,29 @@
static const AF_Script_UniRangeRec af_cjk_uniranges[] =
{
#if 0
- { 0x0100, 0xFFFF }, /* why this? */
+ { 0x0100UL, 0xFFFFUL }, /* why this? */
#endif
- { 0x2E80, 0x2EFF }, /* CJK Radicals Supplement */
- { 0x2F00, 0x2FDF }, /* Kangxi Radicals */
- { 0x3000, 0x303F }, /* CJK Symbols and Punctuation */
- { 0x3040, 0x309F }, /* Hiragana */
- { 0x30A0, 0x30FF }, /* Katakana */
- { 0x3100, 0x312F }, /* Bopomofo */
- { 0x3130, 0x318F }, /* Hangul Compatibility Jamo */
- { 0x31A0, 0x31BF }, /* Bopomofo Extended */
- { 0x31C0, 0x31EF }, /* CJK Strokes */
- { 0x31F0, 0x31FF }, /* Katakana Phonetic Extensions */
- { 0x3200, 0x32FF }, /* Enclosed CJK Letters and Months */
- { 0x3300, 0x33FF }, /* CJK Compatibility */
- { 0x3400, 0x4DBF }, /* CJK Unified Ideographs Extension A */
- { 0x4DC0, 0x4DFF }, /* Yijing Hexagram Symbols */
- { 0x4E00, 0x9FFF }, /* CJK Unified Ideographs */
- { 0xF900, 0xFAFF }, /* CJK Compatibility Ideographs */
- { 0xFE30, 0xFE4F }, /* CJK Compatibility Forms */
- { 0xFF00, 0xFFEF }, /* Halfwidth and Fullwidth Forms */
- { 0x20000, 0x2A6DF }, /* CJK Unified Ideographs Extension B */
- { 0x2F800, 0x2FA1F }, /* CJK Compatibility Ideographs Supplement */
- { 0, 0 }
+ { 0x2E80UL, 0x2EFFUL }, /* CJK Radicals Supplement */
+ { 0x2F00UL, 0x2FDFUL }, /* Kangxi Radicals */
+ { 0x3000UL, 0x303FUL }, /* CJK Symbols and Punctuation */
+ { 0x3040UL, 0x309FUL }, /* Hiragana */
+ { 0x30A0UL, 0x30FFUL }, /* Katakana */
+ { 0x3100UL, 0x312FUL }, /* Bopomofo */
+ { 0x3130UL, 0x318FUL }, /* Hangul Compatibility Jamo */
+ { 0x31A0UL, 0x31BFUL }, /* Bopomofo Extended */
+ { 0x31C0UL, 0x31EFUL }, /* CJK Strokes */
+ { 0x31F0UL, 0x31FFUL }, /* Katakana Phonetic Extensions */
+ { 0x3200UL, 0x32FFUL }, /* Enclosed CJK Letters and Months */
+ { 0x3300UL, 0x33FFUL }, /* CJK Compatibility */
+ { 0x3400UL, 0x4DBFUL }, /* CJK Unified Ideographs Extension A */
+ { 0x4DC0UL, 0x4DFFUL }, /* Yijing Hexagram Symbols */
+ { 0x4E00UL, 0x9FFFUL }, /* CJK Unified Ideographs */
+ { 0xF900UL, 0xFAFFUL }, /* CJK Compatibility Ideographs */
+ { 0xFE30UL, 0xFE4FUL }, /* CJK Compatibility Forms */
+ { 0xFF00UL, 0xFFEFUL }, /* Halfwidth and Fullwidth Forms */
+ { 0x20000UL, 0x2A6DFUL }, /* CJK Unified Ideographs Extension B */
+ { 0x2F800UL, 0x2FA1FUL }, /* CJK Compatibility Ideographs Supplement */
+ { 0UL, 0UL }
};
diff --git a/src/3rdparty/freetype/src/autofit/afhints.c b/src/3rdparty/freetype/src/autofit/afhints.c
index 482870686..8ab176148 100644
--- a/src/3rdparty/freetype/src/autofit/afhints.c
+++ b/src/3rdparty/freetype/src/autofit/afhints.c
@@ -4,7 +4,7 @@
/* */
/* Auto-fitter hinting routines (body). */
/* */
-/* Copyright 2003, 2004, 2005, 2006, 2007 by */
+/* Copyright 2003, 2004, 2005, 2006, 2007, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -127,7 +127,7 @@
#ifdef AF_DEBUG
-#include <stdio.h>
+#include FT_CONFIG_STANDARD_LIBRARY_H
static const char*
af_dir_str( AF_Direction dir )
@@ -203,14 +203,14 @@
if ( flags & AF_EDGE_ROUND )
{
- memcpy( temp + pos, "round", 5 );
+ ft_memcpy( temp + pos, "round", 5 );
pos += 5;
}
if ( flags & AF_EDGE_SERIF )
{
if ( pos > 0 )
temp[pos++] = ' ';
- memcpy( temp + pos, "serif", 5 );
+ ft_memcpy( temp + pos, "serif", 5 );
pos += 5;
}
if ( pos == 0 )
diff --git a/src/3rdparty/freetype/src/autofit/aflatin.c b/src/3rdparty/freetype/src/autofit/aflatin.c
index b70da068a..ba59e5b38 100644
--- a/src/3rdparty/freetype/src/autofit/aflatin.c
+++ b/src/3rdparty/freetype/src/autofit/aflatin.c
@@ -4,7 +4,7 @@
/* */
/* Auto-fitter hinting routines for latin script (body). */
/* */
-/* Copyright 2003, 2004, 2005, 2006, 2007 by */
+/* Copyright 2003, 2004, 2005, 2006, 2007, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -2008,7 +2008,10 @@
if ( before >= edges && before < edge &&
after < edge_limit && after > edge )
{
- edge->pos = before->pos +
+ if ( after->opos == before->opos )
+ edge->pos = before->pos;
+ else
+ edge->pos = before->pos +
FT_MulDiv( edge->opos - before->opos,
after->pos - before->pos,
after->opos - before->opos );
@@ -2124,27 +2127,33 @@
static const AF_Script_UniRangeRec af_latin_uniranges[] =
{
- { 0x0020, 0x007F }, /* Basic Latin (no control characters) */
- { 0x00A0, 0x00FF }, /* Latin-1 Supplement (no control characters) */
- { 0x0100, 0x017F }, /* Latin Extended-A */
- { 0x0180, 0x024F }, /* Latin Extended-B */
- { 0x0250, 0x02AF }, /* IPA Extensions */
- { 0x02B0, 0x02FF }, /* Spacing Modifier Letters */
- { 0x0300, 0x036F }, /* Combining Diacritical Marks */
- { 0x0370, 0x03FF }, /* Greek and Coptic */
- { 0x0400, 0x04FF }, /* Cyrillic */
- { 0x0500, 0x052F }, /* Cyrillic Supplement */
- { 0x1D00, 0x1D7F }, /* Phonetic Extensions */
- { 0x1D80, 0x1DBF }, /* Phonetic Extensions Supplement */
- { 0x1DC0, 0x1DFF }, /* Combining Diacritical Marks Supplement */
- { 0x1E00, 0x1EFF }, /* Latin Extended Additional */
- { 0x1F00, 0x1FFF }, /* Greek Extended */
- { 0x2000, 0x206F }, /* General Punctuation */
- { 0x2070, 0x209F }, /* Superscripts and Subscripts */
- { 0x20A0, 0x20CF }, /* Currency Symbols */
- { 0x2150, 0x218F }, /* Number Forms */
- { 0x2460, 0x24FF }, /* Enclosed Alphanumerics */
- { 0 , 0 }
+ { 0x0020 , 0x007F }, /* Basic Latin (no control chars) */
+ { 0x00A0 , 0x00FF }, /* Latin-1 Supplement (no control chars) */
+ { 0x0100 , 0x017F }, /* Latin Extended-A */
+ { 0x0180 , 0x024F }, /* Latin Extended-B */
+ { 0x0250 , 0x02AF }, /* IPA Extensions */
+ { 0x02B0 , 0x02FF }, /* Spacing Modifier Letters */
+ { 0x0300 , 0x036F }, /* Combining Diacritical Marks */
+ { 0x0370 , 0x03FF }, /* Greek and Coptic */
+ { 0x0400 , 0x04FF }, /* Cyrillic */
+ { 0x0500 , 0x052F }, /* Cyrillic Supplement */
+ { 0x1D00 , 0x1D7F }, /* Phonetic Extensions */
+ { 0x1D80 , 0x1DBF }, /* Phonetic Extensions Supplement */
+ { 0x1DC0 , 0x1DFF }, /* Combining Diacritical Marks Supplement */
+ { 0x1E00 , 0x1EFF }, /* Latin Extended Additional */
+ { 0x1F00 , 0x1FFF }, /* Greek Extended */
+ { 0x2000 , 0x206F }, /* General Punctuation */
+ { 0x2070 , 0x209F }, /* Superscripts and Subscripts */
+ { 0x20A0 , 0x20CF }, /* Currency Symbols */
+ { 0x2150 , 0x218F }, /* Number Forms */
+ { 0x2460 , 0x24FF }, /* Enclosed Alphanumerics */
+ { 0x2C60 , 0x2C7F }, /* Latin Extended-C */
+ { 0x2DE0 , 0x2DFF }, /* Cyrillic Extended-A */
+ { 0xA640U , 0xA69FU }, /* Cyrillic Extended-B */
+ { 0xA720U , 0xA7FFU }, /* Latin Extended-D */
+ { 0xFB00U , 0xFB06U }, /* Alphab. Present. Forms (Latin Ligs) */
+ { 0x1D400UL, 0x1D7FFUL }, /* Mathematical Alphanumeric Symbols */
+ { 0 , 0 }
};
diff --git a/src/3rdparty/freetype/src/autofit/aflatin2.c b/src/3rdparty/freetype/src/autofit/aflatin2.c
index 0b4177414..14327b172 100644
--- a/src/3rdparty/freetype/src/autofit/aflatin2.c
+++ b/src/3rdparty/freetype/src/autofit/aflatin2.c
@@ -4,7 +4,7 @@
/* */
/* Auto-fitter hinting routines for latin script (body). */
/* */
-/* Copyright 2003, 2004, 2005, 2006, 2007 by */
+/* Copyright 2003, 2004, 2005, 2006, 2007, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -944,6 +944,9 @@
}
}
}
+#if 0
+ }
+#endif
/* now, compute the `serif' segments */
for ( seg1 = segments; seg1 < segment_limit; seg1++ )
@@ -2150,7 +2153,10 @@
if ( before >= edges && before < edge &&
after < edge_limit && after > edge )
{
- edge->pos = before->pos +
+ if ( after->opos == before->opos )
+ edge->pos = before->pos;
+ else
+ edge->pos = before->pos +
FT_MulDiv( edge->opos - before->opos,
after->pos - before->pos,
after->opos - before->opos );
diff --git a/src/3rdparty/freetype/src/autofit/aftypes.h b/src/3rdparty/freetype/src/autofit/aftypes.h
index 56811f0e4..626a38865 100644
--- a/src/3rdparty/freetype/src/autofit/aftypes.h
+++ b/src/3rdparty/freetype/src/autofit/aftypes.h
@@ -4,7 +4,7 @@
/* */
/* Auto-fitter types (specification only). */
/* */
-/* Copyright 2003, 2004, 2005, 2006, 2007, 2008 by */
+/* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -58,7 +58,8 @@ FT_BEGIN_HEADER
#ifdef AF_DEBUG
-#include <stdio.h>
+#include FT_CONFIG_STANDARD_LIBRARY_H
+
#define AF_LOG( x ) do { if ( _af_debug ) printf x; } while ( 0 )
extern int _af_debug;
@@ -69,7 +70,7 @@ extern void* _af_debug_hints;
#else /* !AF_DEBUG */
-#define AF_LOG( x ) do ; while ( 0 ) /* nothing */
+#define AF_LOG( x ) do { } while ( 0 ) /* nothing */
#endif /* !AF_DEBUG */
diff --git a/src/3rdparty/freetype/src/autofit/module.mk b/src/3rdparty/freetype/src/autofit/module.mk
index 4a386ce66..6ec60912a 100644
--- a/src/3rdparty/freetype/src/autofit/module.mk
+++ b/src/3rdparty/freetype/src/autofit/module.mk
@@ -16,7 +16,7 @@
FTMODULE_H_COMMANDS += AUTOFIT_MODULE
define AUTOFIT_MODULE
-$(OPEN_DRIVER)autofit_module_class$(CLOSE_DRIVER)
+$(OPEN_DRIVER) FT_Module_Class, autofit_module_class $(CLOSE_DRIVER)
$(ECHO_DRIVER)autofit $(ECHO_DRIVER_DESC)automatic hinting module$(ECHO_DRIVER_DONE)
endef
diff --git a/src/3rdparty/freetype/src/base/Jamfile b/src/3rdparty/freetype/src/base/Jamfile
index aeffe388e..aba60fbe0 100644
--- a/src/3rdparty/freetype/src/base/Jamfile
+++ b/src/3rdparty/freetype/src/base/Jamfile
@@ -1,6 +1,6 @@
# FreeType 2 src/base Jamfile
#
-# Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007 by
+# Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
@@ -17,8 +17,10 @@ SubDir FT2_TOP $(FT2_SRC_DIR) base ;
if $(FT2_MULTI)
{
- _sources = ftutil ftdbgmem ftstream ftcalc fttrigon ftgloadr ftoutln
- ftobjs ftnames ftrfork ;
+ _sources = ftadvanc ftcalc ftdbgmem ftgloadr
+ ftnames ftobjs ftoutln ftrfork
+ ftstream fttrigon ftutil
+ ;
}
else
{
@@ -31,11 +33,11 @@ SubDir FT2_TOP $(FT2_SRC_DIR) base ;
# Add the optional/replaceable files.
#
{
- local _sources = system init glyph mm bdf
- bbox debug xf86 type1 pfr
- stroke winfnt otval bitmap synth
- gxval lcdfil gasp patent
- ;
+ local _sources = bbox bdf bitmap debug gasp
+ glyph gxval init lcdfil mm
+ otval pfr stroke synth system
+ type1 winfnt xf86 patent
+ ;
Library $(FT2_LIB) : ft$(_sources).c ;
}
@@ -46,5 +48,12 @@ if $(MAC)
{
Library $(FT2_LIB) : ftmac.c ;
}
+else if $(OS) = MACOSX
+{
+ if $(FT2_MULTI)
+ {
+ Library $(FT2_LIB) : ftmac.c ;
+ }
+}
# end of src/base Jamfile
diff --git a/src/3rdparty/freetype/src/base/ftadvanc.c b/src/3rdparty/freetype/src/base/ftadvanc.c
new file mode 100644
index 000000000..504f9d230
--- /dev/null
+++ b/src/3rdparty/freetype/src/base/ftadvanc.c
@@ -0,0 +1,163 @@
+/***************************************************************************/
+/* */
+/* ftadvanc.c */
+/* */
+/* Quick computation of advance widths (body). */
+/* */
+/* Copyright 2008, 2009 by */
+/* David Turner, Robert Wilhelm, and Werner Lemberg. */
+/* */
+/* This file is part of the FreeType project, and may only be used, */
+/* modified, and distributed under the terms of the FreeType project */
+/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
+/* this file you indicate that you have read the license and */
+/* understand and accept it fully. */
+/* */
+/***************************************************************************/
+
+
+#include <ft2build.h>
+#include FT_ADVANCES_H
+#include FT_INTERNAL_OBJECTS_H
+
+
+ static FT_Error
+ _ft_face_scale_advances( FT_Face face,
+ FT_Fixed* advances,
+ FT_UInt count,
+ FT_Int32 flags )
+ {
+ FT_Fixed scale;
+ FT_UInt nn;
+
+
+ if ( flags & FT_LOAD_NO_SCALE )
+ return FT_Err_Ok;
+
+ if ( face->size == NULL )
+ return FT_Err_Invalid_Size_Handle;
+
+ if ( flags & FT_LOAD_VERTICAL_LAYOUT )
+ scale = face->size->metrics.y_scale;
+ else
+ scale = face->size->metrics.x_scale;
+
+ /* this must be the same scaling as to get linear{Hori,Vert}Advance */
+ /* (see `FT_Load_Glyph' implementation in src/base/ftobjs.c) */
+
+ for ( nn = 0; nn < count; nn++ )
+ advances[nn] = FT_MulDiv( advances[nn], scale, 64 );
+
+ return FT_Err_Ok;
+ }
+
+
+ /* at the moment, we can perform fast advance retrieval only in */
+ /* the following cases: */
+ /* */
+ /* - unscaled load */
+ /* - unhinted load */
+ /* - light-hinted load */
+
+#define LOAD_ADVANCE_FAST_CHECK( flags ) \
+ ( flags & ( FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING ) || \
+ FT_LOAD_TARGET_MODE( flags ) == FT_RENDER_MODE_LIGHT )
+
+
+ /* documentation is in ftadvanc.h */
+
+ FT_EXPORT_DEF( FT_Error )
+ FT_Get_Advance( FT_Face face,
+ FT_UInt gindex,
+ FT_Int32 flags,
+ FT_Fixed *padvance )
+ {
+ FT_Face_GetAdvancesFunc func;
+
+
+ if ( !face )
+ return FT_Err_Invalid_Face_Handle;
+
+ if ( gindex >= (FT_UInt)face->num_glyphs )
+ return FT_Err_Invalid_Glyph_Index;
+
+ func = face->driver->clazz->get_advances;
+ if ( func && LOAD_ADVANCE_FAST_CHECK( flags ) )
+ {
+ FT_Error error;
+
+
+ error = func( face, gindex, 1, flags, padvance );
+ if ( !error )
+ return _ft_face_scale_advances( face, padvance, 1, flags );
+
+ if ( error != FT_ERROR_BASE( FT_Err_Unimplemented_Feature ) )
+ return error;
+ }
+
+ return FT_Get_Advances( face, gindex, 1, flags, padvance );
+ }
+
+
+ /* documentation is in ftadvanc.h */
+
+ FT_EXPORT_DEF( FT_Error )
+ FT_Get_Advances( FT_Face face,
+ FT_UInt start,
+ FT_UInt count,
+ FT_Int32 flags,
+ FT_Fixed *padvances )
+ {
+ FT_Face_GetAdvancesFunc func;
+ FT_UInt num, end, nn;
+ FT_Error error = FT_Err_Ok;
+
+
+ if ( !face )
+ return FT_Err_Invalid_Face_Handle;
+
+ num = (FT_UInt)face->num_glyphs;
+ end = start + count;
+ if ( start >= num || end < start || end > num )
+ return FT_Err_Invalid_Glyph_Index;
+
+ if ( count == 0 )
+ return FT_Err_Ok;
+
+ func = face->driver->clazz->get_advances;
+ if ( func && LOAD_ADVANCE_FAST_CHECK( flags ) )
+ {
+ error = func( face, start, count, flags, padvances );
+ if ( !error )
+ goto Exit;
+
+ if ( error != FT_ERROR_BASE( FT_Err_Unimplemented_Feature ) )
+ return error;
+ }
+
+ error = FT_Err_Ok;
+
+ if ( flags & FT_ADVANCE_FLAG_FAST_ONLY )
+ return FT_Err_Unimplemented_Feature;
+
+ flags |= FT_LOAD_ADVANCE_ONLY;
+ for ( nn = 0; nn < count; nn++ )
+ {
+ error = FT_Load_Glyph( face, start + nn, flags );
+ if ( error )
+ break;
+
+ padvances[nn] = ( flags & FT_LOAD_VERTICAL_LAYOUT )
+ ? face->glyph->advance.y
+ : face->glyph->advance.x;
+ }
+
+ if ( error )
+ return error;
+
+ Exit:
+ return _ft_face_scale_advances( face, padvances, count, flags );
+ }
+
+
+/* END */
diff --git a/src/3rdparty/freetype/src/base/ftbase.c b/src/3rdparty/freetype/src/base/ftbase.c
index 300e02d15..d1fe6e608 100644
--- a/src/3rdparty/freetype/src/base/ftbase.c
+++ b/src/3rdparty/freetype/src/base/ftbase.c
@@ -4,7 +4,7 @@
/* */
/* Single object library component (body only). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2004, 2006, 2007 by */
+/* Copyright 1996-2001, 2002, 2003, 2004, 2006, 2007, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -20,6 +20,7 @@
#define FT_MAKE_OPTION_SINGLE_OBJECT
+#include "ftadvanc.c"
#include "ftcalc.c"
#include "ftdbgmem.c"
#include "ftgloadr.c"
@@ -31,7 +32,7 @@
#include "fttrigon.c"
#include "ftutil.c"
-#if defined( __APPLE__ ) && !defined ( DARWIN_NO_CARBON )
+#if defined( FT_MACINTOSH ) && !defined ( DARWIN_NO_CARBON )
#include "ftmac.c"
#endif
diff --git a/src/3rdparty/freetype/src/base/ftbase.h b/src/3rdparty/freetype/src/base/ftbase.h
new file mode 100644
index 000000000..9cae85da9
--- /dev/null
+++ b/src/3rdparty/freetype/src/base/ftbase.h
@@ -0,0 +1,57 @@
+/***************************************************************************/
+/* */
+/* ftbase.h */
+/* */
+/* The FreeType private functions used in base module (specification). */
+/* */
+/* Copyright 2008 by */
+/* David Turner, Robert Wilhelm, Werner Lemberg, and suzuki toshiya. */
+/* */
+/* This file is part of the FreeType project, and may only be used, */
+/* modified, and distributed under the terms of the FreeType project */
+/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
+/* this file you indicate that you have read the license and */
+/* understand and accept it fully. */
+/* */
+/***************************************************************************/
+
+
+#ifndef __FTBASE_H__
+#define __FTBASE_H__
+
+
+#include <ft2build.h>
+#include FT_INTERNAL_OBJECTS_H
+
+
+FT_BEGIN_HEADER
+
+
+ /* Assume the stream is sfnt-wrapped PS Type1 or sfnt-wrapped CID-keyed */
+ /* font, and try to load a face specified by the face_index. */
+ FT_LOCAL_DEF( FT_Error )
+ open_face_PS_from_sfnt_stream( FT_Library library,
+ FT_Stream stream,
+ FT_Long face_index,
+ FT_Int num_params,
+ FT_Parameter *params,
+ FT_Face *aface );
+
+
+ /* Create a new FT_Face given a buffer and a driver name. */
+ /* From ftmac.c. */
+ FT_LOCAL_DEF( FT_Error )
+ open_face_from_buffer( FT_Library library,
+ FT_Byte* base,
+ FT_ULong size,
+ FT_Long face_index,
+ const char* driver_name,
+ FT_Face *aface );
+
+
+FT_END_HEADER
+
+#endif /* __FTBASE_H__ */
+
+
+/* END */
diff --git a/src/3rdparty/freetype/src/base/ftbitmap.c b/src/3rdparty/freetype/src/base/ftbitmap.c
index 4c1cdf218..8810cfadf 100644
--- a/src/3rdparty/freetype/src/base/ftbitmap.c
+++ b/src/3rdparty/freetype/src/base/ftbitmap.c
@@ -2,10 +2,9 @@
/* */
/* ftbitmap.c */
/* */
-/* FreeType utility functions for converting 1bpp, 2bpp, 4bpp, and 8bpp */
-/* bitmaps into 8bpp format (body). */
+/* FreeType utility functions for bitmaps (body). */
/* */
-/* Copyright 2004, 2005, 2006, 2007 by */
+/* Copyright 2004, 2005, 2006, 2007, 2008, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -19,6 +18,7 @@
#include <ft2build.h>
#include FT_BITMAP_H
+#include FT_IMAGE_H
#include FT_INTERNAL_OBJECTS_H
@@ -388,6 +388,8 @@
case FT_PIXEL_MODE_GRAY:
case FT_PIXEL_MODE_GRAY2:
case FT_PIXEL_MODE_GRAY4:
+ case FT_PIXEL_MODE_LCD:
+ case FT_PIXEL_MODE_LCD_V:
{
FT_Int pad;
FT_Long old_size;
@@ -482,6 +484,8 @@
case FT_PIXEL_MODE_GRAY:
+ case FT_PIXEL_MODE_LCD:
+ case FT_PIXEL_MODE_LCD_V:
{
FT_Int width = source->width;
FT_Byte* s = source->buffer;
@@ -606,6 +610,31 @@
/* documentation is in ftbitmap.h */
FT_EXPORT_DEF( FT_Error )
+ FT_GlyphSlot_Own_Bitmap( FT_GlyphSlot slot )
+ {
+ if ( slot && slot->format == FT_GLYPH_FORMAT_BITMAP &&
+ !( slot->internal->flags & FT_GLYPH_OWN_BITMAP ) )
+ {
+ FT_Bitmap bitmap;
+ FT_Error error;
+
+
+ FT_Bitmap_New( &bitmap );
+ error = FT_Bitmap_Copy( slot->library, &slot->bitmap, &bitmap );
+ if ( error )
+ return error;
+
+ slot->bitmap = bitmap;
+ slot->internal->flags |= FT_GLYPH_OWN_BITMAP;
+ }
+
+ return FT_Err_Ok;
+ }
+
+
+ /* documentation is in ftbitmap.h */
+
+ FT_EXPORT_DEF( FT_Error )
FT_Bitmap_Done( FT_Library library,
FT_Bitmap *bitmap )
{
diff --git a/src/3rdparty/freetype/src/base/ftcalc.c b/src/3rdparty/freetype/src/base/ftcalc.c
index c69b9f6c8..04295a693 100644
--- a/src/3rdparty/freetype/src/base/ftcalc.c
+++ b/src/3rdparty/freetype/src/base/ftcalc.c
@@ -33,10 +33,14 @@
#include <ft2build.h>
+#include FT_GLYPH_H
#include FT_INTERNAL_CALC_H
#include FT_INTERNAL_DEBUG_H
#include FT_INTERNAL_OBJECTS_H
+#ifdef FT_MULFIX_INLINED
+#undef FT_MulFix
+#endif
/* we need to define a 64-bits data type here */
@@ -192,15 +196,33 @@
FT_MulFix( FT_Long a,
FT_Long b )
{
+#ifdef FT_MULFIX_ASSEMBLER
+
+ return FT_MULFIX_ASSEMBLER( a, b );
+
+#else
+
FT_Int s = 1;
FT_Long c;
- if ( a < 0 ) { a = -a; s = -1; }
- if ( b < 0 ) { b = -b; s = -s; }
+ if ( a < 0 )
+ {
+ a = -a;
+ s = -1;
+ }
+
+ if ( b < 0 )
+ {
+ b = -b;
+ s = -s;
+ }
c = (FT_Long)( ( (FT_Int64)a * b + 0x8000L ) >> 16 );
- return ( s > 0 ) ? c : -c ;
+
+ return ( s > 0 ) ? c : -c;
+
+#endif /* FT_MULFIX_ASSEMBLER */
}
@@ -412,31 +434,18 @@
FT_MulFix( FT_Long a,
FT_Long b )
{
- /* use inline assembly to speed up things a bit */
-
-#if defined( __GNUC__ ) && defined( i386 )
-
- FT_Long result;
-
-
- __asm__ __volatile__ (
- "imul %%edx\n"
- "movl %%edx, %%ecx\n"
- "sarl $31, %%ecx\n"
- "addl $0x8000, %%ecx\n"
- "addl %%ecx, %%eax\n"
- "adcl $0, %%edx\n"
- "shrl $16, %%eax\n"
- "shll $16, %%edx\n"
- "addl %%edx, %%eax\n"
- "mov %%eax, %0\n"
- : "=a"(result), "+d"(b)
- : "a"(a)
- : "%ecx"
- );
- return result;
+#ifdef FT_MULFIX_ASSEMBLER
-#elif 1
+ return FT_MULFIX_ASSEMBLER( a, b );
+
+#elif 0
+
+ /*
+ * This code is nonportable. See comment below.
+ *
+ * However, on a platform where right-shift of a signed quantity fills
+ * the leftmost bits by copying the sign bit, it might be faster.
+ */
FT_Long sa, sb;
FT_ULong ua, ub;
@@ -445,6 +454,24 @@
if ( a == 0 || b == 0x10000L )
return a;
+ /*
+ * This is a clever way of converting a signed number `a' into its
+ * absolute value (stored back into `a') and its sign. The sign is
+ * stored in `sa'; 0 means `a' was positive or zero, and -1 means `a'
+ * was negative. (Similarly for `b' and `sb').
+ *
+ * Unfortunately, it doesn't work (at least not portably).
+ *
+ * It makes the assumption that right-shift on a negative signed value
+ * fills the leftmost bits by copying the sign bit. This is wrong.
+ * According to K&R 2nd ed, section `A7.8 Shift Operators' on page 206,
+ * the result of right-shift of a negative signed value is
+ * implementation-defined. At least one implementation fills the
+ * leftmost bits with 0s (i.e., it is exactly the same as an unsigned
+ * right shift). This means that when `a' is negative, `sa' ends up
+ * with the value 1 rather than -1. After that, everything else goes
+ * wrong.
+ */
sa = ( a >> ( sizeof ( a ) * 8 - 1 ) );
a = ( a ^ sa ) - sa;
sb = ( b >> ( sizeof ( b ) * 8 - 1 ) );
@@ -666,6 +693,59 @@
#endif /* FT_LONG64 */
+ /* documentation is in ftglyph.h */
+
+ FT_EXPORT_DEF( void )
+ FT_Matrix_Multiply( const FT_Matrix* a,
+ FT_Matrix *b )
+ {
+ FT_Fixed xx, xy, yx, yy;
+
+
+ if ( !a || !b )
+ return;
+
+ xx = FT_MulFix( a->xx, b->xx ) + FT_MulFix( a->xy, b->yx );
+ xy = FT_MulFix( a->xx, b->xy ) + FT_MulFix( a->xy, b->yy );
+ yx = FT_MulFix( a->yx, b->xx ) + FT_MulFix( a->yy, b->yx );
+ yy = FT_MulFix( a->yx, b->xy ) + FT_MulFix( a->yy, b->yy );
+
+ b->xx = xx; b->xy = xy;
+ b->yx = yx; b->yy = yy;
+ }
+
+
+ /* documentation is in ftglyph.h */
+
+ FT_EXPORT_DEF( FT_Error )
+ FT_Matrix_Invert( FT_Matrix* matrix )
+ {
+ FT_Pos delta, xx, yy;
+
+
+ if ( !matrix )
+ return FT_Err_Invalid_Argument;
+
+ /* compute discriminant */
+ delta = FT_MulFix( matrix->xx, matrix->yy ) -
+ FT_MulFix( matrix->xy, matrix->yx );
+
+ if ( !delta )
+ return FT_Err_Invalid_Argument; /* matrix can't be inverted */
+
+ matrix->xy = - FT_DivFix( matrix->xy, delta );
+ matrix->yx = - FT_DivFix( matrix->yx, delta );
+
+ xx = matrix->xx;
+ yy = matrix->yy;
+
+ matrix->xx = FT_DivFix( yy, delta );
+ matrix->yy = FT_DivFix( xx, delta );
+
+ return FT_Err_Ok;
+ }
+
+
/* documentation is in ftcalc.h */
FT_BASE_DEF( void )
diff --git a/src/3rdparty/freetype/src/base/ftcid.c b/src/3rdparty/freetype/src/base/ftcid.c
index 5a8b50ff2..733aae147 100644
--- a/src/3rdparty/freetype/src/base/ftcid.c
+++ b/src/3rdparty/freetype/src/base/ftcid.c
@@ -4,7 +4,7 @@
/* */
/* FreeType API for accessing CID font information. */
/* */
-/* Copyright 2007 by Derek Clegg. */
+/* Copyright 2007, 2009 by Derek Clegg, Michael Toftdal. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
@@ -16,6 +16,7 @@
#include <ft2build.h>
+#include FT_CID_H
#include FT_INTERNAL_OBJECTS_H
#include FT_SERVICE_CID_H
@@ -60,4 +61,57 @@
}
+ FT_EXPORT_DEF( FT_Error )
+ FT_Get_CID_Is_Internally_CID_Keyed( FT_Face face,
+ FT_Bool *is_cid )
+ {
+ FT_Error error = FT_Err_Invalid_Argument;
+ FT_Bool ic = 0;
+
+
+ if ( face )
+ {
+ FT_Service_CID service;
+
+
+ FT_FACE_FIND_SERVICE( face, service, CID );
+
+ if ( service && service->get_is_cid )
+ error = service->get_is_cid( face, &ic);
+ }
+
+ if ( is_cid )
+ *is_cid = ic;
+
+ return error;
+ }
+
+
+ FT_EXPORT_DEF( FT_Error )
+ FT_Get_CID_From_Glyph_Index( FT_Face face,
+ FT_UInt glyph_index,
+ FT_UInt *cid )
+ {
+ FT_Error error = FT_Err_Invalid_Argument;
+ FT_UInt c = 0;
+
+
+ if ( face )
+ {
+ FT_Service_CID service;
+
+
+ FT_FACE_FIND_SERVICE( face, service, CID );
+
+ if ( service && service->get_cid_from_glyph_index )
+ error = service->get_cid_from_glyph_index( face, glyph_index, &c);
+ }
+
+ if ( cid )
+ *cid = c;
+
+ return error;
+ }
+
+
/* END */
diff --git a/src/3rdparty/freetype/src/base/ftdbgmem.c b/src/3rdparty/freetype/src/base/ftdbgmem.c
index 52a5c2057..8b2a3304f 100644
--- a/src/3rdparty/freetype/src/base/ftdbgmem.c
+++ b/src/3rdparty/freetype/src/base/ftdbgmem.c
@@ -4,7 +4,7 @@
/* */
/* Memory debugger (body). */
/* */
-/* Copyright 2001, 2002, 2003, 2004, 2005, 2006 by */
+/* Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -33,8 +33,7 @@
* memory, however.
*/
-#include <stdio.h>
-#include <stdlib.h>
+#include FT_CONFIG_STANDARD_LIBRARY_H
FT_BASE_DEF( const char* ) _ft_debug_file = 0;
FT_BASE_DEF( long ) _ft_debug_lineno = 0;
@@ -990,7 +989,7 @@
#else /* !FT_DEBUG_MEMORY */
/* ANSI C doesn't like empty source files */
- const FT_Byte _debug_mem_dummy = 0;
+ static const FT_Byte _debug_mem_dummy = 0;
#endif /* !FT_DEBUG_MEMORY */
diff --git a/src/3rdparty/freetype/src/base/ftdebug.c b/src/3rdparty/freetype/src/base/ftdebug.c
index 356c8c2b1..2adbeabeb 100644
--- a/src/3rdparty/freetype/src/base/ftdebug.c
+++ b/src/3rdparty/freetype/src/base/ftdebug.c
@@ -46,7 +46,7 @@
#include FT_INTERNAL_DEBUG_H
-#if defined( FT_DEBUG_LEVEL_ERROR )
+#ifdef FT_DEBUG_LEVEL_ERROR
/* documentation is in ftdebug.h */
diff --git a/src/3rdparty/freetype/src/base/ftfstype.c b/src/3rdparty/freetype/src/base/ftfstype.c
new file mode 100644
index 000000000..d0ef7b7c1
--- /dev/null
+++ b/src/3rdparty/freetype/src/base/ftfstype.c
@@ -0,0 +1,62 @@
+/***************************************************************************/
+/* */
+/* ftfstype.c */
+/* */
+/* FreeType utility file to access FSType data (body). */
+/* */
+/* Copyright 2008, 2009 by */
+/* David Turner, Robert Wilhelm, and Werner Lemberg. */
+/* */
+/* This file is part of the FreeType project, and may only be used, */
+/* modified, and distributed under the terms of the FreeType project */
+/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
+/* this file you indicate that you have read the license and */
+/* understand and accept it fully. */
+/* */
+/***************************************************************************/
+
+#include <ft2build.h>
+#include FT_TYPE1_TABLES_H
+#include FT_TRUETYPE_TABLES_H
+#include FT_INTERNAL_SERVICE_H
+#include FT_SERVICE_POSTSCRIPT_INFO_H
+
+
+ /* documentation is in freetype.h */
+
+ FT_EXPORT_DEF( FT_UShort )
+ FT_Get_FSType_Flags( FT_Face face )
+ {
+ TT_OS2* os2;
+
+
+ /* first, try to get the fs_type directly from the font */
+ if ( face )
+ {
+ FT_Service_PsInfo service = NULL;
+
+
+ FT_FACE_FIND_SERVICE( face, service, POSTSCRIPT_INFO );
+
+ if ( service && service->ps_get_font_extra )
+ {
+ PS_FontExtraRec extra;
+
+
+ if ( !service->ps_get_font_extra( face, &extra ) &&
+ extra.fs_type != 0 )
+ return extra.fs_type;
+ }
+ }
+
+ /* look at FSType before fsType for Type42 */
+
+ if ( ( os2 = (TT_OS2*)FT_Get_Sfnt_Table( face, ft_sfnt_os2 ) ) != NULL &&
+ os2->version != 0xFFFFU )
+ return os2->fsType;
+
+ return 0;
+ }
+
+
+/* END */
diff --git a/src/3rdparty/freetype/src/base/ftglyph.c b/src/3rdparty/freetype/src/base/ftglyph.c
index db0e79fca..4130cb110 100644
--- a/src/3rdparty/freetype/src/base/ftglyph.c
+++ b/src/3rdparty/freetype/src/base/ftglyph.c
@@ -4,7 +4,7 @@
/* */
/* FreeType convenience functions to handle glyphs (body). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2007 by */
+/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2007, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -48,68 +48,6 @@
/*************************************************************************/
/*************************************************************************/
/**** ****/
- /**** Convenience functions ****/
- /**** ****/
- /*************************************************************************/
- /*************************************************************************/
-
-
- /* documentation is in ftglyph.h */
-
- FT_EXPORT_DEF( void )
- FT_Matrix_Multiply( const FT_Matrix* a,
- FT_Matrix *b )
- {
- FT_Fixed xx, xy, yx, yy;
-
-
- if ( !a || !b )
- return;
-
- xx = FT_MulFix( a->xx, b->xx ) + FT_MulFix( a->xy, b->yx );
- xy = FT_MulFix( a->xx, b->xy ) + FT_MulFix( a->xy, b->yy );
- yx = FT_MulFix( a->yx, b->xx ) + FT_MulFix( a->yy, b->yx );
- yy = FT_MulFix( a->yx, b->xy ) + FT_MulFix( a->yy, b->yy );
-
- b->xx = xx; b->xy = xy;
- b->yx = yx; b->yy = yy;
- }
-
-
- /* documentation is in ftglyph.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Matrix_Invert( FT_Matrix* matrix )
- {
- FT_Pos delta, xx, yy;
-
-
- if ( !matrix )
- return FT_Err_Invalid_Argument;
-
- /* compute discriminant */
- delta = FT_MulFix( matrix->xx, matrix->yy ) -
- FT_MulFix( matrix->xy, matrix->yx );
-
- if ( !delta )
- return FT_Err_Invalid_Argument; /* matrix can't be inverted */
-
- matrix->xy = - FT_DivFix( matrix->xy, delta );
- matrix->yx = - FT_DivFix( matrix->yx, delta );
-
- xx = matrix->xx;
- yy = matrix->yy;
-
- matrix->xx = FT_DivFix( yy, delta );
- matrix->yy = FT_DivFix( xx, delta );
-
- return FT_Err_Ok;
- }
-
-
- /*************************************************************************/
- /*************************************************************************/
- /**** ****/
/**** FT_BitmapGlyph support ****/
/**** ****/
/*************************************************************************/
diff --git a/src/3rdparty/freetype/src/base/ftinit.c b/src/3rdparty/freetype/src/base/ftinit.c
index 7af19c3d8..dac30b0d8 100644
--- a/src/3rdparty/freetype/src/base/ftinit.c
+++ b/src/3rdparty/freetype/src/base/ftinit.c
@@ -55,9 +55,9 @@
#undef FT_USE_MODULE
#ifdef __cplusplus
-#define FT_USE_MODULE( x ) extern "C" const FT_Module_Class x;
+#define FT_USE_MODULE( type, x ) extern "C" const type x;
#else
-#define FT_USE_MODULE( x ) extern const FT_Module_Class x;
+#define FT_USE_MODULE( type, x ) extern const type x;
#endif
@@ -65,7 +65,7 @@
#undef FT_USE_MODULE
-#define FT_USE_MODULE( x ) (const FT_Module_Class*)&(x),
+#define FT_USE_MODULE( type, x ) (const FT_Module_Class*)&(x),
static
const FT_Module_Class* const ft_default_modules[] =
diff --git a/src/3rdparty/freetype/src/base/ftlcdfil.c b/src/3rdparty/freetype/src/base/ftlcdfil.c
index 5f1fa0bdb..80640111c 100644
--- a/src/3rdparty/freetype/src/base/ftlcdfil.c
+++ b/src/3rdparty/freetype/src/base/ftlcdfil.c
@@ -4,7 +4,7 @@
/* */
/* FreeType API for color filtering of subpixel bitmap glyphs (body). */
/* */
-/* Copyright 2006, 2008 by */
+/* Copyright 2006, 2008, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -266,7 +266,7 @@
#endif /* USE_LEGACY */
- FT_EXPORT( FT_Error )
+ FT_EXPORT_DEF( FT_Error )
FT_Library_SetLcdFilter( FT_Library library,
FT_LcdFilter filter )
{
@@ -296,13 +296,13 @@
#elif defined( FT_FORCE_LIGHT_LCD_FILTER )
- memcpy( library->lcd_weights, light_filter, 5 );
+ ft_memcpy( library->lcd_weights, light_filter, 5 );
library->lcd_filter_func = _ft_lcd_filter_fir;
library->lcd_extra = 2;
#else
- memcpy( library->lcd_weights, default_filter, 5 );
+ ft_memcpy( library->lcd_weights, default_filter, 5 );
library->lcd_filter_func = _ft_lcd_filter_fir;
library->lcd_extra = 2;
@@ -311,7 +311,7 @@
break;
case FT_LCD_FILTER_LIGHT:
- memcpy( library->lcd_weights, light_filter, 5 );
+ ft_memcpy( library->lcd_weights, light_filter, 5 );
library->lcd_filter_func = _ft_lcd_filter_fir;
library->lcd_extra = 2;
break;
@@ -335,7 +335,7 @@
#else /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
- FT_EXPORT( FT_Error )
+ FT_EXPORT_DEF( FT_Error )
FT_Library_SetLcdFilter( FT_Library library,
FT_LcdFilter filter )
{
diff --git a/src/3rdparty/freetype/src/base/ftmac.c b/src/3rdparty/freetype/src/base/ftmac.c
index 7f059076d..63f927d57 100644
--- a/src/3rdparty/freetype/src/base/ftmac.c
+++ b/src/3rdparty/freetype/src/base/ftmac.c
@@ -8,7 +8,8 @@
/* This file is for Mac OS X only; see builds/mac/ftoldmac.c for */
/* classic platforms built by MPW. */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by */
+/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, */
+/* 2009 by */
/* Just van Rossum, David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -67,7 +68,9 @@
#include <ft2build.h>
#include FT_FREETYPE_H
+#include FT_TRUETYPE_TAGS_H
#include FT_INTERNAL_STREAM_H
+#include "ftbase.h"
/* This is for Mac OS X. Without redefinition, OS_INLINE */
/* expands to `static inline' which doesn't survive the */
@@ -77,26 +80,32 @@
#define OS_INLINE static __inline__
#endif
- /* The ResourceIndex type was only added in the 10.5 SDK */
-#ifndef MAC_OS_X_VERSION_10_5
-typedef short ResourceIndex;
+ /* `configure' checks the availability of `ResourceIndex' strictly */
+ /* and sets HAVE_TYPE_RESOURCE_INDEX 1 or 0 always. If it is */
+ /* not set (e.g., a build without `configure'), the availability */
+ /* is guessed from the SDK version. */
+#ifndef HAVE_TYPE_RESOURCE_INDEX
+#if !defined( MAC_OS_X_VERSION_10_5 ) || \
+ ( MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5 )
+#define HAVE_TYPE_RESOURCE_INDEX 0
+#else
+#define HAVE_TYPE_RESOURCE_INDEX 1
+#endif
+#endif /* !HAVE_TYPE_RESOURCE_INDEX */
+
+#if ( HAVE_TYPE_RESOURCE_INDEX == 0 )
+ typedef short ResourceIndex;
#endif
#include <CoreServices/CoreServices.h>
#include <ApplicationServices/ApplicationServices.h>
#include <sys/syslimits.h> /* PATH_MAX */
+ /* Don't want warnings about our own use of deprecated functions. */
#define FT_DEPRECATED_ATTRIBUTE
#include FT_MAC_H
- /* undefine blocking-macros in ftmac.h */
-#undef FT_GetFile_From_Mac_Name( a, b, c )
-#undef FT_GetFile_From_Mac_ATS_Name( a, b, c )
-#undef FT_New_Face_From_FOND( a, b, c, d )
-#undef FT_New_Face_From_FSSpec( a, b, c, d )
-#undef FT_New_Face_From_FSRef( a, b, c, d )
-
#ifndef kATSOptionFlagsUnRestrictedScope /* since Mac OS X 10.1 */
#define kATSOptionFlagsUnRestrictedScope kATSOptionFlagsDefault
#endif
@@ -134,7 +143,7 @@ typedef short ResourceIndex;
FSRef* ats_font_ref )
{
#if defined( MAC_OS_X_VERSION_10_5 ) && \
- MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
+ ( MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 )
OSStatus err;
@@ -235,7 +244,7 @@ typedef short ResourceIndex;
FT_Long* face_index )
{
#if ( __LP64__ ) || ( defined( MAC_OS_X_VERSION_10_5 ) && \
- MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 )
+ ( MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 ) )
FT_UNUSED( fontName );
FT_UNUSED( pathSpec );
FT_UNUSED( face_index );
@@ -589,8 +598,7 @@ typedef short ResourceIndex;
for (;;)
{
- post_data = Get1Resource( FT_MAKE_TAG( 'P', 'O', 'S', 'T' ),
- res_id++ );
+ post_data = Get1Resource( TTAG_POST, res_id++ );
if ( post_data == NULL )
break; /* we are done */
@@ -629,8 +637,7 @@ typedef short ResourceIndex;
for (;;)
{
- post_data = Get1Resource( FT_MAKE_TAG( 'P', 'O', 'S', 'T' ),
- res_id++ );
+ post_data = Get1Resource( TTAG_POST, res_id++ );
if ( post_data == NULL )
break; /* we are done */
@@ -682,110 +689,7 @@ typedef short ResourceIndex;
}
- /* Finalizer for a memory stream; gets called by FT_Done_Face().
- It frees the memory it uses. */
- static void
- memory_stream_close( FT_Stream stream )
- {
- FT_Memory memory = stream->memory;
-
-
- FT_FREE( stream->base );
-
- stream->size = 0;
- stream->base = 0;
- stream->close = 0;
- }
-
-
- /* Create a new memory stream from a buffer and a size. */
- static FT_Error
- new_memory_stream( FT_Library library,
- FT_Byte* base,
- FT_ULong size,
- FT_Stream_CloseFunc close,
- FT_Stream* astream )
- {
- FT_Error error;
- FT_Memory memory;
- FT_Stream stream;
-
-
- if ( !library )
- return FT_Err_Invalid_Library_Handle;
-
- if ( !base )
- return FT_Err_Invalid_Argument;
-
- *astream = 0;
- memory = library->memory;
- if ( FT_NEW( stream ) )
- goto Exit;
-
- FT_Stream_OpenMemory( stream, base, size );
-
- stream->close = close;
-
- *astream = stream;
-
- Exit:
- return error;
- }
-
-
- /* Create a new FT_Face given a buffer and a driver name. */
- static FT_Error
- open_face_from_buffer( FT_Library library,
- FT_Byte* base,
- FT_ULong size,
- FT_Long face_index,
- const char* driver_name,
- FT_Face* aface )
- {
- FT_Open_Args args;
- FT_Error error;
- FT_Stream stream;
- FT_Memory memory = library->memory;
-
-
- error = new_memory_stream( library,
- base,
- size,
- memory_stream_close,
- &stream );
- if ( error )
- {
- FT_FREE( base );
- return error;
- }
-
- args.flags = FT_OPEN_STREAM;
- args.stream = stream;
- if ( driver_name )
- {
- args.flags = args.flags | FT_OPEN_DRIVER;
- args.driver = FT_Get_Module( library, driver_name );
- }
-
- /* At this point, face_index has served its purpose; */
- /* whoever calls this function has already used it to */
- /* locate the correct font data. We should not propagate */
- /* this index to FT_Open_Face() (unless it is negative). */
-
- if ( face_index > 0 )
- face_index = 0;
-
- error = FT_Open_Face( library, &args, face_index, aface );
- if ( error == FT_Err_Ok )
- (*aface)->face_flags &= ~FT_FACE_FLAG_EXTERNAL_STREAM;
- else
- FT_Stream_Free( stream, 0 );
-
- return error;
- }
-
-
- /* Create a new FT_Face from a file spec to an LWFN file. */
+ /* Create a new FT_Face from a file path to an LWFN file. */
static FT_Error
FT_New_Face_From_LWFN( FT_Library library,
const UInt8* pathname,
@@ -829,10 +733,10 @@ typedef short ResourceIndex;
size_t sfnt_size;
FT_Error error = FT_Err_Ok;
FT_Memory memory = library->memory;
- int is_cff;
+ int is_cff, is_sfnt_ps;
- sfnt = GetResource( FT_MAKE_TAG( 's', 'f', 'n', 't' ), sfnt_id );
+ sfnt = GetResource( TTAG_sfnt, sfnt_id );
if ( sfnt == NULL )
return FT_Err_Invalid_Handle;
@@ -846,21 +750,45 @@ typedef short ResourceIndex;
ft_memcpy( sfnt_data, *sfnt, sfnt_size );
ReleaseResource( sfnt );
- is_cff = sfnt_size > 4 && sfnt_data[0] == 'O' &&
- sfnt_data[1] == 'T' &&
- sfnt_data[2] == 'T' &&
- sfnt_data[3] == 'O';
+ is_cff = sfnt_size > 4 && !ft_memcmp( sfnt_data, "OTTO", 4 );
+ is_sfnt_ps = sfnt_size > 4 && !ft_memcmp( sfnt_data, "typ1", 4 );
- return open_face_from_buffer( library,
- sfnt_data,
- sfnt_size,
- face_index,
- is_cff ? "cff" : "truetype",
- aface );
+ if ( is_sfnt_ps )
+ {
+ FT_Stream stream;
+
+
+ if ( FT_NEW( stream ) )
+ goto Try_OpenType;
+
+ FT_Stream_OpenMemory( stream, sfnt_data, sfnt_size );
+ if ( !open_face_PS_from_sfnt_stream( library,
+ stream,
+ face_index,
+ 0, NULL,
+ aface ) )
+ {
+ FT_Stream_Close( stream );
+ FT_FREE( stream );
+ FT_FREE( sfnt_data );
+ goto Exit;
+ }
+
+ FT_FREE( stream );
+ }
+ Try_OpenType:
+ error = open_face_from_buffer( library,
+ sfnt_data,
+ sfnt_size,
+ face_index,
+ is_cff ? "cff" : "truetype",
+ aface );
+ Exit:
+ return error;
}
- /* Create a new FT_Face from a file spec to a suitcase file. */
+ /* Create a new FT_Face from a file path to a suitcase file. */
static FT_Error
FT_New_Face_From_Suitcase( FT_Library library,
const UInt8* pathname,
@@ -884,8 +812,7 @@ typedef short ResourceIndex;
num_faces_in_res = 0;
for ( res_index = 1; ; ++res_index )
{
- fond = Get1IndResource( FT_MAKE_TAG( 'F', 'O', 'N', 'D' ),
- res_index );
+ fond = Get1IndResource( TTAG_FOND, res_index );
if ( ResError() )
break;
@@ -924,7 +851,7 @@ typedef short ResourceIndex;
GetResInfo( fond, &fond_id, &fond_type, fond_name );
- if ( ResError() != noErr || fond_type != FT_MAKE_TAG( 'F', 'O', 'N', 'D' ) )
+ if ( ResError() != noErr || fond_type != TTAG_FOND )
return FT_Err_Invalid_File_Format;
parse_fond( *fond, &have_sfnt, &sfnt_id, lwfn_file_name, face_index );
@@ -991,7 +918,7 @@ typedef short ResourceIndex;
/* LWFN is a (very) specific file format, check for it explicitly */
file_type = get_file_type_from_path( pathname );
- if ( file_type == FT_MAKE_TAG( 'L', 'W', 'F', 'N' ) )
+ if ( file_type == TTAG_LWFN )
return FT_New_Face_From_LWFN( library, pathname, face_index, aface );
/* Otherwise the file type doesn't matter (there are more than */
@@ -1108,7 +1035,7 @@ typedef short ResourceIndex;
FT_Face* aface )
{
#if ( __LP64__ ) || ( defined( MAC_OS_X_VERSION_10_5 ) && \
- MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 )
+ ( MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 ) )
FT_UNUSED( library );
FT_UNUSED( spec );
FT_UNUSED( face_index );
diff --git a/src/3rdparty/freetype/src/base/ftmm.c b/src/3rdparty/freetype/src/base/ftmm.c
index 586d5e84d..030772981 100644
--- a/src/3rdparty/freetype/src/base/ftmm.c
+++ b/src/3rdparty/freetype/src/base/ftmm.c
@@ -4,7 +4,7 @@
/* */
/* Multiple Master font support (body). */
/* */
-/* Copyright 1996-2001, 2003, 2004 by */
+/* Copyright 1996-2001, 2003, 2004, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -52,7 +52,7 @@
*aservice,
MULTI_MASTERS );
- if ( aservice )
+ if ( *aservice )
error = FT_Err_Ok;
}
diff --git a/src/3rdparty/freetype/src/base/ftobjs.c b/src/3rdparty/freetype/src/base/ftobjs.c
index 8208e2a45..72dea335b 100644
--- a/src/3rdparty/freetype/src/base/ftobjs.c
+++ b/src/3rdparty/freetype/src/base/ftobjs.c
@@ -4,7 +4,7 @@
/* */
/* The FreeType private base classes (body). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by */
+/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -26,6 +26,7 @@
#include FT_INTERNAL_STREAM_H
#include FT_INTERNAL_SFNT_H /* for SFNT_Load_Table_Func */
#include FT_TRUETYPE_TABLES_H
+#include FT_TRUETYPE_TAGS_H
#include FT_TRUETYPE_IDS_H
#include FT_OUTLINE_H
@@ -36,8 +37,11 @@
#include FT_SERVICE_KERNING_H
#include FT_SERVICE_TRUETYPE_ENGINE_H
+#include "ftbase.h"
+
#define GRID_FIT_METRICS
+
FT_BASE_DEF( FT_Pointer )
ft_service_list_lookup( FT_ServiceDesc service_descriptors,
const char* service_id )
@@ -128,13 +132,14 @@
FT_Stream stream;
+ *astream = 0;
+
if ( !library )
return FT_Err_Invalid_Library_Handle;
if ( !args )
return FT_Err_Invalid_Argument;
- *astream = 0;
memory = library->memory;
if ( FT_NEW( stream ) )
@@ -196,6 +201,12 @@
}
+ /*************************************************************************/
+ /* */
+ /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
+ /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
+ /* messages during execution. */
+ /* */
#undef FT_COMPONENT
#define FT_COMPONENT trace_objs
@@ -244,7 +255,7 @@
FT_BASE_DEF( void )
ft_glyphslot_free_bitmap( FT_GlyphSlot slot )
{
- if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP )
+ if ( slot->internal && ( slot->internal->flags & FT_GLYPH_OWN_BITMAP ) )
{
FT_Memory memory = FT_FACE_MEMORY( slot->face );
@@ -542,7 +553,7 @@
FT_Driver driver;
FT_GlyphSlot slot;
FT_Library library;
- FT_Bool autohint = 0;
+ FT_Bool autohint = FALSE;
FT_Module hinter;
@@ -586,22 +597,22 @@
*
* - Otherwise, auto-hint for LIGHT hinting mode.
*
- * - Exception: The font requires the unpatented
- * bytecode interpreter to load properly.
+ * - Exception: The font is `tricky' and requires
+ * the native hinter to load properly.
*/
- autohint = 0;
- if ( hinter &&
- ( load_flags & FT_LOAD_NO_HINTING ) == 0 &&
- ( load_flags & FT_LOAD_NO_AUTOHINT ) == 0 &&
- FT_DRIVER_IS_SCALABLE( driver ) &&
- FT_DRIVER_USES_OUTLINES( driver ) &&
- face->internal->transform_matrix.yy > 0 &&
- face->internal->transform_matrix.yx == 0 )
+ if ( hinter &&
+ !( load_flags & FT_LOAD_NO_HINTING ) &&
+ !( load_flags & FT_LOAD_NO_AUTOHINT ) &&
+ FT_DRIVER_IS_SCALABLE( driver ) &&
+ FT_DRIVER_USES_OUTLINES( driver ) &&
+ !FT_IS_TRICKY( face ) &&
+ face->internal->transform_matrix.yy > 0 &&
+ face->internal->transform_matrix.yx == 0 )
{
- if ( ( load_flags & FT_LOAD_FORCE_AUTOHINT ) != 0 ||
- !FT_DRIVER_HAS_HINTER( driver ) )
- autohint = 1;
+ if ( ( load_flags & FT_LOAD_FORCE_AUTOHINT ) ||
+ !FT_DRIVER_HAS_HINTER( driver ) )
+ autohint = TRUE;
else
{
FT_Render_Mode mode = FT_LOAD_TARGET_MODE( load_flags );
@@ -609,7 +620,7 @@
if ( mode == FT_RENDER_MODE_LIGHT ||
face->internal->ignore_unpatented_hinter )
- autohint = 1;
+ autohint = TRUE;
}
}
@@ -692,7 +703,7 @@
/* compute the linear advance in 16.16 pixels */
if ( ( load_flags & FT_LOAD_LINEAR_DESIGN ) == 0 &&
- ( face->face_flags & FT_FACE_FLAG_SCALABLE ) )
+ ( FT_IS_SCALABLE( face ) ) )
{
FT_Size_Metrics* metrics = &face->size->metrics;
@@ -1110,7 +1121,7 @@
/* there's a Mac-specific extended implementation of FT_New_Face() */
/* in src/base/ftmac.c */
-#ifndef FT_MACINTOSH
+#if !defined( FT_MACINTOSH ) || defined( DARWIN_NO_CARBON )
/* documentation is in freetype.h */
@@ -1129,11 +1140,12 @@
args.flags = FT_OPEN_PATHNAME;
args.pathname = (char*)pathname;
+ args.stream = NULL;
return FT_Open_Face( library, &args, face_index, aface );
}
-#endif /* !FT_MACINTOSH */
+#endif /* defined( FT_MACINTOSH ) && !defined( DARWIN_NO_CARBON ) */
/* documentation is in freetype.h */
@@ -1155,12 +1167,13 @@
args.flags = FT_OPEN_MEMORY;
args.memory_base = file_base;
args.memory_size = file_size;
+ args.stream = NULL;
return FT_Open_Face( library, &args, face_index, aface );
}
-#if !defined( FT_MACINTOSH ) && defined( FT_CONFIG_OPTION_MAC_FONTS )
+#ifdef FT_CONFIG_OPTION_MAC_FONTS
/* The behavior here is very similar to that in base/ftmac.c, but it */
/* is designed to work on non-mac systems, so no mac specific calls. */
@@ -1189,9 +1202,9 @@
/* we don't really have access to it. */
- /* Finalizer for a memory stream; gets called by FT_Done_Face().
- It frees the memory it uses. */
- /* from ftmac.c */
+ /* Finalizer for a memory stream; gets called by FT_Done_Face(). */
+ /* It frees the memory it uses. */
+ /* From ftmac.c. */
static void
memory_stream_close( FT_Stream stream )
{
@@ -1207,7 +1220,7 @@
/* Create a new memory stream from a buffer and a size. */
- /* from ftmac.c */
+ /* From ftmac.c. */
static FT_Error
new_memory_stream( FT_Library library,
FT_Byte* base,
@@ -1244,7 +1257,7 @@
/* Create a new FT_Face given a buffer and a driver name. */
/* from ftmac.c */
- static FT_Error
+ FT_LOCAL_DEF( FT_Error )
open_face_from_buffer( FT_Library library,
FT_Byte* base,
FT_ULong size,
@@ -1277,20 +1290,172 @@
args.driver = FT_Get_Module( library, driver_name );
}
+#ifdef FT_MACINTOSH
+ /* At this point, face_index has served its purpose; */
+ /* whoever calls this function has already used it to */
+ /* locate the correct font data. We should not propagate */
+ /* this index to FT_Open_Face() (unless it is negative). */
+
+ if ( face_index > 0 )
+ face_index = 0;
+#endif
+
error = FT_Open_Face( library, &args, face_index, aface );
if ( error == FT_Err_Ok )
(*aface)->face_flags &= ~FT_FACE_FLAG_EXTERNAL_STREAM;
else
+#ifdef FT_MACINTOSH
+ FT_Stream_Free( stream, 0 );
+#else
{
FT_Stream_Close( stream );
FT_FREE( stream );
}
+#endif
return error;
}
+ /* Look up `TYP1' or `CID ' table from sfnt table directory. */
+ /* `offset' and `length' must exclude the binary header in tables. */
+
+ /* Type 1 and CID-keyed font drivers should recognize sfnt-wrapped */
+ /* format too. Here, since we can't expect that the TrueType font */
+ /* driver is loaded unconditially, we must parse the font by */
+ /* ourselves. We are only interested in the name of the table and */
+ /* the offset. */
+
+ static FT_Error
+ ft_lookup_PS_in_sfnt_stream( FT_Stream stream,
+ FT_Long face_index,
+ FT_ULong* offset,
+ FT_ULong* length,
+ FT_Bool* is_sfnt_cid )
+ {
+ FT_Error error;
+ FT_UShort numTables;
+ FT_Long pstable_index;
+ FT_ULong tag;
+ int i;
+
+
+ *offset = 0;
+ *length = 0;
+ *is_sfnt_cid = FALSE;
+
+ /* TODO: support for sfnt-wrapped PS/CID in TTC format */
+
+ /* version check for 'typ1' (should be ignored?) */
+ if ( FT_READ_ULONG( tag ) )
+ return error;
+ if ( tag != TTAG_typ1 )
+ return FT_Err_Unknown_File_Format;
+
+ if ( FT_READ_USHORT( numTables ) )
+ return error;
+ if ( FT_STREAM_SKIP( 2 * 3 ) ) /* skip binary search header */
+ return error;
+
+ pstable_index = -1;
+ *is_sfnt_cid = FALSE;
+
+ for ( i = 0; i < numTables; i++ )
+ {
+ if ( FT_READ_ULONG( tag ) || FT_STREAM_SKIP( 4 ) ||
+ FT_READ_ULONG( *offset ) || FT_READ_ULONG( *length ) )
+ return error;
+
+ if ( tag == TTAG_CID )
+ {
+ pstable_index++;
+ *offset += 22;
+ *length -= 22;
+ *is_sfnt_cid = TRUE;
+ if ( face_index < 0 )
+ return FT_Err_Ok;
+ }
+ else if ( tag == TTAG_TYP1 )
+ {
+ pstable_index++;
+ *offset += 24;
+ *length -= 24;
+ *is_sfnt_cid = FALSE;
+ if ( face_index < 0 )
+ return FT_Err_Ok;
+ }
+ if ( face_index >= 0 && pstable_index == face_index )
+ return FT_Err_Ok;
+ }
+ return FT_Err_Table_Missing;
+ }
+
+
+ FT_LOCAL_DEF( FT_Error )
+ open_face_PS_from_sfnt_stream( FT_Library library,
+ FT_Stream stream,
+ FT_Long face_index,
+ FT_Int num_params,
+ FT_Parameter *params,
+ FT_Face *aface )
+ {
+ FT_Error error;
+ FT_Memory memory = library->memory;
+ FT_ULong offset, length;
+ FT_Long pos;
+ FT_Bool is_sfnt_cid;
+ FT_Byte* sfnt_ps;
+
+ FT_UNUSED( num_params );
+ FT_UNUSED( params );
+
+
+ pos = FT_Stream_Pos( stream );
+
+ error = ft_lookup_PS_in_sfnt_stream( stream,
+ face_index,
+ &offset,
+ &length,
+ &is_sfnt_cid );
+ if ( error )
+ goto Exit;
+
+ if ( FT_Stream_Seek( stream, pos + offset ) )
+ goto Exit;
+
+ if ( FT_ALLOC( sfnt_ps, (FT_Long)length ) )
+ goto Exit;
+
+ error = FT_Stream_Read( stream, (FT_Byte *)sfnt_ps, length );
+ if ( error )
+ goto Exit;
+
+ error = open_face_from_buffer( library,
+ sfnt_ps,
+ length,
+ face_index < 0 ? face_index : 0,
+ is_sfnt_cid ? "cid" : "type1",
+ aface );
+ Exit:
+ {
+ FT_Error error1;
+
+
+ if ( error == FT_Err_Unknown_File_Format )
+ {
+ error1 = FT_Stream_Seek( stream, pos );
+ if ( error1 )
+ return error1;
+ }
+
+ return error;
+ }
+ }
+
+
+#if !defined( FT_MACINTOSH ) || defined( DARWIN_NO_CARBON )
+
/* The resource header says we've got resource_cnt `POST' (type1) */
/* resources in this file. They all need to be coalesced into */
/* one lump which gets passed on to the type1 driver. */
@@ -1445,17 +1610,25 @@
if ( rlen == -1 )
return FT_Err_Cannot_Open_Resource;
+ error = open_face_PS_from_sfnt_stream( library,
+ stream,
+ face_index,
+ 0, NULL,
+ aface );
+ if ( !error )
+ goto Exit;
+
+ /* rewind sfnt stream before open_face_PS_from_sfnt_stream() */
+ if ( FT_Stream_Seek( stream, flag_offset + 4 ) )
+ goto Exit;
+
if ( FT_ALLOC( sfnt_data, (FT_Long)rlen ) )
return error;
error = FT_Stream_Read( stream, (FT_Byte *)sfnt_data, rlen );
if ( error )
goto Exit;
- is_cff = rlen > 4 && sfnt_data[0] == 'O' &&
- sfnt_data[1] == 'T' &&
- sfnt_data[2] == 'T' &&
- sfnt_data[3] == 'O';
-
+ is_cff = rlen > 4 && !ft_memcmp( sfnt_data, "OTTO", 4 );
error = open_face_from_buffer( library,
sfnt_data,
rlen,
@@ -1494,7 +1667,7 @@
error = FT_Raccess_Get_DataOffsets( library, stream,
map_offset, rdara_pos,
- FT_MAKE_TAG( 'P', 'O', 'S', 'T' ),
+ TTAG_POST,
&data_offsets, &count );
if ( !error )
{
@@ -1509,7 +1682,7 @@
error = FT_Raccess_Get_DataOffsets( library, stream,
map_offset, rdara_pos,
- FT_MAKE_TAG( 's', 'f', 'n', 't' ),
+ TTAG_sfnt,
&data_offsets, &count );
if ( !error )
{
@@ -1600,7 +1773,7 @@
FT_Error errors[FT_RACCESS_N_RULES];
FT_Open_Args args2;
- FT_Stream stream2;
+ FT_Stream stream2 = 0;
FT_Raccess_Guess( library, stream,
@@ -1655,7 +1828,7 @@
}
- /* Check for some macintosh formats. */
+ /* Check for some macintosh formats without Carbon framework. */
/* Is this a macbinary file? If so look at the resource fork. */
/* Is this a mac dfont file? */
/* Is this an old style resource fork? (in data) */
@@ -1698,6 +1871,7 @@
face_index, aface, args );
return error;
}
+#endif
#endif /* !FT_MACINTOSH && FT_CONFIG_OPTION_MAC_FONTS */
@@ -1713,7 +1887,7 @@
FT_Error error;
FT_Driver driver;
FT_Memory memory;
- FT_Stream stream;
+ FT_Stream stream = 0;
FT_Face face = 0;
FT_ListNode node = 0;
FT_Bool external_stream;
@@ -1796,6 +1970,28 @@
if ( !error )
goto Success;
+#ifdef FT_CONFIG_OPTION_MAC_FONTS
+ if ( ft_strcmp( cur[0]->clazz->module_name, "truetype" ) == 0 &&
+ FT_ERROR_BASE( error ) == FT_Err_Table_Missing )
+ {
+ /* TrueType but essential tables are missing */
+ if ( FT_Stream_Seek( stream, 0 ) )
+ break;
+
+ error = open_face_PS_from_sfnt_stream( library,
+ stream,
+ face_index,
+ num_params,
+ params,
+ aface );
+ if ( !error )
+ {
+ FT_Stream_Free( stream, external_stream );
+ return error;
+ }
+ }
+#endif
+
if ( FT_ERROR_BASE( error ) != FT_Err_Unknown_File_Format )
goto Fail3;
}
@@ -2271,8 +2467,8 @@
}
else
{
- metrics->x_scale = 1L << 22;
- metrics->y_scale = 1L << 22;
+ metrics->x_scale = 1L << 16;
+ metrics->y_scale = 1L << 16;
metrics->ascender = bsize->y_ppem;
metrics->descender = 0;
metrics->height = bsize->height << 6;
@@ -2383,8 +2579,8 @@
else
{
FT_ZERO( metrics );
- metrics->x_scale = 1L << 22;
- metrics->y_scale = 1L << 22;
+ metrics->x_scale = 1L << 16;
+ metrics->y_scale = 1L << 16;
}
}
@@ -3265,11 +3461,11 @@
if ( size == NULL )
- return FT_Err_Bad_Argument;
+ return FT_Err_Invalid_Argument;
face = size->face;
if ( face == NULL || face->driver == NULL )
- return FT_Err_Bad_Argument;
+ return FT_Err_Invalid_Argument;
/* we don't need anything more complex than that; all size objects */
/* are already listed by the face */
@@ -4017,7 +4213,11 @@
faces = &FT_DRIVER(module)->faces_list;
while ( faces->head )
+ {
FT_Done_Face( FT_FACE( faces->head->data ) );
+ if ( faces->head )
+ FT_ERROR(( "FT_Done_Library: failed to free some faces\n" ));
+ }
}
}
diff --git a/src/3rdparty/freetype/src/base/ftotval.c b/src/3rdparty/freetype/src/base/ftotval.c
index b6de6db85..20ed686ee 100644
--- a/src/3rdparty/freetype/src/base/ftotval.c
+++ b/src/3rdparty/freetype/src/base/ftotval.c
@@ -4,7 +4,7 @@
/* */
/* FreeType API for validating OpenType tables (body). */
/* */
-/* Copyright 2004, 2006 by */
+/* Copyright 2004, 2006, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -18,6 +18,7 @@
#include <ft2build.h>
#include FT_INTERNAL_OBJECTS_H
#include FT_SERVICE_OPENTYPE_VALIDATE_H
+#include FT_OPENTYPE_VALIDATE_H
/* documentation is in ftotval.h */
diff --git a/src/3rdparty/freetype/src/base/ftoutln.c b/src/3rdparty/freetype/src/base/ftoutln.c
index 2bae8573f..49ef82e27 100644
--- a/src/3rdparty/freetype/src/base/ftoutln.c
+++ b/src/3rdparty/freetype/src/base/ftoutln.c
@@ -4,7 +4,7 @@
/* */
/* FreeType outline management (body). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by */
+/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -26,6 +26,7 @@
#include <ft2build.h>
#include FT_OUTLINE_H
#include FT_INTERNAL_OBJECTS_H
+#include FT_INTERNAL_DEBUG_H
#include FT_TRIGONOMETRY_H
@@ -83,21 +84,25 @@
FT_Int last; /* index of last point in contour */
+ FT_TRACE5(( "FT_Outline_Decompose: Outline %d\n", n ));
+
last = outline->contours[n];
if ( last < 0 )
goto Invalid_Outline;
limit = outline->points + last;
- v_start = outline->points[first];
- v_last = outline->points[last];
+ v_start = outline->points[first];
+ v_start.x = SCALED( v_start.x );
+ v_start.y = SCALED( v_start.y );
- v_start.x = SCALED( v_start.x ); v_start.y = SCALED( v_start.y );
- v_last.x = SCALED( v_last.x ); v_last.y = SCALED( v_last.y );
+ v_last = outline->points[last];
+ v_last.x = SCALED( v_last.x );
+ v_last.y = SCALED( v_last.y );
v_control = v_start;
point = outline->points + first;
- tags = outline->tags + first;
+ tags = outline->tags + first;
tag = FT_CURVE_TAG( tags[0] );
/* A contour cannot start with a cubic control point! */
@@ -128,6 +133,8 @@
tags--;
}
+ FT_TRACE5(( " move to (%.2f, %.2f)\n",
+ v_start.x / 64.0, v_start.y / 64.0 ));
error = func_interface->move_to( &v_start, user );
if ( error )
goto Exit;
@@ -148,6 +155,8 @@
vec.x = SCALED( point->x );
vec.y = SCALED( point->y );
+ FT_TRACE5(( " line to (%.2f, %.2f)\n",
+ vec.x / 64.0, vec.y / 64.0 ));
error = func_interface->line_to( &vec, user );
if ( error )
goto Exit;
@@ -174,6 +183,10 @@
if ( tag == FT_CURVE_TAG_ON )
{
+ FT_TRACE5(( " conic to (%.2f, %.2f)"
+ " with control (%.2f, %.2f)\n",
+ vec.x / 64.0, vec.y / 64.0,
+ v_control.x / 64.0, v_control.y / 64.0 ));
error = func_interface->conic_to( &v_control, &vec, user );
if ( error )
goto Exit;
@@ -186,6 +199,10 @@
v_middle.x = ( v_control.x + vec.x ) / 2;
v_middle.y = ( v_control.y + vec.y ) / 2;
+ FT_TRACE5(( " conic to (%.2f, %.2f)"
+ " with control (%.2f, %.2f)\n",
+ v_middle.x / 64.0, v_middle.y / 64.0,
+ v_control.x / 64.0, v_control.y / 64.0 ));
error = func_interface->conic_to( &v_control, &v_middle, user );
if ( error )
goto Exit;
@@ -194,6 +211,10 @@
goto Do_Conic;
}
+ FT_TRACE5(( " conic to (%.2f, %.2f)"
+ " with control (%.2f, %.2f)\n",
+ v_start.x / 64.0, v_start.y / 64.0,
+ v_control.x / 64.0, v_control.y / 64.0 ));
error = func_interface->conic_to( &v_control, &v_start, user );
goto Close;
@@ -209,8 +230,11 @@
point += 2;
tags += 2;
- vec1.x = SCALED( point[-2].x ); vec1.y = SCALED( point[-2].y );
- vec2.x = SCALED( point[-1].x ); vec2.y = SCALED( point[-1].y );
+ vec1.x = SCALED( point[-2].x );
+ vec1.y = SCALED( point[-2].y );
+
+ vec2.x = SCALED( point[-1].x );
+ vec2.y = SCALED( point[-1].y );
if ( point <= limit )
{
@@ -220,12 +244,22 @@
vec.x = SCALED( point->x );
vec.y = SCALED( point->y );
+ FT_TRACE5(( " cubic to (%.2f, %.2f)"
+ " with controls (%.2f, %.2f) and (%.2f, %.2f)\n",
+ vec.x / 64.0, vec.y / 64.0,
+ vec1.x / 64.0, vec1.y / 64.0,
+ vec2.x / 64.0, vec2.y / 64.0 ));
error = func_interface->cubic_to( &vec1, &vec2, &vec, user );
if ( error )
goto Exit;
continue;
}
+ FT_TRACE5(( " cubic to (%.2f, %.2f)"
+ " with controls (%.2f, %.2f) and (%.2f, %.2f)\n",
+ v_start.x / 64.0, v_start.y / 64.0,
+ vec1.x / 64.0, vec1.y / 64.0,
+ vec2.x / 64.0, vec2.y / 64.0 ));
error = func_interface->cubic_to( &vec1, &vec2, &v_start, user );
goto Close;
}
@@ -233,6 +267,8 @@
}
/* close the contour with a line segment */
+ FT_TRACE5(( " line to (%.2f, %.2f)\n",
+ v_start.x / 64.0, v_start.y / 64.0 ));
error = func_interface->line_to( &v_start, user );
Close:
@@ -242,9 +278,11 @@
first = last + 1;
}
- return 0;
+ FT_TRACE5(( "FT_Outline_Decompose: Done\n", n ));
+ return FT_Err_Ok;
Exit:
+ FT_TRACE5(( "FT_Outline_Decompose: Error %d\n", error ));
return error;
Invalid_Outline:
@@ -558,7 +596,7 @@
FT_Raster_Params* params )
{
FT_Error error;
- FT_Bool update = 0;
+ FT_Bool update = FALSE;
FT_Renderer renderer;
FT_ListNode node;
@@ -589,7 +627,7 @@
/* format */
renderer = FT_Lookup_Renderer( library, FT_GLYPH_FORMAT_OUTLINE,
&node );
- update = 1;
+ update = TRUE;
}
/* if we changed the current renderer for the glyph image format */
@@ -1007,7 +1045,7 @@
}
}
- if ( xmin == 32768 )
+ if ( xmin == 32768L )
return FT_ORIENTATION_TRUETYPE;
ray_y[0] = ( xmin_ymin * 3 + xmin_ymax ) >> 2;
diff --git a/src/3rdparty/freetype/src/base/ftpatent.c b/src/3rdparty/freetype/src/base/ftpatent.c
index d63f191c3..9f129d8f0 100644
--- a/src/3rdparty/freetype/src/base/ftpatent.c
+++ b/src/3rdparty/freetype/src/base/ftpatent.c
@@ -5,7 +5,7 @@
/* FreeType API for checking patented TrueType bytecode instructions */
/* (body). */
/* */
-/* Copyright 2007 by David Turner. */
+/* Copyright 2007, 2008 by David Turner. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
@@ -260,7 +260,7 @@
FT_Face_SetUnpatentedHinting( FT_Face face,
FT_Bool value )
{
- FT_Bool result = 0;
+ FT_Bool result = FALSE;
#if defined( TT_CONFIG_OPTION_UNPATENTED_HINTING ) && \
diff --git a/src/3rdparty/freetype/src/base/ftpfr.c b/src/3rdparty/freetype/src/base/ftpfr.c
index 9e930ddf7..f9592bb1b 100644
--- a/src/3rdparty/freetype/src/base/ftpfr.c
+++ b/src/3rdparty/freetype/src/base/ftpfr.c
@@ -4,7 +4,7 @@
/* */
/* FreeType API for accessing PFR-specific data (body). */
/* */
-/* Copyright 2002, 2003, 2004 by */
+/* Copyright 2002, 2003, 2004, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -46,6 +46,9 @@
FT_Service_PfrMetrics service;
+ if ( !face )
+ return FT_Err_Invalid_Argument;
+
service = ft_pfr_check( face );
if ( service )
{
@@ -55,14 +58,17 @@
ametrics_x_scale,
ametrics_y_scale );
}
- else if ( face )
+ else
{
FT_Fixed x_scale, y_scale;
/* this is not a PFR font */
- *aoutline_resolution = face->units_per_EM;
- *ametrics_resolution = face->units_per_EM;
+ if ( aoutline_resolution )
+ *aoutline_resolution = face->units_per_EM;
+
+ if ( ametrics_resolution )
+ *ametrics_resolution = face->units_per_EM;
x_scale = y_scale = 0x10000L;
if ( face->size )
@@ -70,11 +76,15 @@
x_scale = face->size->metrics.x_scale;
y_scale = face->size->metrics.y_scale;
}
- *ametrics_x_scale = x_scale;
- *ametrics_y_scale = y_scale;
+
+ if ( ametrics_x_scale )
+ *ametrics_x_scale = x_scale;
+
+ if ( ametrics_y_scale )
+ *ametrics_y_scale = y_scale;
+
+ error = FT_Err_Unknown_File_Format;
}
- else
- error = FT_Err_Invalid_Argument;
return error;
}
@@ -92,14 +102,15 @@
FT_Service_PfrMetrics service;
+ if ( !face )
+ return FT_Err_Invalid_Argument;
+
service = ft_pfr_check( face );
if ( service )
error = service->get_kerning( face, left, right, avector );
- else if ( face )
+ else
error = FT_Get_Kerning( face, left, right,
FT_KERNING_UNSCALED, avector );
- else
- error = FT_Err_Invalid_Argument;
return error;
}
diff --git a/src/3rdparty/freetype/src/base/ftrfork.c b/src/3rdparty/freetype/src/base/ftrfork.c
index 5a835ee63..d59a07611 100644
--- a/src/3rdparty/freetype/src/base/ftrfork.c
+++ b/src/3rdparty/freetype/src/base/ftrfork.c
@@ -4,7 +4,7 @@
/* */
/* Embedded resource forks accessor (body). */
/* */
-/* Copyright 2004, 2005, 2006, 2007 by */
+/* Copyright 2004, 2005, 2006, 2007, 2008, 2009 by */
/* Masatake YAMATO and Redhat K.K. */
/* */
/* FT_Raccess_Get_HeaderInfo() and raccess_guess_darwin_hfsplus() are */
@@ -399,7 +399,10 @@
char **result_file_name,
FT_Long *result_offset )
{
- FT_Int32 magic = ( 0x00 << 24 | 0x05 << 16 | 0x16 << 8 | 0x07 );
+ FT_Int32 magic = ( 0x00 << 24 ) |
+ ( 0x05 << 16 ) |
+ ( 0x16 << 8 ) |
+ 0x07;
*result_file_name = NULL;
@@ -418,7 +421,10 @@
char **result_file_name,
FT_Long *result_offset )
{
- FT_Int32 magic = (0x00 << 24 | 0x05 << 16 | 0x16 << 8 | 0x00);
+ FT_Int32 magic = ( 0x00 << 24 ) |
+ ( 0x05 << 16 ) |
+ ( 0x16 << 8 ) |
+ 0x00;
*result_file_name = NULL;
@@ -703,8 +709,12 @@
return FT_Err_Ok;
}
else
- FT_Stream_Skip( stream, 4 + 4 ); /* offset + length */
+ {
+ error = FT_Stream_Skip( stream, 4 + 4 ); /* offset + length */
+ if ( error )
+ return error;
}
+ }
return FT_Err_Unknown_File_Format;
}
diff --git a/src/3rdparty/freetype/src/base/ftstream.c b/src/3rdparty/freetype/src/base/ftstream.c
index 569e46c79..cff67e0e9 100644
--- a/src/3rdparty/freetype/src/base/ftstream.c
+++ b/src/3rdparty/freetype/src/base/ftstream.c
@@ -707,12 +707,13 @@
{
FT_Error error;
FT_Bool frame_accessed = 0;
- FT_Byte* cursor = stream->cursor;
-
+ FT_Byte* cursor;
if ( !fields || !stream )
return FT_Err_Invalid_Argument;
+ cursor = stream->cursor;
+
error = FT_Err_Ok;
do
{
diff --git a/src/3rdparty/freetype/src/base/ftstroke.c b/src/3rdparty/freetype/src/base/ftstroke.c
index 5dfee8ba3..3f5421fa5 100644
--- a/src/3rdparty/freetype/src/base/ftstroke.c
+++ b/src/3rdparty/freetype/src/base/ftstroke.c
@@ -4,7 +4,7 @@
/* */
/* FreeType path stroker (body). */
/* */
-/* Copyright 2002, 2003, 2004, 2005, 2006, 2008 by */
+/* Copyright 2002, 2003, 2004, 2005, 2006, 2008, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -261,7 +261,7 @@
{
FT_UInt old_max = border->max_points;
FT_UInt new_max = border->num_points + new_points;
- FT_Error error = 0;
+ FT_Error error = FT_Err_Ok;
if ( new_max > old_max )
@@ -279,6 +279,7 @@
border->max_points = cur_max;
}
+
Exit:
return error;
}
@@ -346,7 +347,7 @@
}
border->start = -1;
- border->movable = 0;
+ border->movable = FALSE;
}
@@ -355,7 +356,7 @@
FT_Vector* to,
FT_Bool movable )
{
- FT_Error error = 0;
+ FT_Error error = FT_Err_Ok;
FT_ASSERT( border->start >= 0 );
@@ -410,7 +411,7 @@
border->num_points += 2;
}
- border->movable = 0;
+ border->movable = FALSE;
return error;
}
@@ -443,7 +444,7 @@
border->num_points += 3;
}
- border->movable = 0;
+ border->movable = FALSE;
return error;
}
@@ -461,7 +462,7 @@
FT_Angle total, angle, step, rotate, next, theta;
FT_Vector a, b, a2, b2;
FT_Fixed length;
- FT_Error error = 0;
+ FT_Error error = FT_Err_Ok;
/* compute start point */
@@ -527,12 +528,12 @@
{
/* close current open path if any ? */
if ( border->start >= 0 )
- ft_stroke_border_close( border, 0 );
+ ft_stroke_border_close( border, FALSE );
border->start = border->num_points;
- border->movable = 0;
+ border->movable = FALSE;
- return ft_stroke_border_lineto( border, to, 0 );
+ return ft_stroke_border_lineto( border, to, FALSE );
}
@@ -547,7 +548,7 @@
border->num_points = 0;
border->max_points = 0;
border->start = -1;
- border->valid = 0;
+ border->valid = FALSE;
}
@@ -556,7 +557,7 @@
{
border->num_points = 0;
border->start = -1;
- border->valid = 0;
+ border->valid = FALSE;
}
@@ -572,7 +573,7 @@
border->num_points = 0;
border->max_points = 0;
border->start = -1;
- border->valid = 0;
+ border->valid = FALSE;
}
@@ -581,7 +582,7 @@
FT_UInt *anum_points,
FT_UInt *anum_contours )
{
- FT_Error error = 0;
+ FT_Error error = FT_Err_Ok;
FT_UInt num_points = 0;
FT_UInt num_contours = 0;
@@ -605,9 +606,6 @@
if ( tags[0] & FT_STROKE_TAG_END )
{
- if ( in_contour == 0 )
- goto Fail;
-
in_contour = 0;
num_contours++;
}
@@ -616,7 +614,7 @@
if ( in_contour != 0 )
goto Fail;
- border->valid = 1;
+ border->valid = TRUE;
Exit:
*anum_points = num_points;
@@ -798,7 +796,7 @@
{
FT_Angle total, rotate;
FT_Fixed radius = stroker->radius;
- FT_Error error = 0;
+ FT_Error error = FT_Err_Ok;
FT_StrokeBorder border = stroker->borders + side;
@@ -813,7 +811,7 @@
radius,
stroker->angle_in + rotate,
total );
- border->movable = 0;
+ border->movable = FALSE;
return error;
}
@@ -824,7 +822,7 @@
FT_Angle angle,
FT_Int side )
{
- FT_Error error = 0;
+ FT_Error error = FT_Err_Ok;
if ( stroker->line_cap == FT_STROKER_LINECAP_ROUND )
@@ -849,7 +847,7 @@
delta.x += stroker->center.x + delta2.x;
delta.y += stroker->center.y + delta2.y;
- error = ft_stroke_border_lineto( border, &delta, 0 );
+ error = ft_stroke_border_lineto( border, &delta, FALSE );
if ( error )
goto Exit;
@@ -859,7 +857,7 @@
delta.x += delta2.x + stroker->center.x;
delta.y += delta2.y + stroker->center.y;
- error = ft_stroke_border_lineto( border, &delta, 0 );
+ error = ft_stroke_border_lineto( border, &delta, FALSE );
}
Exit:
@@ -876,7 +874,7 @@
FT_Angle phi, theta, rotate;
FT_Fixed length, thcos, sigma;
FT_Vector delta;
- FT_Error error = 0;
+ FT_Error error = FT_Err_Ok;
rotate = FT_SIDE_TO_ROTATE( side );
@@ -900,7 +898,7 @@
stroker->angle_out + rotate );
delta.x += stroker->center.x;
delta.y += stroker->center.y;
- border->movable = 0;
+ border->movable = FALSE;
}
else
{
@@ -911,7 +909,7 @@
delta.y += stroker->center.y;
}
- error = ft_stroke_border_lineto( border, &delta, 0 );
+ error = ft_stroke_border_lineto( border, &delta, FALSE );
return error;
}
@@ -928,9 +926,7 @@
if ( stroker->line_join == FT_STROKER_LINEJOIN_ROUND )
- {
error = ft_stroker_arcto( stroker, side );
- }
else
{
/* this is a mitered or beveled corner */
@@ -943,7 +939,7 @@
rotate = FT_SIDE_TO_ROTATE( side );
miter = FT_BOOL( stroker->line_join == FT_STROKER_LINEJOIN_MITER );
- theta = FT_Angle_Diff( stroker->angle_in, stroker->angle_out );
+ theta = FT_Angle_Diff( stroker->angle_in, stroker->angle_out );
if ( theta == FT_ANGLE_PI )
{
theta = rotate;
@@ -959,7 +955,7 @@
sigma = FT_MulFix( stroker->miter_limit, thcos );
if ( sigma >= 0x10000L )
- miter = 0;
+ miter = FALSE;
if ( miter ) /* this is a miter (broken angle) */
{
@@ -983,7 +979,7 @@
delta.x += middle.x;
delta.y += middle.y;
- error = ft_stroke_border_lineto( border, &delta, 0 );
+ error = ft_stroke_border_lineto( border, &delta, FALSE );
if ( error )
goto Exit;
@@ -992,7 +988,7 @@
delta.x += middle.x;
delta.y += middle.y;
- error = ft_stroke_border_lineto( border, &delta, 0 );
+ error = ft_stroke_border_lineto( border, &delta, FALSE );
if ( error )
goto Exit;
@@ -1001,7 +997,7 @@
delta.x += stroker->center.x;
delta.y += stroker->center.y;
- error = ft_stroke_border_lineto( border, &delta, 1 );
+ error = ft_stroke_border_lineto( border, &delta, TRUE );
}
else /* this is a bevel (intersection) */
@@ -1016,8 +1012,9 @@
delta.x += stroker->center.x;
delta.y += stroker->center.y;
- error = ft_stroke_border_lineto( border, &delta, 0 );
- if (error) goto Exit;
+ error = ft_stroke_border_lineto( border, &delta, FALSE );
+ if ( error )
+ goto Exit;
/* now add end point */
FT_Vector_From_Polar( &delta, stroker->radius,
@@ -1025,7 +1022,7 @@
delta.x += stroker->center.x;
delta.y += stroker->center.y;
- error = ft_stroke_border_lineto( border, &delta, 1 );
+ error = ft_stroke_border_lineto( border, &delta, TRUE );
}
}
@@ -1037,7 +1034,7 @@
static FT_Error
ft_stroker_process_corner( FT_Stroker stroker )
{
- FT_Error error = 0;
+ FT_Error error = FT_Err_Ok;
FT_Angle turn;
FT_Int inside_side;
@@ -1069,7 +1066,7 @@
/* add two points to the left and right borders corresponding to the */
- /* start of the subpath.. */
+ /* start of the subpath */
static FT_Error
ft_stroker_subpath_start( FT_Stroker stroker,
FT_Angle start_angle )
@@ -1099,7 +1096,7 @@
/* save angle for last cap */
stroker->subpath_angle = start_angle;
- stroker->first_point = 0;
+ stroker->first_point = FALSE;
Exit:
return error;
@@ -1112,7 +1109,7 @@
FT_Stroker_LineTo( FT_Stroker stroker,
FT_Vector* to )
{
- FT_Error error = 0;
+ FT_Error error = FT_Err_Ok;
FT_StrokeBorder border;
FT_Vector delta;
FT_Angle angle;
@@ -1143,7 +1140,7 @@
goto Exit;
}
- /* now add a line segment to both the "inside" and "outside" paths */
+ /* now add a line segment to both the `inside' and `outside' paths */
for ( border = stroker->borders, side = 1; side >= 0; side--, border++ )
{
@@ -1153,7 +1150,7 @@
point.x = to->x + delta.x;
point.y = to->y + delta.y;
- error = ft_stroke_border_lineto( border, &point, 1 );
+ error = ft_stroke_border_lineto( border, &point, TRUE );
if ( error )
goto Exit;
@@ -1176,12 +1173,12 @@
FT_Vector* control,
FT_Vector* to )
{
- FT_Error error = 0;
+ FT_Error error = FT_Err_Ok;
FT_Vector bez_stack[34];
FT_Vector* arc;
FT_Vector* limit = bez_stack + 30;
FT_Angle start_angle;
- FT_Bool first_arc = 1;
+ FT_Bool first_arc = TRUE;
arc = bez_stack;
@@ -1206,7 +1203,7 @@
if ( first_arc )
{
- first_arc = 0;
+ first_arc = FALSE;
start_angle = angle_in;
@@ -1275,12 +1272,12 @@
FT_Vector* control2,
FT_Vector* to )
{
- FT_Error error = 0;
+ FT_Error error = FT_Err_Ok;
FT_Vector bez_stack[37];
FT_Vector* arc;
FT_Vector* limit = bez_stack + 32;
FT_Angle start_angle;
- FT_Bool first_arc = 1;
+ FT_Bool first_arc = TRUE;
arc = bez_stack;
@@ -1308,7 +1305,7 @@
if ( first_arc )
{
- first_arc = 0;
+ first_arc = FALSE;
/* process corner if necessary */
start_angle = angle_in;
@@ -1386,15 +1383,16 @@
{
/* We cannot process the first point, because there is not enough */
/* information regarding its corner/cap. The latter will be processed */
- /* in the "end_subpath" routine. */
+ /* in the `FT_Stroker_EndSubPath' routine. */
/* */
- stroker->first_point = 1;
- stroker->center = *to;
- stroker->subpath_open = open;
+ stroker->first_point = TRUE;
+ stroker->center = *to;
+ stroker->subpath_open = open;
- /* record the subpath start point index for each border */
+ /* record the subpath start point for each border */
stroker->subpath_start = *to;
- return 0;
+
+ return FT_Err_Ok;
}
@@ -1402,10 +1400,10 @@
ft_stroker_add_reverse_left( FT_Stroker stroker,
FT_Bool open )
{
- FT_StrokeBorder right = stroker->borders + 0;
- FT_StrokeBorder left = stroker->borders + 1;
+ FT_StrokeBorder right = stroker->borders + 0;
+ FT_StrokeBorder left = stroker->borders + 1;
FT_Int new_points;
- FT_Error error = 0;
+ FT_Error error = FT_Err_Ok;
FT_ASSERT( left->start >= 0 );
@@ -1452,8 +1450,8 @@
left->num_points = left->start;
right->num_points += new_points;
- right->movable = 0;
- left->movable = 0;
+ right->movable = FALSE;
+ left->movable = FALSE;
}
Exit:
@@ -1467,7 +1465,8 @@
FT_EXPORT_DEF( FT_Error )
FT_Stroker_EndSubPath( FT_Stroker stroker )
{
- FT_Error error = 0;
+ FT_Error error = FT_Err_Ok;
+
if ( stroker->subpath_open )
{
@@ -1480,8 +1479,8 @@
if ( error )
goto Exit;
- /* add reversed points from "left" to "right" */
- error = ft_stroker_add_reverse_left( stroker, 1 );
+ /* add reversed points from `left' to `right' */
+ error = ft_stroker_add_reverse_left( stroker, TRUE );
if ( error )
goto Exit;
@@ -1494,7 +1493,7 @@
/* Now end the right subpath accordingly. The left one is */
/* rewind and doesn't need further processing. */
- ft_stroke_border_close( right, 0 );
+ ft_stroke_border_close( right, FALSE );
}
else
{
@@ -1536,8 +1535,8 @@
}
/* then end our two subpaths */
- ft_stroke_border_close( stroker->borders + 0, 1 );
- ft_stroke_border_close( stroker->borders + 1, 0 );
+ ft_stroke_border_close( stroker->borders + 0, TRUE );
+ ft_stroke_border_close( stroker->borders + 1, FALSE );
}
Exit:
@@ -1692,7 +1691,7 @@
v_control = v_start;
point = outline->points + first;
- tags = outline->tags + first;
+ tags = outline->tags + first;
tag = FT_CURVE_TAG( tags[0] );
/* A contour cannot start with a cubic control point! */
@@ -1836,7 +1835,7 @@
first = last + 1;
}
- return 0;
+ return FT_Err_Ok;
Exit:
return error;
@@ -1884,7 +1883,7 @@
FT_UInt num_points, num_contours;
- error = FT_Stroker_ParseOutline( stroker, outline, 0 );
+ error = FT_Stroker_ParseOutline( stroker, outline, FALSE );
if ( error )
goto Fail;
@@ -1967,7 +1966,7 @@
border = FT_STROKER_BORDER_LEFT;
}
- error = FT_Stroker_ParseOutline( stroker, outline, 0 );
+ error = FT_Stroker_ParseOutline( stroker, outline, FALSE );
if ( error )
goto Fail;
diff --git a/src/3rdparty/freetype/src/base/ftsynth.c b/src/3rdparty/freetype/src/base/ftsynth.c
index ff88ce96c..443d27260 100644
--- a/src/3rdparty/freetype/src/base/ftsynth.c
+++ b/src/3rdparty/freetype/src/base/ftsynth.c
@@ -68,36 +68,13 @@
/*************************************************************************/
- FT_EXPORT_DEF( FT_Error )
- FT_GlyphSlot_Own_Bitmap( FT_GlyphSlot slot )
- {
- if ( slot && slot->format == FT_GLYPH_FORMAT_BITMAP &&
- !( slot->internal->flags & FT_GLYPH_OWN_BITMAP ) )
- {
- FT_Bitmap bitmap;
- FT_Error error;
-
-
- FT_Bitmap_New( &bitmap );
- error = FT_Bitmap_Copy( slot->library, &slot->bitmap, &bitmap );
- if ( error )
- return error;
-
- slot->bitmap = bitmap;
- slot->internal->flags |= FT_GLYPH_OWN_BITMAP;
- }
-
- return FT_Err_Ok;
- }
-
-
/* documentation is in ftsynth.h */
FT_EXPORT_DEF( void )
FT_GlyphSlot_Embolden( FT_GlyphSlot slot )
{
FT_Library library = slot->library;
- FT_Face face = FT_SLOT_FACE( slot );
+ FT_Face face = slot->face;
FT_Error error;
FT_Pos xstr, ystr;
@@ -123,10 +100,11 @@
}
else if ( slot->format == FT_GLYPH_FORMAT_BITMAP )
{
- xstr = FT_PIX_FLOOR( xstr );
+ /* round to full pixels */
+ xstr &= ~63;
if ( xstr == 0 )
xstr = 1 << 6;
- ystr = FT_PIX_FLOOR( ystr );
+ ystr &= ~63;
error = FT_GlyphSlot_Own_Bitmap( slot );
if ( error )
diff --git a/src/3rdparty/freetype/src/base/ftsystem.c b/src/3rdparty/freetype/src/base/ftsystem.c
index f61a3edfb..f64908fd2 100644
--- a/src/3rdparty/freetype/src/base/ftsystem.c
+++ b/src/3rdparty/freetype/src/base/ftsystem.c
@@ -4,7 +4,7 @@
/* */
/* ANSI-specific FreeType low-level system interface (body). */
/* */
-/* Copyright 1996-2001, 2002, 2006 by */
+/* Copyright 1996-2001, 2002, 2006, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -294,7 +294,7 @@
#ifdef FT_DEBUG_MEMORY
ft_mem_debug_done( memory );
#endif
- memory->free( memory, memory );
+ ft_sfree( memory );
}
diff --git a/src/3rdparty/freetype/src/base/rules.mk b/src/3rdparty/freetype/src/base/rules.mk
index d6e441254..66260e677 100644
--- a/src/3rdparty/freetype/src/base/rules.mk
+++ b/src/3rdparty/freetype/src/base/rules.mk
@@ -3,7 +3,7 @@
#
-# Copyright 1996-2000, 2002, 2003, 2004, 2005, 2006, 2007 by
+# Copyright 1996-2000, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
@@ -21,8 +21,6 @@
# BASE_EXT_OBJ: A list of base layer extensions, i.e., components found
# in `freetype/src/base' which are not compiled within the
# base layer proper.
-#
-# BASE_H is defined in freetype.mk to simplify the dependency rules.
BASE_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(SRC_DIR)/base)
@@ -35,7 +33,8 @@ BASE_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(SRC_DIR)/base)
# All files listed here should be included in `ftbase.c' (for a `single'
# build).
#
-BASE_SRC := $(BASE_DIR)/ftcalc.c \
+BASE_SRC := $(BASE_DIR)/ftadvanc.c \
+ $(BASE_DIR)/ftcalc.c \
$(BASE_DIR)/ftdbgmem.c \
$(BASE_DIR)/ftgloadr.c \
$(BASE_DIR)/ftnames.c \
@@ -46,6 +45,13 @@ BASE_SRC := $(BASE_DIR)/ftcalc.c \
$(BASE_DIR)/fttrigon.c \
$(BASE_DIR)/ftutil.c
+
+ifneq ($(ftmac_c),)
+ BASE_SRC += $(BASE_DIR)/$(ftmac_c)
+endif
+
+BASE_H := $(BASE_DIR)/ftbase.h
+
# Base layer `extensions' sources
#
# An extension is added to the library file as a separate object. It is
@@ -77,13 +83,13 @@ BASE_SRC_S := $(BASE_DIR)/ftbase.c
# Base layer - single object build
#
-$(BASE_OBJ_S): $(BASE_SRC_S) $(BASE_SRC) $(FREETYPE_H)
+$(BASE_OBJ_S): $(BASE_SRC_S) $(BASE_SRC) $(FREETYPE_H) $(BASE_H)
$(BASE_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $(BASE_SRC_S))
# Multiple objects build + extensions
#
-$(OBJ_DIR)/%.$O: $(BASE_DIR)/%.c $(FREETYPE_H)
+$(OBJ_DIR)/%.$O: $(BASE_DIR)/%.c $(FREETYPE_H) $(BASE_H)
$(BASE_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<)
diff --git a/src/3rdparty/freetype/src/bdf/bdfdrivr.c b/src/3rdparty/freetype/src/bdf/bdfdrivr.c
index 2a5767e2f..0b736b5ce 100644
--- a/src/3rdparty/freetype/src/bdf/bdfdrivr.c
+++ b/src/3rdparty/freetype/src/bdf/bdfdrivr.c
@@ -2,7 +2,7 @@
FreeType font driver for bdf files
- Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 by
+ Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by
Francesco Zappa Nardelli
Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -304,10 +304,15 @@ THE SOFTWARE.
FT_CALLBACK_DEF( void )
BDF_Face_Done( FT_Face bdfface ) /* BDF_Face */
{
- BDF_Face face = (BDF_Face)bdfface;
- FT_Memory memory = FT_FACE_MEMORY( face );
+ BDF_Face face = (BDF_Face)bdfface;
+ FT_Memory memory;
+ if ( !face )
+ return;
+
+ memory = FT_FACE_MEMORY( face );
+
bdf_free_font( face->bdffont );
FT_FREE( face->en_table );
@@ -610,7 +615,7 @@ THE SOFTWARE.
switch ( req->type )
{
case FT_SIZE_REQUEST_TYPE_NOMINAL:
- if ( height == ( bsize->y_ppem + 32 ) >> 6 )
+ if ( height == ( ( bsize->y_ppem + 32 ) >> 6 ) )
error = BDF_Err_Ok;
break;
diff --git a/src/3rdparty/freetype/src/bdf/bdflib.c b/src/3rdparty/freetype/src/bdf/bdflib.c
index 512cd62c3..5435b20e6 100644
--- a/src/3rdparty/freetype/src/bdf/bdflib.c
+++ b/src/3rdparty/freetype/src/bdf/bdflib.c
@@ -1,6 +1,6 @@
/*
* Copyright 2000 Computing Research Labs, New Mexico State University
- * Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007
+ * Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009
* Francesco Zappa Nardelli
*
* Permission is hereby granted, free of charge, to any person obtaining a
@@ -1394,6 +1394,12 @@
font->font_descent = fp->value.int32;
else if ( ft_memcmp( name, "SPACING", 7 ) == 0 )
{
+ if ( !fp->value.atom )
+ {
+ error = BDF_Err_Invalid_File_Format;
+ goto Exit;
+ }
+
if ( fp->value.atom[0] == 'p' || fp->value.atom[0] == 'P' )
font->spacing = BDF_PROPORTIONAL;
else if ( fp->value.atom[0] == 'm' || fp->value.atom[0] == 'M' )
@@ -2072,6 +2078,7 @@
error = _bdf_list_split( &p->list, (char *)" +", line, linelen );
if ( error )
goto Exit;
+ /* at this point, `p->font' can't be NULL */
p->cnt = p->font->props_size = _bdf_atoul( p->list.field[1], 0, 10 );
if ( FT_NEW_ARRAY( p->font->props, p->cnt ) )
diff --git a/src/3rdparty/freetype/src/bdf/module.mk b/src/3rdparty/freetype/src/bdf/module.mk
index dfaa2744e..fe06ae8e0 100644
--- a/src/3rdparty/freetype/src/bdf/module.mk
+++ b/src/3rdparty/freetype/src/bdf/module.mk
@@ -27,7 +27,7 @@
FTMODULE_H_COMMANDS += BDF_DRIVER
define BDF_DRIVER
-$(OPEN_DRIVER)bdf_driver_class$(CLOSE_DRIVER)
+$(OPEN_DRIVER) FT_Driver_ClassRec, bdf_driver_class $(CLOSE_DRIVER)
$(ECHO_DRIVER)bdf $(ECHO_DRIVER_DESC)bdf bitmap fonts$(ECHO_DRIVER_DONE)
endef
diff --git a/src/3rdparty/freetype/src/bdf/rules.mk b/src/3rdparty/freetype/src/bdf/rules.mk
index 25d98e55b..6ff1614dd 100644
--- a/src/3rdparty/freetype/src/bdf/rules.mk
+++ b/src/3rdparty/freetype/src/bdf/rules.mk
@@ -3,7 +3,7 @@
#
-# Copyright (C) 2001, 2002, 2003 by
+# Copyright (C) 2001, 2002, 2003, 2008 by
# Francesco Zappa Nardelli
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -29,7 +29,7 @@
# bdf driver directory
#
-BDF_DIR := $(SRC_DIR)/bdf
+BDF_DIR := $(SRC_DIR)/bdf
BDF_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(BDF_DIR))
@@ -44,7 +44,8 @@ BDF_DRV_SRC := $(BDF_DIR)/bdflib.c \
# bdf driver headers
#
BDF_DRV_H := $(BDF_DIR)/bdf.h \
- $(BDF_DIR)/bdfdrivr.h
+ $(BDF_DIR)/bdfdrivr.h \
+ $(BDF_DIR)/bdferror.h
# bdf driver object(s)
#
diff --git a/src/3rdparty/freetype/src/cache/ftccmap.c b/src/3rdparty/freetype/src/cache/ftccmap.c
index aa59307f4..4c6a7fd96 100644
--- a/src/3rdparty/freetype/src/cache/ftccmap.c
+++ b/src/3rdparty/freetype/src/cache/ftccmap.c
@@ -4,7 +4,7 @@
/* */
/* FreeType CharMap cache (body) */
/* */
-/* Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2007 by */
+/* Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -288,8 +288,20 @@
FT_Error error;
FT_UInt gindex = 0;
FT_UInt32 hash;
+ FT_Int no_cmap_change = 0;
+ if ( cmap_index < 0 )
+ {
+ /* Treat a negative cmap index as a special value, meaning that you */
+ /* don't want to change the FT_Face's character map through this */
+ /* call. This can be useful if the face requester callback already */
+ /* sets the face's charmap to the appropriate value. */
+
+ no_cmap_change = 1;
+ cmap_index = 0;
+ }
+
if ( !cache )
{
FT_ERROR(( "FTC_CMapCache_Lookup: bad arguments, returning 0!\n" ));
@@ -311,7 +323,7 @@
* Adobe Acrobat Reader Pack, named `KozMinProVI-Regular.otf',
* which contains more than 5 charmaps.
*/
- if ( cmap_index >= 16 )
+ if ( cmap_index >= 16 && !no_cmap_change )
{
FTC_OldCMapDesc desc = (FTC_OldCMapDesc) face_id;
@@ -393,12 +405,12 @@
old = face->charmap;
cmap = face->charmaps[cmap_index];
- if ( old != cmap )
+ if ( old != cmap && !no_cmap_change )
FT_Set_Charmap( face, cmap );
gindex = FT_Get_Char_Index( face, char_code );
- if ( old != cmap )
+ if ( old != cmap && !no_cmap_change )
FT_Set_Charmap( face, old );
}
diff --git a/src/3rdparty/freetype/src/cache/ftcmanag.c b/src/3rdparty/freetype/src/cache/ftcmanag.c
index 9d7347c3d..4d44094ce 100644
--- a/src/3rdparty/freetype/src/cache/ftcmanag.c
+++ b/src/3rdparty/freetype/src/cache/ftcmanag.c
@@ -4,7 +4,7 @@
/* */
/* FreeType Cache Manager (body). */
/* */
-/* Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006 by */
+/* Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -181,7 +181,7 @@
if ( asize == NULL )
- return FTC_Err_Bad_Argument;
+ return FTC_Err_Invalid_Argument;
*asize = NULL;
@@ -306,7 +306,7 @@
if ( aface == NULL )
- return FTC_Err_Bad_Argument;
+ return FTC_Err_Invalid_Argument;
*aface = NULL;
@@ -608,7 +608,8 @@
}
Exit:
- *acache = cache;
+ if ( acache )
+ *acache = cache;
return error;
}
diff --git a/src/3rdparty/freetype/src/cache/rules.mk b/src/3rdparty/freetype/src/cache/rules.mk
index 457dec848..ed75a6a91 100644
--- a/src/3rdparty/freetype/src/cache/rules.mk
+++ b/src/3rdparty/freetype/src/cache/rules.mk
@@ -3,7 +3,7 @@
#
-# Copyright 2000, 2001, 2003, 2004, 2006 by
+# Copyright 2000, 2001, 2003, 2004, 2006, 2008 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
@@ -26,7 +26,7 @@ CACHE_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(CACHE_DIR))
#
CACHE_DRV_SRC := $(CACHE_DIR)/ftcbasic.c \
$(CACHE_DIR)/ftccache.c \
- $(CACHE_DIR)/ftccmap.c \
+ $(CACHE_DIR)/ftccmap.c \
$(CACHE_DIR)/ftcglyph.c \
$(CACHE_DIR)/ftcimage.c \
$(CACHE_DIR)/ftcmanag.c \
@@ -35,12 +35,14 @@ CACHE_DRV_SRC := $(CACHE_DIR)/ftcbasic.c \
# Cache driver headers
#
-CACHE_DRV_H := $(CACHE_DIR)/ftccback.h \
+CACHE_DRV_H := $(CACHE_DIR)/ftccache.h \
+ $(CACHE_DIR)/ftccback.h \
$(CACHE_DIR)/ftcerror.h \
$(CACHE_DIR)/ftcglyph.h \
$(CACHE_DIR)/ftcimage.h \
$(CACHE_DIR)/ftcmanag.h \
- $(CACHE_DIR)/ftcmru.h
+ $(CACHE_DIR)/ftcmru.h \
+ $(CACHE_DIR)/ftcsbits.h
# Cache driver object(s)
diff --git a/src/3rdparty/freetype/src/cff/cffdrivr.c b/src/3rdparty/freetype/src/cff/cffdrivr.c
index 6c3ff989f..3dd86f2aa 100644
--- a/src/3rdparty/freetype/src/cff/cffdrivr.c
+++ b/src/3rdparty/freetype/src/cff/cffdrivr.c
@@ -4,7 +4,7 @@
/* */
/* OpenType font driver implementation (body). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by */
+/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -187,6 +187,35 @@
}
+ FT_CALLBACK_DEF( FT_Error )
+ cff_get_advances( FT_Face face,
+ FT_UInt start,
+ FT_UInt count,
+ FT_Int32 flags,
+ FT_Fixed* advances )
+ {
+ FT_UInt nn;
+ FT_Error error = CFF_Err_Ok;
+ FT_GlyphSlot slot = face->glyph;
+
+
+ flags |= FT_LOAD_ADVANCE_ONLY;
+
+ for ( nn = 0; nn < count; nn++ )
+ {
+ error = Load_Glyph( slot, face->size, start + nn, flags );
+ if ( error )
+ break;
+
+ advances[nn] = ( flags & FT_LOAD_VERTICAL_LAYOUT )
+ ? slot->linearVertAdvance
+ : slot->linearHoriAdvance;
+ }
+
+ return error;
+ }
+
+
/*
* GLYPH DICT SERVICE
*
@@ -341,7 +370,8 @@
cff->font_info = font_info;
}
- *afont_info = *cff->font_info;
+ if ( cff )
+ *afont_info = *cff->font_info;
Fail:
return error;
@@ -351,6 +381,7 @@
static const FT_Service_PsInfoRec cff_service_ps_info =
{
(PS_GetFontInfoFunc) cff_ps_get_font_info,
+ (PS_GetFontExtraFunc) NULL,
(PS_HasGlyphNamesFunc) cff_ps_has_glyph_names,
(PS_GetFontPrivateFunc)NULL /* unsupported with CFF fonts */
};
@@ -396,6 +427,7 @@
cmap_info->language = 0;
+ cmap_info->format = 0;
if ( cmap->clazz != &cff_cmap_encoding_class_rec &&
cmap->clazz != &cff_cmap_unicode_class_rec )
@@ -475,9 +507,74 @@
}
+ static FT_Error
+ cff_get_is_cid( CFF_Face face,
+ FT_Bool *is_cid )
+ {
+ FT_Error error = CFF_Err_Ok;
+ CFF_Font cff = (CFF_Font)face->extra.data;
+
+
+ *is_cid = 0;
+
+ if ( cff )
+ {
+ CFF_FontRecDict dict = &cff->top_font.font_dict;
+
+
+ if ( dict->cid_registry != 0xFFFFU )
+ *is_cid = 1;
+ }
+
+ return error;
+ }
+
+
+ static FT_Error
+ cff_get_cid_from_glyph_index( CFF_Face face,
+ FT_UInt glyph_index,
+ FT_UInt *cid )
+ {
+ FT_Error error = CFF_Err_Ok;
+ CFF_Font cff;
+
+
+ cff = (CFF_Font)face->extra.data;
+
+ if ( cff )
+ {
+ FT_UInt c;
+ CFF_FontRecDict dict = &cff->top_font.font_dict;
+
+
+ if ( dict->cid_registry == 0xFFFFU )
+ {
+ error = CFF_Err_Invalid_Argument;
+ goto Fail;
+ }
+
+ if ( glyph_index > cff->num_glyphs )
+ {
+ error = CFF_Err_Invalid_Argument;
+ goto Fail;
+ }
+
+ c = cff->charset.sids[glyph_index];
+
+ if ( cid )
+ *cid = c;
+ }
+
+ Fail:
+ return error;
+ }
+
+
static const FT_Service_CIDRec cff_service_cid_info =
{
- (FT_CID_GetRegistryOrderingSupplementFunc)cff_get_ros
+ (FT_CID_GetRegistryOrderingSupplementFunc)cff_get_ros,
+ (FT_CID_GetIsInternallyCIDKeyedFunc) cff_get_is_cid,
+ (FT_CID_GetCIDFromGlyphIndexFunc) cff_get_cid_from_glyph_index
};
@@ -570,7 +667,7 @@
cff_get_kerning,
0, /* FT_Face_AttachFunc */
- 0, /* FT_Face_GetAdvancesFunc */
+ cff_get_advances, /* FT_Face_GetAdvancesFunc */
cff_size_request,
diff --git a/src/3rdparty/freetype/src/cff/cffgload.c b/src/3rdparty/freetype/src/cff/cffgload.c
index 6553c8d1a..2718a277b 100644
--- a/src/3rdparty/freetype/src/cff/cffgload.c
+++ b/src/3rdparty/freetype/src/cff/cffgload.c
@@ -4,7 +4,7 @@
/* */
/* OpenType Glyph Loader (body). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by */
+/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -110,8 +110,11 @@
cff_op_callgsubr,
cff_op_return,
- cff_op_hsbw, /* Type 1 opcode: invalid but seen in real life */
- cff_op_closepath, /* ditto */
+ /* Type 1 opcodes: invalid but seen in real life */
+ cff_op_hsbw,
+ cff_op_closepath,
+ cff_op_callothersubr,
+ cff_op_pop,
/* do not remove */
cff_op_max
@@ -123,6 +126,11 @@
#define CFF_COUNT_EXACT 0x40
#define CFF_COUNT_CLEAR_STACK 0x20
+ /* count values which have the `CFF_COUNT_CHECK_WIDTH' flag set are */
+ /* used for checking the width and requested numbers of arguments */
+ /* only; they are set to zero afterwards */
+
+ /* the other two flags are informative only and unused currently */
static const FT_Byte cff_argument_counts[] =
{
@@ -193,6 +201,8 @@
0,
2, /* hsbw */
+ 0,
+ 0,
0
};
@@ -406,9 +416,11 @@
goto Exit;
}
+ FT_TRACE4(( "glyph index %d (subfont %d):\n", glyph_index, fd_index ));
+
sub = cff->subfonts[fd_index];
- if ( builder->hints_funcs )
+ if ( builder->hints_funcs && size )
{
CFF_Internal internal = (CFF_Internal)size->root.internal;
@@ -417,6 +429,10 @@
builder->hints_globals = (void *)internal->subfonts[fd_index];
}
}
+#ifdef FT_DEBUG_LEVEL_TRACE
+ else
+ FT_TRACE4(( "glyph index %d:\n", glyph_index ));
+#endif
decoder->num_locals = sub->num_local_subrs;
decoder->locals = sub->local_subrs;
@@ -944,6 +960,11 @@
}
else
{
+ /* The specification says that normally arguments are to be taken */
+ /* from the bottom of the stack. However, this seems not to be */
+ /* correct, at least for Acroread 7.0.8 on GNU/Linux: It pops the */
+ /* arguments similar to a PS interpreter. */
+
FT_Fixed* args = decoder->top;
FT_Int num_args = (FT_Int)( args - decoder->stack );
FT_Int req_args;
@@ -1028,6 +1049,12 @@
case 15:
op = cff_op_eq;
break;
+ case 16:
+ op = cff_op_callothersubr;
+ break;
+ case 17:
+ op = cff_op_pop;
+ break;
case 18:
op = cff_op_drop;
break;
@@ -1130,6 +1157,7 @@
default:
;
}
+
if ( op == cff_op_unknown )
goto Syntax_Error;
@@ -1137,8 +1165,6 @@
req_args = cff_argument_counts[op];
if ( req_args & CFF_COUNT_CHECK_WIDTH )
{
- args = stack;
-
if ( num_args > 0 && decoder->read_width )
{
/* If `nominal_width' is non-zero, the number is really a */
@@ -1172,7 +1198,7 @@
case cff_op_endchar:
/* If there is a width specified for endchar, we either have */
/* 1 argument or 5 arguments. We like to argue. */
- set_width_ok = ( ( num_args == 5 ) || ( num_args == 1 ) );
+ set_width_ok = ( num_args == 5 ) || ( num_args == 1 );
break;
default:
@@ -1185,9 +1211,14 @@
decoder->glyph_width = decoder->nominal_width +
( stack[0] >> 16 );
+ if ( decoder->width_only )
+ {
+ /* we only want the advance width; stop here */
+ break;
+ }
+
/* Consumed an argument. */
num_args--;
- args++;
}
}
@@ -1201,6 +1232,14 @@
args -= req_args;
num_args -= req_args;
+ /* At this point, `args' points to the first argument of the */
+ /* operand in case `req_args' isn't zero. Otherwise, we have */
+ /* to adjust `args' manually. */
+
+ /* Note that we only pop arguments from the stack which we */
+ /* really need and can digest so that we can continue in case */
+ /* of superfluous stack elements. */
+
switch ( op )
{
case cff_op_hstem:
@@ -1208,15 +1247,16 @@
case cff_op_hstemhm:
case cff_op_vstemhm:
/* the number of arguments is always even here */
- FT_TRACE4(( op == cff_op_hstem ? " hstem" :
- ( op == cff_op_vstem ? " vstem" :
- ( op == cff_op_hstemhm ? " hstemhm" : " vstemhm" ) ) ));
+ FT_TRACE4((
+ op == cff_op_hstem ? " hstem\n" :
+ ( op == cff_op_vstem ? " vstem\n" :
+ ( op == cff_op_hstemhm ? " hstemhm\n" : " vstemhm\n" ) ) ));
if ( hinter )
hinter->stems( hinter->hints,
( op == cff_op_hstem || op == cff_op_hstemhm ),
num_args / 2,
- args );
+ args - ( num_args & ~1 ) );
decoder->num_hints += num_args / 2;
args = stack;
@@ -1236,7 +1276,7 @@
hinter->stems( hinter->hints,
0,
num_args / 2,
- args );
+ args - ( num_args & ~1 ) );
decoder->num_hints += num_args / 2;
}
@@ -1259,12 +1299,14 @@
FT_UInt maskbyte;
- FT_TRACE4(( " " ));
+ FT_TRACE4(( " (maskbytes: " ));
for ( maskbyte = 0;
maskbyte < (FT_UInt)(( decoder->num_hints + 7 ) >> 3);
maskbyte++, ip++ )
FT_TRACE4(( "0x%02X", *ip ));
+
+ FT_TRACE4(( ")\n" ));
}
#else
ip += ( decoder->num_hints + 7 ) >> 3;
@@ -1275,44 +1317,44 @@
break;
case cff_op_rmoveto:
- FT_TRACE4(( " rmoveto" ));
+ FT_TRACE4(( " rmoveto\n" ));
cff_builder_close_contour( builder );
builder->path_begun = 0;
- x += args[0];
- y += args[1];
+ x += args[-2];
+ y += args[-1];
args = stack;
break;
case cff_op_vmoveto:
- FT_TRACE4(( " vmoveto" ));
+ FT_TRACE4(( " vmoveto\n" ));
cff_builder_close_contour( builder );
builder->path_begun = 0;
- y += args[0];
+ y += args[-1];
args = stack;
break;
case cff_op_hmoveto:
- FT_TRACE4(( " hmoveto" ));
+ FT_TRACE4(( " hmoveto\n" ));
cff_builder_close_contour( builder );
builder->path_begun = 0;
- x += args[0];
+ x += args[-1];
args = stack;
break;
case cff_op_rlineto:
- FT_TRACE4(( " rlineto" ));
+ FT_TRACE4(( " rlineto\n" ));
if ( cff_builder_start_point ( builder, x, y ) ||
check_points( builder, num_args / 2 ) )
goto Fail;
- if ( num_args < 2 || num_args & 1 )
+ if ( num_args < 2 )
goto Stack_Underflow;
- args = stack;
+ args -= num_args & ~1;
while ( args < decoder->top )
{
x += args[0];
@@ -1329,8 +1371,11 @@
FT_Int phase = ( op == cff_op_hlineto );
- FT_TRACE4(( op == cff_op_hlineto ? " hlineto"
- : " vlineto" ));
+ FT_TRACE4(( op == cff_op_hlineto ? " hlineto\n"
+ : " vlineto\n" ));
+
+ if ( num_args < 1 )
+ goto Stack_Underflow;
if ( cff_builder_start_point ( builder, x, y ) ||
check_points( builder, num_args ) )
@@ -1355,125 +1400,164 @@
break;
case cff_op_rrcurveto:
- FT_TRACE4(( " rrcurveto" ));
+ {
+ FT_Int nargs;
- /* check number of arguments; must be a multiple of 6 */
- if ( num_args % 6 != 0 )
- goto Stack_Underflow;
- if ( cff_builder_start_point ( builder, x, y ) ||
- check_points( builder, num_args / 2 ) )
- goto Fail;
+ FT_TRACE4(( " rrcurveto\n" ));
- args = stack;
- while ( args < decoder->top )
- {
- x += args[0];
- y += args[1];
- cff_builder_add_point( builder, x, y, 0 );
- x += args[2];
- y += args[3];
- cff_builder_add_point( builder, x, y, 0 );
- x += args[4];
- y += args[5];
- cff_builder_add_point( builder, x, y, 1 );
- args += 6;
+ if ( num_args < 6 )
+ goto Stack_Underflow;
+
+ nargs = num_args - num_args % 6;
+
+ if ( cff_builder_start_point ( builder, x, y ) ||
+ check_points( builder, nargs / 2 ) )
+ goto Fail;
+
+ args -= nargs;
+ while ( args < decoder->top )
+ {
+ x += args[0];
+ y += args[1];
+ cff_builder_add_point( builder, x, y, 0 );
+ x += args[2];
+ y += args[3];
+ cff_builder_add_point( builder, x, y, 0 );
+ x += args[4];
+ y += args[5];
+ cff_builder_add_point( builder, x, y, 1 );
+ args += 6;
+ }
+ args = stack;
}
- args = stack;
break;
case cff_op_vvcurveto:
- FT_TRACE4(( " vvcurveto" ));
+ {
+ FT_Int nargs;
- if ( cff_builder_start_point( builder, x, y ) )
- goto Fail;
- args = stack;
- if ( num_args & 1 )
- {
- x += args[0];
- args++;
- num_args--;
- }
+ FT_TRACE4(( " vvcurveto\n" ));
- if ( num_args % 4 != 0 )
- goto Stack_Underflow;
+ if ( num_args < 4 )
+ goto Stack_Underflow;
- if ( check_points( builder, 3 * ( num_args / 4 ) ) )
- goto Fail;
+ /* if num_args isn't of the form 4n or 4n+1, */
+ /* we reduce it to 4n+1 */
- while ( args < decoder->top )
- {
- y += args[0];
- cff_builder_add_point( builder, x, y, 0 );
- x += args[1];
- y += args[2];
- cff_builder_add_point( builder, x, y, 0 );
- y += args[3];
- cff_builder_add_point( builder, x, y, 1 );
- args += 4;
+ nargs = num_args - num_args % 4;
+ if ( num_args - nargs > 0 )
+ nargs += 1;
+
+ if ( cff_builder_start_point( builder, x, y ) )
+ goto Fail;
+
+ args -= nargs;
+
+ if ( nargs & 1 )
+ {
+ x += args[0];
+ args++;
+ nargs--;
+ }
+
+ if ( check_points( builder, 3 * ( nargs / 4 ) ) )
+ goto Fail;
+
+ while ( args < decoder->top )
+ {
+ y += args[0];
+ cff_builder_add_point( builder, x, y, 0 );
+ x += args[1];
+ y += args[2];
+ cff_builder_add_point( builder, x, y, 0 );
+ y += args[3];
+ cff_builder_add_point( builder, x, y, 1 );
+ args += 4;
+ }
+ args = stack;
}
- args = stack;
break;
case cff_op_hhcurveto:
- FT_TRACE4(( " hhcurveto" ));
+ {
+ FT_Int nargs;
- if ( cff_builder_start_point( builder, x, y ) )
- goto Fail;
- args = stack;
- if ( num_args & 1 )
- {
- y += args[0];
- args++;
- num_args--;
- }
+ FT_TRACE4(( " hhcurveto\n" ));
- if ( num_args % 4 != 0 )
- goto Stack_Underflow;
+ if ( num_args < 4 )
+ goto Stack_Underflow;
- if ( check_points( builder, 3 * ( num_args / 4 ) ) )
- goto Fail;
+ /* if num_args isn't of the form 4n or 4n+1, */
+ /* we reduce it to 4n+1 */
- while ( args < decoder->top )
- {
- x += args[0];
- cff_builder_add_point( builder, x, y, 0 );
- x += args[1];
- y += args[2];
- cff_builder_add_point( builder, x, y, 0 );
- x += args[3];
- cff_builder_add_point( builder, x, y, 1 );
- args += 4;
+ nargs = num_args - num_args % 4;
+ if ( num_args - nargs > 0 )
+ nargs += 1;
+
+ if ( cff_builder_start_point( builder, x, y ) )
+ goto Fail;
+
+ args -= nargs;
+ if ( nargs & 1 )
+ {
+ y += args[0];
+ args++;
+ nargs--;
+ }
+
+ if ( check_points( builder, 3 * ( nargs / 4 ) ) )
+ goto Fail;
+
+ while ( args < decoder->top )
+ {
+ x += args[0];
+ cff_builder_add_point( builder, x, y, 0 );
+ x += args[1];
+ y += args[2];
+ cff_builder_add_point( builder, x, y, 0 );
+ x += args[3];
+ cff_builder_add_point( builder, x, y, 1 );
+ args += 4;
+ }
+ args = stack;
}
- args = stack;
break;
case cff_op_vhcurveto:
case cff_op_hvcurveto:
{
FT_Int phase;
+ FT_Int nargs;
- FT_TRACE4(( op == cff_op_vhcurveto ? " vhcurveto"
- : " hvcurveto" ));
+ FT_TRACE4(( op == cff_op_vhcurveto ? " vhcurveto\n"
+ : " hvcurveto\n" ));
if ( cff_builder_start_point( builder, x, y ) )
goto Fail;
- args = stack;
- if ( num_args < 4 || ( num_args % 4 ) > 1 )
+ if ( num_args < 4 )
goto Stack_Underflow;
- if ( check_points( builder, ( num_args / 4 ) * 3 ) )
+ /* if num_args isn't of the form 8n, 8n+1, 8n+4, or 8n+5, */
+ /* we reduce it to the largest one which fits */
+
+ nargs = num_args - num_args % 4;
+ if ( num_args - nargs > 0 )
+ nargs += 1;
+
+ args -= nargs;
+ if ( check_points( builder, ( nargs / 4 ) * 3 ) )
goto Stack_Underflow;
phase = ( op == cff_op_hvcurveto );
- while ( num_args >= 4 )
+ while ( nargs >= 4 )
{
- num_args -= 4;
+ nargs -= 4;
if ( phase )
{
x += args[0];
@@ -1482,7 +1566,7 @@
y += args[2];
cff_builder_add_point( builder, x, y, 0 );
y += args[3];
- if ( num_args == 1 )
+ if ( nargs == 1 )
x += args[4];
cff_builder_add_point( builder, x, y, 1 );
}
@@ -1494,7 +1578,7 @@
y += args[2];
cff_builder_add_point( builder, x, y, 0 );
x += args[3];
- if ( num_args == 1 )
+ if ( nargs == 1 )
y += args[4];
cff_builder_add_point( builder, x, y, 1 );
}
@@ -1507,19 +1591,23 @@
case cff_op_rlinecurve:
{
- FT_Int num_lines = ( num_args - 6 ) / 2;
+ FT_Int num_lines;
+ FT_Int nargs;
- FT_TRACE4(( " rlinecurve" ));
+ FT_TRACE4(( " rlinecurve\n" ));
- if ( num_args < 8 || ( num_args - 6 ) & 1 )
+ if ( num_args < 8 )
goto Stack_Underflow;
+ nargs = num_args & ~1;
+ num_lines = ( nargs - 6 ) / 2;
+
if ( cff_builder_start_point( builder, x, y ) ||
check_points( builder, num_lines + 3 ) )
goto Fail;
- args = stack;
+ args -= nargs;
/* first, add the line segments */
while ( num_lines > 0 )
@@ -1547,19 +1635,24 @@
case cff_op_rcurveline:
{
- FT_Int num_curves = ( num_args - 2 ) / 6;
+ FT_Int num_curves;
+ FT_Int nargs;
- FT_TRACE4(( " rcurveline" ));
+ FT_TRACE4(( " rcurveline\n" ));
- if ( num_args < 8 || ( num_args - 2 ) % 6 )
+ if ( num_args < 8 )
goto Stack_Underflow;
+ nargs = num_args - 2;
+ nargs = nargs - nargs % 6 + 2;
+ num_curves = ( nargs - 2 ) / 6;
+
if ( cff_builder_start_point ( builder, x, y ) ||
- check_points( builder, num_curves*3 + 2 ) )
+ check_points( builder, num_curves * 3 + 2 ) )
goto Fail;
- args = stack;
+ args -= nargs;
/* first, add the curves */
while ( num_curves > 0 )
@@ -1590,18 +1683,16 @@
FT_Pos start_y;
- FT_TRACE4(( " hflex1" ));
-
- args = stack;
+ FT_TRACE4(( " hflex1\n" ));
- /* adding five more points; 4 control points, 1 on-curve point */
- /* make sure we have enough space for the start point if it */
+ /* adding five more points: 4 control points, 1 on-curve point */
+ /* -- make sure we have enough space for the start point if it */
/* needs to be added */
if ( cff_builder_start_point( builder, x, y ) ||
check_points( builder, 6 ) )
goto Fail;
- /* Record the starting point's y position for later use */
+ /* record the starting point's y position for later use */
start_y = y;
/* first control point */
@@ -1643,9 +1734,7 @@
FT_Pos start_y;
- FT_TRACE4(( " hflex" ));
-
- args = stack;
+ FT_TRACE4(( " hflex\n" ));
/* adding six more points; 4 control points, 2 on-curve points */
if ( cff_builder_start_point( builder, x, y ) ||
@@ -1690,14 +1779,15 @@
case cff_op_flex1:
{
- FT_Pos start_x, start_y; /* record start x, y values for */
- /* alter use */
- FT_Fixed dx = 0, dy = 0; /* used in horizontal/vertical */
- /* algorithm below */
- FT_Int horizontal, count;
+ FT_Pos start_x, start_y; /* record start x, y values for */
+ /* alter use */
+ FT_Fixed dx = 0, dy = 0; /* used in horizontal/vertical */
+ /* algorithm below */
+ FT_Int horizontal, count;
+ FT_Fixed* temp;
- FT_TRACE4(( " flex1" ));
+ FT_TRACE4(( " flex1\n" ));
/* adding six more points; 4 control points, 2 on-curve points */
if ( cff_builder_start_point( builder, x, y ) ||
@@ -1711,21 +1801,20 @@
/* XXX: figure out whether this is supposed to be a horizontal */
/* or vertical flex; the Type 2 specification is vague... */
- args = stack;
+ temp = args;
/* grab up to the last argument */
for ( count = 5; count > 0; count-- )
{
- dx += args[0];
- dy += args[1];
- args += 2;
+ dx += temp[0];
+ dy += temp[1];
+ temp += 2;
}
- /* rewind */
- args = stack;
-
- if ( dx < 0 ) dx = -dx;
- if ( dy < 0 ) dy = -dy;
+ if ( dx < 0 )
+ dx = -dx;
+ if ( dy < 0 )
+ dy = -dy;
/* strange test, but here it is... */
horizontal = ( dx > dy );
@@ -1734,7 +1823,8 @@
{
x += args[0];
y += args[1];
- cff_builder_add_point( builder, x, y, (FT_Bool)( count == 3 ) );
+ cff_builder_add_point( builder, x, y,
+ (FT_Bool)( count == 3 ) );
args += 2;
}
@@ -1761,13 +1851,12 @@
FT_UInt count;
- FT_TRACE4(( " flex" ));
+ FT_TRACE4(( " flex\n" ));
if ( cff_builder_start_point( builder, x, y ) ||
check_points( builder, 6 ) )
goto Fail;
- args = stack;
for ( count = 6; count > 0; count-- )
{
x += args[0];
@@ -1782,21 +1871,20 @@
break;
case cff_op_endchar:
- FT_TRACE4(( " endchar" ));
+ FT_TRACE4(( " endchar\n" ));
/* We are going to emulate the seac operator. */
- if ( num_args == 4 )
+ if ( num_args >= 4 )
{
/* Save glyph width so that the subglyphs don't overwrite it. */
FT_Pos glyph_width = decoder->glyph_width;
error = cff_operator_seac( decoder,
- args[0],
- args[1],
- (FT_Int)( args[2] >> 16 ),
- (FT_Int)( args[3] >> 16 ) );
- args += 4;
+ args[-4],
+ args[-3],
+ (FT_Int)( args[-2] >> 16 ),
+ (FT_Int)( args[-1] >> 16 ) );
decoder->glyph_width = glyph_width;
}
@@ -1826,11 +1914,11 @@
}
/* return now! */
- FT_TRACE4(( "\n\n" ));
+ FT_TRACE4(( "\n" ));
return error;
case cff_op_abs:
- FT_TRACE4(( " abs" ));
+ FT_TRACE4(( " abs\n" ));
if ( args[0] < 0 )
args[0] = -args[0];
@@ -1838,28 +1926,28 @@
break;
case cff_op_add:
- FT_TRACE4(( " add" ));
+ FT_TRACE4(( " add\n" ));
args[0] += args[1];
args++;
break;
case cff_op_sub:
- FT_TRACE4(( " sub" ));
+ FT_TRACE4(( " sub\n" ));
args[0] -= args[1];
args++;
break;
case cff_op_div:
- FT_TRACE4(( " div" ));
+ FT_TRACE4(( " div\n" ));
args[0] = FT_DivFix( args[0], args[1] );
args++;
break;
case cff_op_neg:
- FT_TRACE4(( " neg" ));
+ FT_TRACE4(( " neg\n" ));
args[0] = -args[0];
args++;
@@ -1870,7 +1958,7 @@
FT_Fixed Rand;
- FT_TRACE4(( " rand" ));
+ FT_TRACE4(( " rand\n" ));
Rand = seed;
if ( Rand >= 0x8000L )
@@ -1885,14 +1973,14 @@
break;
case cff_op_mul:
- FT_TRACE4(( " mul" ));
+ FT_TRACE4(( " mul\n" ));
args[0] = FT_MulFix( args[0], args[1] );
args++;
break;
case cff_op_sqrt:
- FT_TRACE4(( " sqrt" ));
+ FT_TRACE4(( " sqrt\n" ));
if ( args[0] > 0 )
{
@@ -1917,7 +2005,7 @@
case cff_op_drop:
/* nothing */
- FT_TRACE4(( " drop" ));
+ FT_TRACE4(( " drop\n" ));
break;
@@ -1926,7 +2014,7 @@
FT_Fixed tmp;
- FT_TRACE4(( " exch" ));
+ FT_TRACE4(( " exch\n" ));
tmp = args[0];
args[0] = args[1];
@@ -1940,7 +2028,7 @@
FT_Int idx = (FT_Int)( args[0] >> 16 );
- FT_TRACE4(( " index" ));
+ FT_TRACE4(( " index\n" ));
if ( idx < 0 )
idx = 0;
@@ -1957,7 +2045,7 @@
FT_Int idx = (FT_Int)( args[1] >> 16 );
- FT_TRACE4(( " roll" ));
+ FT_TRACE4(( " roll\n" ));
if ( count <= 0 )
count = 1;
@@ -1999,7 +2087,7 @@
break;
case cff_op_dup:
- FT_TRACE4(( " dup" ));
+ FT_TRACE4(( " dup\n" ));
args[1] = args[0];
args++;
@@ -2011,7 +2099,7 @@
FT_Int idx = (FT_Int)( args[1] >> 16 );
- FT_TRACE4(( " put" ));
+ FT_TRACE4(( " put\n" ));
if ( idx >= 0 && idx < decoder->len_buildchar )
decoder->buildchar[idx] = val;
@@ -2024,7 +2112,7 @@
FT_Fixed val = 0;
- FT_TRACE4(( " get" ));
+ FT_TRACE4(( " get\n" ));
if ( idx >= 0 && idx < decoder->len_buildchar )
val = decoder->buildchar[idx];
@@ -2035,18 +2123,18 @@
break;
case cff_op_store:
- FT_TRACE4(( " store "));
+ FT_TRACE4(( " store\n"));
goto Unimplemented;
case cff_op_load:
- FT_TRACE4(( " load" ));
+ FT_TRACE4(( " load\n" ));
goto Unimplemented;
case cff_op_dotsection:
/* this operator is deprecated and ignored by the parser */
- FT_TRACE4(( " dotsection" ));
+ FT_TRACE4(( " dotsection\n" ));
break;
case cff_op_closepath:
@@ -2054,7 +2142,7 @@
/* exist fonts which are incorrectly converted from probably */
/* Type 1 to CFF, and some parsers seem to accept it */
- FT_TRACE4(( " closepath (invalid op)" ));
+ FT_TRACE4(( " closepath (invalid op)\n" ));
args = stack;
break;
@@ -2064,7 +2152,7 @@
/* exist fonts which are incorrectly converted from probably */
/* Type 1 to CFF, and some parsers seem to accept it */
- FT_TRACE4(( " hsbw (invalid op)" ));
+ FT_TRACE4(( " hsbw (invalid op)\n" ));
decoder->glyph_width = decoder->nominal_width +
(args[1] >> 16);
@@ -2073,12 +2161,33 @@
args = stack;
break;
+ case cff_op_callothersubr:
+ /* this is an invalid Type 2 operator; however, there */
+ /* exist fonts which are incorrectly converted from probably */
+ /* Type 1 to CFF, and some parsers seem to accept it */
+
+ FT_TRACE4(( " callothersubr (invalid op)\n" ));
+
+ /* don't modify stack; handle the subr as `unknown' so that */
+ /* following `pop' operands use the arguments on stack */
+ break;
+
+ case cff_op_pop:
+ /* this is an invalid Type 2 operator; however, there */
+ /* exist fonts which are incorrectly converted from probably */
+ /* Type 1 to CFF, and some parsers seem to accept it */
+
+ FT_TRACE4(( " pop (invalid op)\n" ));
+
+ args++;
+ break;
+
case cff_op_and:
{
FT_Fixed cond = args[0] && args[1];
- FT_TRACE4(( " and" ));
+ FT_TRACE4(( " and\n" ));
args[0] = cond ? 0x10000L : 0;
args++;
@@ -2090,7 +2199,7 @@
FT_Fixed cond = args[0] || args[1];
- FT_TRACE4(( " or" ));
+ FT_TRACE4(( " or\n" ));
args[0] = cond ? 0x10000L : 0;
args++;
@@ -2102,7 +2211,7 @@
FT_Fixed cond = !args[0];
- FT_TRACE4(( " eq" ));
+ FT_TRACE4(( " eq\n" ));
args[0] = cond ? 0x10000L : 0;
args++;
@@ -2114,7 +2223,7 @@
FT_Fixed cond = ( args[2] <= args[3] );
- FT_TRACE4(( " ifelse" ));
+ FT_TRACE4(( " ifelse\n" ));
if ( !cond )
args[0] = args[1];
@@ -2128,7 +2237,7 @@
decoder->locals_bias );
- FT_TRACE4(( " callsubr(%d)", idx ));
+ FT_TRACE4(( " callsubr(%d)\n", idx ));
if ( idx >= decoder->num_locals )
{
@@ -2170,7 +2279,7 @@
decoder->globals_bias );
- FT_TRACE4(( " callgsubr(%d)", idx ));
+ FT_TRACE4(( " callgsubr(%d)\n", idx ));
if ( idx >= decoder->num_globals )
{
@@ -2207,7 +2316,7 @@
break;
case cff_op_return:
- FT_TRACE4(( " return" ));
+ FT_TRACE4(( " return\n" ));
if ( decoder->zone <= decoder->zones )
{
@@ -2245,15 +2354,15 @@
return error;
Syntax_Error:
- FT_TRACE4(( "cff_decoder_parse_charstrings: syntax error!" ));
+ FT_TRACE4(( "cff_decoder_parse_charstrings: syntax error!\n" ));
return CFF_Err_Invalid_File_Format;
Stack_Underflow:
- FT_TRACE4(( "cff_decoder_parse_charstrings: stack underflow!" ));
+ FT_TRACE4(( "cff_decoder_parse_charstrings: stack underflow!\n" ));
return CFF_Err_Too_Few_Arguments;
Stack_Overflow:
- FT_TRACE4(( "cff_decoder_parse_charstrings: stack overflow!" ));
+ FT_TRACE4(( "cff_decoder_parse_charstrings: stack overflow!\n" ));
return CFF_Err_Stack_Overflow;
}
@@ -2341,9 +2450,9 @@
{
FT_Error error;
CFF_Decoder decoder;
- TT_Face face = (TT_Face)glyph->root.face;
+ TT_Face face = (TT_Face)glyph->root.face;
FT_Bool hinting, force_scaling;
- CFF_Font cff = (CFF_Font)face->extra.data;
+ CFF_Font cff = (CFF_Font)face->extra.data;
FT_Matrix font_matrix;
FT_Vector font_offset;
@@ -2357,9 +2466,14 @@
if ( cff->top_font.font_dict.cid_registry != 0xFFFFU &&
cff->charset.cids )
{
- glyph_index = cff_charset_cid_to_gindex( &cff->charset, glyph_index );
- if ( glyph_index == 0 )
- return CFF_Err_Invalid_Argument;
+ /* don't handle CID 0 (.notdef) which is directly mapped to GID 0 */
+ if ( glyph_index != 0 )
+ {
+ glyph_index = cff_charset_cid_to_gindex( &cff->charset,
+ glyph_index );
+ if ( glyph_index == 0 )
+ return CFF_Err_Invalid_Argument;
+ }
}
else if ( glyph_index >= cff->num_glyphs )
return CFF_Err_Invalid_Argument;
@@ -2488,8 +2602,11 @@
cff_decoder_init( &decoder, face, size, glyph, hinting,
FT_LOAD_TARGET_MODE( load_flags ) );
+ if ( load_flags & FT_LOAD_ADVANCE_ONLY )
+ decoder.width_only = TRUE;
+
decoder.builder.no_recurse =
- (FT_Bool)( ( load_flags & FT_LOAD_NO_RECURSE ) != 0 );
+ (FT_Bool)( load_flags & FT_LOAD_NO_RECURSE );
/* now load the unscaled outline */
error = cff_get_glyph_data( face, glyph_index,
@@ -2596,7 +2713,7 @@
has_vertical_info = FT_BOOL( face->vertical_info &&
face->vertical.number_Of_VMetrics > 0 &&
- face->vertical.long_metrics != 0 );
+ face->vertical.long_metrics );
/* get the vertical metrics from the vtmx table if we have one */
if ( has_vertical_info )
diff --git a/src/3rdparty/freetype/src/cff/cffgload.h b/src/3rdparty/freetype/src/cff/cffgload.h
index d661f9e70..667134e3b 100644
--- a/src/3rdparty/freetype/src/cff/cffgload.h
+++ b/src/3rdparty/freetype/src/cff/cffgload.h
@@ -139,6 +139,7 @@ FT_BEGIN_HEADER
FT_Pos nominal_width;
FT_Bool read_width;
+ FT_Bool width_only;
FT_Int num_hints;
FT_Fixed* buildchar;
FT_Int len_buildchar;
diff --git a/src/3rdparty/freetype/src/cff/cffload.c b/src/3rdparty/freetype/src/cff/cffload.c
index 1e7dd1436..22163fb75 100644
--- a/src/3rdparty/freetype/src/cff/cffload.c
+++ b/src/3rdparty/freetype/src/cff/cffload.c
@@ -4,7 +4,7 @@
/* */
/* OpenType and CFF data/program tables loader (body). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by */
+/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -319,7 +319,7 @@
static FT_Error
cff_index_load_offsets( CFF_Index idx )
{
- FT_Error error = 0;
+ FT_Error error = CFF_Err_Ok;
FT_Stream stream = idx->stream;
FT_Memory memory = stream->memory;
@@ -402,6 +402,7 @@
old_offset = 1;
for ( n = 0; n <= idx->count; n++ )
{
+ /* at this point, `idx->offsets' can't be NULL */
offset = idx->offsets[n];
if ( !offset )
offset = old_offset;
@@ -1355,7 +1356,8 @@
FT_LOCAL_DEF( FT_Error )
cff_font_load( FT_Stream stream,
FT_Int face_index,
- CFF_Font font )
+ CFF_Font font,
+ FT_Bool pure_cff )
{
static const FT_Frame_Field cff_header_fields[] =
{
@@ -1519,7 +1521,7 @@
/* read the Charset and Encoding tables if available */
if ( font->num_glyphs > 0 )
{
- FT_Bool invert = FT_BOOL( dict->cid_registry != 0xFFFFU );
+ FT_Bool invert = FT_BOOL( dict->cid_registry != 0xFFFFU && pure_cff );
error = cff_charset_load( &font->charset, font->num_glyphs, stream,
@@ -1539,9 +1541,6 @@
if ( error )
goto Exit;
}
- else
- /* CID-keyed fonts only need CIDs */
- FT_FREE( font->charset.sids );
}
/* get the font name (/CIDFontName for CID-keyed fonts, */
diff --git a/src/3rdparty/freetype/src/cff/cffload.h b/src/3rdparty/freetype/src/cff/cffload.h
index 068cbb58c..02498bd5e 100644
--- a/src/3rdparty/freetype/src/cff/cffload.h
+++ b/src/3rdparty/freetype/src/cff/cffload.h
@@ -4,7 +4,7 @@
/* */
/* OpenType & CFF data/program tables loader (specification). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2007 by */
+/* Copyright 1996-2001, 2002, 2003, 2007, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -60,7 +60,8 @@ FT_BEGIN_HEADER
FT_LOCAL( FT_Error )
cff_font_load( FT_Stream stream,
FT_Int face_index,
- CFF_Font font );
+ CFF_Font font,
+ FT_Bool pure_cff );
FT_LOCAL( void )
cff_font_done( CFF_Font font );
diff --git a/src/3rdparty/freetype/src/cff/cffobjs.c b/src/3rdparty/freetype/src/cff/cffobjs.c
index 12997a94b..3525ea3b7 100644
--- a/src/3rdparty/freetype/src/cff/cffobjs.c
+++ b/src/3rdparty/freetype/src/cff/cffobjs.c
@@ -101,7 +101,7 @@
/* CFF and Type 1 private dictionaries have slightly different */
- /* structures; we need to synthetize a Type 1 dictionary on the fly */
+ /* structures; we need to synthesize a Type 1 dictionary on the fly */
static void
cff_make_private_dict( CFF_SubFont subfont,
@@ -437,7 +437,7 @@
error = sfnt->init_face( stream, face, face_index, num_params, params );
if ( !error )
{
- if ( face->format_tag != 0x4F54544FL ) /* `OTTO'; OpenType/CFF font */
+ if ( face->format_tag != TTAG_OTTO ) /* `OTTO'; OpenType/CFF font */
{
FT_TRACE2(( "[not a valid OpenType/CFF font]\n" ));
goto Bad_Format;
@@ -465,8 +465,7 @@
pure_cff = 0;
/* load font directory */
- error = sfnt->load_face( stream, face,
- face_index, num_params, params );
+ error = sfnt->load_face( stream, face, 0, num_params, params );
if ( error )
goto Exit;
}
@@ -508,13 +507,15 @@
goto Exit;
face->extra.data = cff;
- error = cff_font_load( stream, face_index, cff );
+ error = cff_font_load( stream, face_index, cff, pure_cff );
if ( error )
goto Exit;
cff->pshinter = pshinter;
cff->psnames = (void*)psnames;
+ cffface->face_index = face_index;
+
/* Complement the root flags with some interesting information. */
/* Note that this is only necessary for pure CFF and CEF fonts; */
/* SFNT based fonts use the `name' table instead. */
@@ -534,6 +535,111 @@
goto Bad_Format;
}
+ if ( !dict->units_per_em )
+ dict->units_per_em = pure_cff ? 1000 : face->root.units_per_EM;
+
+ /* Normalize the font matrix so that `matrix->xx' is 1; the */
+ /* scaling is done with `units_per_em' then (at this point, */
+ /* it already contains the scaling factor, but without */
+ /* normalization of the matrix). */
+ /* */
+ /* Note that the offsets must be expressed in integer font */
+ /* units. */
+
+ {
+ FT_Matrix* matrix = &dict->font_matrix;
+ FT_Vector* offset = &dict->font_offset;
+ FT_ULong* upm = &dict->units_per_em;
+ FT_Fixed temp = FT_ABS( matrix->yy );
+
+
+ if ( temp != 0x10000L )
+ {
+ *upm = FT_DivFix( *upm, temp );
+
+ matrix->xx = FT_DivFix( matrix->xx, temp );
+ matrix->yx = FT_DivFix( matrix->yx, temp );
+ matrix->xy = FT_DivFix( matrix->xy, temp );
+ matrix->yy = FT_DivFix( matrix->yy, temp );
+ offset->x = FT_DivFix( offset->x, temp );
+ offset->y = FT_DivFix( offset->y, temp );
+ }
+
+ offset->x >>= 16;
+ offset->y >>= 16;
+ }
+
+ for ( i = cff->num_subfonts; i > 0; i-- )
+ {
+ CFF_FontRecDict sub = &cff->subfonts[i - 1]->font_dict;
+ CFF_FontRecDict top = &cff->top_font.font_dict;
+
+ FT_Matrix* matrix;
+ FT_Vector* offset;
+ FT_ULong* upm;
+ FT_Fixed temp;
+
+
+ if ( sub->units_per_em )
+ {
+ FT_Int scaling;
+
+
+ if ( top->units_per_em > 1 && sub->units_per_em > 1 )
+ scaling = FT_MIN( top->units_per_em, sub->units_per_em );
+ else
+ scaling = 1;
+
+ FT_Matrix_Multiply_Scaled( &top->font_matrix,
+ &sub->font_matrix,
+ scaling );
+ FT_Vector_Transform_Scaled( &sub->font_offset,
+ &top->font_matrix,
+ scaling );
+
+ sub->units_per_em = FT_MulDiv( sub->units_per_em,
+ top->units_per_em,
+ scaling );
+ }
+ else
+ {
+ sub->font_matrix = top->font_matrix;
+ sub->font_offset = top->font_offset;
+
+ sub->units_per_em = top->units_per_em;
+ }
+
+ matrix = &sub->font_matrix;
+ offset = &sub->font_offset;
+ upm = &sub->units_per_em;
+ temp = FT_ABS( matrix->yy );
+
+ if ( temp != 0x10000L )
+ {
+ *upm = FT_DivFix( *upm, temp );
+
+ /* if *upm is larger than 100*1000 we divide by 1000 -- */
+ /* this can happen if e.g. there is no top-font FontMatrix */
+ /* and the subfont FontMatrix already contains the complete */
+ /* scaling for the subfont (see section 5.11 of the PLRM) */
+
+ /* 100 is a heuristic value */
+
+ if ( *upm > 100L * 1000L )
+ *upm = ( *upm + 500 ) / 1000;
+
+ matrix->xx = FT_DivFix( matrix->xx, temp );
+ matrix->yx = FT_DivFix( matrix->yx, temp );
+ matrix->xy = FT_DivFix( matrix->xy, temp );
+ matrix->yy = FT_DivFix( matrix->yy, temp );
+ offset->x = FT_DivFix( offset->x, temp );
+ offset->y = FT_DivFix( offset->y, temp );
+ }
+
+ offset->x >>= 16;
+ offset->y >>= 16;
+ }
+
if ( pure_cff )
{
char* style_name = NULL;
@@ -554,10 +660,7 @@
cffface->bbox.xMax = ( dict->font_bbox.xMax + 0xFFFFU ) >> 16;
cffface->bbox.yMax = ( dict->font_bbox.yMax + 0xFFFFU ) >> 16;
- if ( !dict->units_per_em )
- dict->units_per_em = 1000;
-
- cffface->units_per_EM = dict->units_per_em;
+ cffface->units_per_EM = (FT_UShort)( dict->units_per_em );
cffface->ascender = (FT_Short)( cffface->bbox.yMax );
cffface->descender = (FT_Short)( cffface->bbox.yMin );
@@ -711,113 +814,7 @@
cffface->style_flags = flags;
}
- else
- {
- if ( !dict->units_per_em )
- dict->units_per_em = face->root.units_per_EM;
- }
-
- /* Normalize the font matrix so that `matrix->xx' is 1; the */
- /* scaling is done with `units_per_em' then (at this point, */
- /* it already contains the scaling factor, but without */
- /* normalization of the matrix). */
- /* */
- /* Note that the offsets must be expressed in integer font */
- /* units. */
- {
- FT_Matrix* matrix = &dict->font_matrix;
- FT_Vector* offset = &dict->font_offset;
- FT_ULong* upm = &dict->units_per_em;
- FT_Fixed temp = FT_ABS( matrix->yy );
-
-
- if ( temp != 0x10000L )
- {
- *upm = FT_DivFix( *upm, temp );
-
- matrix->xx = FT_DivFix( matrix->xx, temp );
- matrix->yx = FT_DivFix( matrix->yx, temp );
- matrix->xy = FT_DivFix( matrix->xy, temp );
- matrix->yy = FT_DivFix( matrix->yy, temp );
- offset->x = FT_DivFix( offset->x, temp );
- offset->y = FT_DivFix( offset->y, temp );
- }
-
- offset->x >>= 16;
- offset->y >>= 16;
- }
-
- for ( i = cff->num_subfonts; i > 0; i-- )
- {
- CFF_FontRecDict sub = &cff->subfonts[i - 1]->font_dict;
- CFF_FontRecDict top = &cff->top_font.font_dict;
-
- FT_Matrix* matrix;
- FT_Vector* offset;
- FT_ULong* upm;
- FT_Fixed temp;
-
-
- if ( sub->units_per_em )
- {
- FT_Int scaling;
-
-
- if ( top->units_per_em > 1 && sub->units_per_em > 1 )
- scaling = FT_MIN( top->units_per_em, sub->units_per_em );
- else
- scaling = 1;
-
- FT_Matrix_Multiply_Scaled( &top->font_matrix,
- &sub->font_matrix,
- scaling );
- FT_Vector_Transform_Scaled( &sub->font_offset,
- &top->font_matrix,
- scaling );
-
- sub->units_per_em = FT_MulDiv( sub->units_per_em,
- top->units_per_em,
- scaling );
- }
- else
- {
- sub->font_matrix = top->font_matrix;
- sub->font_offset = top->font_offset;
-
- sub->units_per_em = top->units_per_em;
- }
-
- matrix = &sub->font_matrix;
- offset = &sub->font_offset;
- upm = &sub->units_per_em;
- temp = FT_ABS( matrix->yy );
-
- if ( temp != 0x10000L )
- {
- *upm = FT_DivFix( *upm, temp );
-
- /* if *upm is larger than 100*1000 we divide by 1000 -- */
- /* this can happen if e.g. there is no top-font FontMatrix */
- /* and the subfont FontMatrix already contains the complete */
- /* scaling for the subfont (see section 5.11 of the PLRM) */
-
- /* 100 is a heuristic value */
-
- if ( *upm > 100L * 1000L )
- *upm = ( *upm + 500 ) / 1000;
-
- matrix->xx = FT_DivFix( matrix->xx, temp );
- matrix->yx = FT_DivFix( matrix->yx, temp );
- matrix->xy = FT_DivFix( matrix->xy, temp );
- matrix->yy = FT_DivFix( matrix->yy, temp );
- offset->x = FT_DivFix( offset->x, temp );
- offset->y = FT_DivFix( offset->y, temp );
- }
-
- offset->x >>= 16;
- offset->y >>= 16;
- }
#ifndef FT_CONFIG_OPTION_NO_GLYPH_NAMES
/* CID-keyed CFF fonts don't have glyph names -- the SFNT loader */
@@ -826,7 +823,7 @@
cffface->face_flags |= FT_FACE_FLAG_GLYPH_NAMES;
#endif
- if ( dict->cid_registry != 0xFFFFU )
+ if ( dict->cid_registry != 0xFFFFU && pure_cff )
cffface->face_flags |= FT_FACE_FLAG_CID_KEYED;
@@ -835,7 +832,7 @@
/* Compute char maps. */
/* */
- /* Try to synthetize a Unicode charmap if there is none available */
+ /* Try to synthesize a Unicode charmap if there is none available */
/* already. If an OpenType font contains a Unicode "cmap", we */
/* will use it, whatever be in the CFF part of the file. */
{
@@ -922,10 +919,16 @@
FT_LOCAL_DEF( void )
cff_face_done( FT_Face cffface ) /* CFF_Face */
{
- CFF_Face face = (CFF_Face)cffface;
- FT_Memory memory = cffface->memory;
- SFNT_Service sfnt = (SFNT_Service)face->sfnt;
+ CFF_Face face = (CFF_Face)cffface;
+ FT_Memory memory;
+ SFNT_Service sfnt;
+
+
+ if ( !face )
+ return;
+ memory = cffface->memory;
+ sfnt = (SFNT_Service)face->sfnt;
if ( sfnt )
sfnt->done_face( face );
diff --git a/src/3rdparty/freetype/src/cff/cffparse.c b/src/3rdparty/freetype/src/cff/cffparse.c
index d6d77dd08..290595f9e 100644
--- a/src/3rdparty/freetype/src/cff/cffparse.c
+++ b/src/3rdparty/freetype/src/cff/cffparse.c
@@ -4,7 +4,7 @@
/* */
/* CFF token stream parser (body) */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2004, 2007, 2008 by */
+/* Copyright 1996-2001, 2002, 2003, 2004, 2007, 2008, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -244,7 +244,7 @@
if ( !nib && !number )
exponent_add--;
/* Only add digit if we don't overflow. */
- else if ( number < 0xCCCCCCCL )
+ else if ( number < 0xCCCCCCCL && fraction_length < 9 )
{
fraction_length++;
number = number * 10 + nib;
@@ -355,6 +355,12 @@
if ( FT_ABS( integer_length ) > 5 )
goto Exit;
+ /* Remove non-significant digits. */
+ if ( integer_length < 0 ) {
+ number /= power_tens[-integer_length];
+ fraction_length += integer_length;
+ }
+
/* Convert into 16.16 format. */
if ( fraction_length > 0 )
{
@@ -406,10 +412,9 @@
cff_parse_fixed_scaled( FT_Byte** d,
FT_Int scaling )
{
- return **d ==
- 30 ? cff_parse_real( d[0], d[1], scaling, NULL )
- : (FT_Fixed)FT_MulFix( cff_parse_integer( d[0], d[1] ) << 16,
- power_tens[scaling] );
+ return **d == 30 ? cff_parse_real( d[0], d[1], scaling, NULL )
+ : ( cff_parse_integer( d[0], d[1] ) *
+ power_tens[scaling] ) << 16;
}
diff --git a/src/3rdparty/freetype/src/cff/module.mk b/src/3rdparty/freetype/src/cff/module.mk
index 0474e37b6..ef1391c27 100644
--- a/src/3rdparty/freetype/src/cff/module.mk
+++ b/src/3rdparty/freetype/src/cff/module.mk
@@ -16,7 +16,7 @@
FTMODULE_H_COMMANDS += CFF_DRIVER
define CFF_DRIVER
-$(OPEN_DRIVER)cff_driver_class$(CLOSE_DRIVER)
+$(OPEN_DRIVER) FT_Driver_ClassRec, cff_driver_class $(CLOSE_DRIVER)
$(ECHO_DRIVER)cff $(ECHO_DRIVER_DESC)OpenType fonts with extension *.otf$(ECHO_DRIVER_DONE)
endef
diff --git a/src/3rdparty/freetype/src/cid/cidload.c b/src/3rdparty/freetype/src/cid/cidload.c
index 9ed8cee46..a43a00e01 100644
--- a/src/3rdparty/freetype/src/cid/cidload.c
+++ b/src/3rdparty/freetype/src/cid/cidload.c
@@ -4,7 +4,7 @@
/* */
/* CID-keyed Type1 font loader (body). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006 by */
+/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -97,6 +97,10 @@
object = (FT_Byte*)&cid->font_info;
break;
+ case T1_FIELD_LOCATION_FONT_EXTRA:
+ object = (FT_Byte*)&face->font_extra;
+ break;
+
case T1_FIELD_LOCATION_BBOX:
object = (FT_Byte*)&cid->font_bbox;
break;
@@ -234,14 +238,38 @@
}
+ /* by mistake, `expansion_factor' appears both in PS_PrivateRec */
+ /* and CID_FaceDictRec (both are public header files and can't */
+ /* changed); we simply copy the value */
+
+ FT_CALLBACK_DEF( FT_Error )
+ parse_expansion_factor( CID_Face face,
+ CID_Parser* parser )
+ {
+ CID_FaceDict dict;
+
+
+ if ( parser->num_dict >= 0 )
+ {
+ dict = face->cid.font_dicts + parser->num_dict;
+
+ dict->expansion_factor = cid_parser_to_fixed( parser, 0 );
+ dict->private_dict.expansion_factor = dict->expansion_factor;
+ }
+
+ return CID_Err_Ok;
+ }
+
+
static
const T1_FieldRec cid_field_records[] =
{
#include "cidtoken.h"
- T1_FIELD_CALLBACK( "FDArray", parse_fd_array, 0 )
- T1_FIELD_CALLBACK( "FontMatrix", parse_font_matrix, 0 )
+ T1_FIELD_CALLBACK( "FDArray", parse_fd_array, 0 )
+ T1_FIELD_CALLBACK( "FontMatrix", parse_font_matrix, 0 )
+ T1_FIELD_CALLBACK( "ExpansionFactor", parse_expansion_factor, 0 )
{ 0, T1_FIELD_LOCATION_CID_INFO, T1_FIELD_TYPE_NONE, 0, 0, 0, 0, 0, 0 }
};
diff --git a/src/3rdparty/freetype/src/cid/cidobjs.c b/src/3rdparty/freetype/src/cid/cidobjs.c
index 1b3bfbf74..9647d8701 100644
--- a/src/3rdparty/freetype/src/cid/cidobjs.c
+++ b/src/3rdparty/freetype/src/cid/cidobjs.c
@@ -4,7 +4,7 @@
/* */
/* CID objects manager (body). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006 by */
+/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -193,61 +193,61 @@
FT_LOCAL_DEF( void )
cid_face_done( FT_Face cidface ) /* CID_Face */
{
- CID_Face face = (CID_Face)cidface;
- FT_Memory memory;
+ CID_Face face = (CID_Face)cidface;
+ FT_Memory memory;
+ CID_FaceInfo cid;
+ PS_FontInfo info;
- if ( face )
- {
- CID_FaceInfo cid = &face->cid;
- PS_FontInfo info = &cid->font_info;
+ if ( !face )
+ return;
+ cid = &face->cid;
+ info = &cid->font_info;
+ memory = cidface->memory;
- memory = cidface->memory;
+ /* release subrs */
+ if ( face->subrs )
+ {
+ FT_Int n;
- /* release subrs */
- if ( face->subrs )
+
+ for ( n = 0; n < cid->num_dicts; n++ )
{
- FT_Int n;
+ CID_Subrs subr = face->subrs + n;
- for ( n = 0; n < cid->num_dicts; n++ )
+ if ( subr->code )
{
- CID_Subrs subr = face->subrs + n;
-
-
- if ( subr->code )
- {
- FT_FREE( subr->code[0] );
- FT_FREE( subr->code );
- }
+ FT_FREE( subr->code[0] );
+ FT_FREE( subr->code );
}
-
- FT_FREE( face->subrs );
}
- /* release FontInfo strings */
- FT_FREE( info->version );
- FT_FREE( info->notice );
- FT_FREE( info->full_name );
- FT_FREE( info->family_name );
- FT_FREE( info->weight );
+ FT_FREE( face->subrs );
+ }
- /* release font dictionaries */
- FT_FREE( cid->font_dicts );
- cid->num_dicts = 0;
+ /* release FontInfo strings */
+ FT_FREE( info->version );
+ FT_FREE( info->notice );
+ FT_FREE( info->full_name );
+ FT_FREE( info->family_name );
+ FT_FREE( info->weight );
- /* release other strings */
- FT_FREE( cid->cid_font_name );
- FT_FREE( cid->registry );
- FT_FREE( cid->ordering );
+ /* release font dictionaries */
+ FT_FREE( cid->font_dicts );
+ cid->num_dicts = 0;
- cidface->family_name = 0;
- cidface->style_name = 0;
+ /* release other strings */
+ FT_FREE( cid->cid_font_name );
+ FT_FREE( cid->registry );
+ FT_FREE( cid->ordering );
- FT_FREE( face->binary_data );
- FT_FREE( face->cid_stream );
- }
+ cidface->family_name = 0;
+ cidface->style_name = 0;
+
+ FT_FREE( face->binary_data );
+ FT_FREE( face->cid_stream );
}
@@ -324,6 +324,7 @@
goto Exit;
/* check the face index */
+ /* XXX: handle CID fonts with more than a single face */
if ( face_index != 0 )
{
FT_ERROR(( "cid_face_init: invalid face index\n" ));
diff --git a/src/3rdparty/freetype/src/cid/cidriver.c b/src/3rdparty/freetype/src/cid/cidriver.c
index 85ee6cf19..b41d5d6f0 100644
--- a/src/3rdparty/freetype/src/cid/cidriver.c
+++ b/src/3rdparty/freetype/src/cid/cidriver.c
@@ -4,7 +4,7 @@
/* */
/* CID driver interface (body). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2004, 2006, 2008 by */
+/* Copyright 1996-2001, 2002, 2003, 2004, 2006, 2008, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -74,13 +74,23 @@
PS_FontInfoRec* afont_info )
{
*afont_info = ((CID_Face)face)->cid.font_info;
- return 0;
+
+ return CID_Err_Ok;
}
+ static FT_Error
+ cid_ps_get_font_extra( FT_Face face,
+ PS_FontExtraRec* afont_extra )
+ {
+ *afont_extra = ((CID_Face)face)->font_extra;
+
+ return CID_Err_Ok;
+ }
static const FT_Service_PsInfoRec cid_service_ps_info =
{
(PS_GetFontInfoFunc) cid_ps_get_font_info,
+ (PS_GetFontExtraFunc) cid_ps_get_font_extra,
(PS_HasGlyphNamesFunc) NULL, /* unsupported with CID fonts */
(PS_GetFontPrivateFunc)NULL /* unsupported */
};
@@ -112,9 +122,42 @@
}
+ static FT_Error
+ cid_get_is_cid( CID_Face face,
+ FT_Bool *is_cid )
+ {
+ FT_Error error = CID_Err_Ok;
+ FT_UNUSED( face );
+
+
+ if ( is_cid )
+ *is_cid = 1; /* cid driver is only used for CID keyed fonts */
+
+ return error;
+ }
+
+
+ static FT_Error
+ cid_get_cid_from_glyph_index( CID_Face face,
+ FT_UInt glyph_index,
+ FT_UInt *cid )
+ {
+ FT_Error error = CID_Err_Ok;
+ FT_UNUSED( face );
+
+
+ if ( cid )
+ *cid = glyph_index; /* identity mapping */
+
+ return error;
+ }
+
+
static const FT_Service_CIDRec cid_service_cid_info =
{
- (FT_CID_GetRegistryOrderingSupplementFunc)cid_get_ros
+ (FT_CID_GetRegistryOrderingSupplementFunc)cid_get_ros,
+ (FT_CID_GetIsInternallyCIDKeyedFunc) cid_get_is_cid,
+ (FT_CID_GetCIDFromGlyphIndexFunc) cid_get_cid_from_glyph_index
};
diff --git a/src/3rdparty/freetype/src/cid/cidtoken.h b/src/3rdparty/freetype/src/cid/cidtoken.h
index ad5bbb2ee..94a3657b0 100644
--- a/src/3rdparty/freetype/src/cid/cidtoken.h
+++ b/src/3rdparty/freetype/src/cid/cidtoken.h
@@ -4,7 +4,7 @@
/* */
/* CID token definitions (specification only). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2006 by */
+/* Copyright 1996-2001, 2002, 2003, 2006, 2008, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -49,6 +49,13 @@
T1_FIELD_NUM ( "UnderlinePosition", underline_position, 0 )
T1_FIELD_NUM ( "UnderlineThickness", underline_thickness, 0 )
+#undef FT_STRUCTURE
+#define FT_STRUCTURE PS_FontExtraRec
+#undef T1CODE
+#define T1CODE T1_FIELD_LOCATION_FONT_EXTRA
+
+ T1_FIELD_NUM ( "FSType", fs_type, 0 )
+
#undef FT_STRUCTURE
#define FT_STRUCTURE CID_FaceDictRec
@@ -62,7 +69,6 @@
T1_FIELD_NUM ( "SubrCount", num_subrs, 0 )
T1_FIELD_NUM ( "lenBuildCharArray", len_buildchar, 0 )
T1_FIELD_FIXED( "ForceBoldThreshold", forcebold_threshold, 0 )
- T1_FIELD_FIXED( "ExpansionFactor", expansion_factor, 0 )
T1_FIELD_FIXED( "StrokeWidth", stroke_width, 0 )
@@ -92,6 +98,9 @@
T1_FIELD_NUM_TABLE ( "StemSnapH", snap_widths, 12, 0 )
T1_FIELD_NUM_TABLE ( "StemSnapV", snap_heights, 12, 0 )
+ T1_FIELD_BOOL ( "ForceBold", force_bold, 0 )
+
+
#undef FT_STRUCTURE
#define FT_STRUCTURE FT_BBox
#undef T1CODE
diff --git a/src/3rdparty/freetype/src/cid/module.mk b/src/3rdparty/freetype/src/cid/module.mk
index 41e5a68e5..ce30bfd7a 100644
--- a/src/3rdparty/freetype/src/cid/module.mk
+++ b/src/3rdparty/freetype/src/cid/module.mk
@@ -16,7 +16,7 @@
FTMODULE_H_COMMANDS += TYPE1CID_DRIVER
define TYPE1CID_DRIVER
-$(OPEN_DRIVER)t1cid_driver_class$(CLOSE_DRIVER)
+$(OPEN_DRIVER) FT_Driver_ClassRec, t1cid_driver_class $(CLOSE_DRIVER)
$(ECHO_DRIVER)cid $(ECHO_DRIVER_DESC)Postscript CID-keyed fonts, no known extension$(ECHO_DRIVER_DONE)
endef
diff --git a/src/3rdparty/freetype/src/gxvalid/gxvcommn.c b/src/3rdparty/freetype/src/gxvalid/gxvcommn.c
index 82fd6b3a6..46fc123fe 100644
--- a/src/3rdparty/freetype/src/gxvalid/gxvcommn.c
+++ b/src/3rdparty/freetype/src/gxvalid/gxvcommn.c
@@ -50,11 +50,11 @@
FT_UShort* b )
{
if ( *a < *b )
- return ( -1 );
+ return -1;
else if ( *a > *b )
- return ( 1 );
+ return 1;
else
- return ( 0 );
+ return 0;
}
@@ -115,11 +115,11 @@
FT_ULong* b )
{
if ( *a < *b )
- return ( -1 );
+ return -1;
else if ( *a > *b )
- return ( 1 );
+ return 1;
else
- return ( 0 );
+ return 0;
}
diff --git a/src/3rdparty/freetype/src/gxvalid/gxvcommn.h b/src/3rdparty/freetype/src/gxvalid/gxvcommn.h
index 0128eca79..198d8e4fc 100644
--- a/src/3rdparty/freetype/src/gxvalid/gxvcommn.h
+++ b/src/3rdparty/freetype/src/gxvalid/gxvcommn.h
@@ -275,11 +275,11 @@ FT_BEGIN_HEADER
#else /* !FT_DEBUG_LEVEL_TRACE */
-#define GXV_INIT do ; while ( 0 )
-#define GXV_NAME_ENTER( name ) do ; while ( 0 )
-#define GXV_EXIT do ; while ( 0 )
+#define GXV_INIT do { } while ( 0 )
+#define GXV_NAME_ENTER( name ) do { } while ( 0 )
+#define GXV_EXIT do { } while ( 0 )
-#define GXV_TRACE( s ) do ; while ( 0 )
+#define GXV_TRACE( s ) do { } while ( 0 )
#endif /* !FT_DEBUG_LEVEL_TRACE */
diff --git a/src/3rdparty/freetype/src/gxvalid/gxvmort.c b/src/3rdparty/freetype/src/gxvalid/gxvmort.c
index 6fb71b92b..f4fbd30e4 100644
--- a/src/3rdparty/freetype/src/gxvalid/gxvmort.c
+++ b/src/3rdparty/freetype/src/gxvalid/gxvmort.c
@@ -42,7 +42,7 @@
gxv_mort_feature_validate( GXV_mort_feature f,
GXV_Validator valid )
{
- if ( f->featureType > gxv_feat_registry_length )
+ if ( f->featureType >= gxv_feat_registry_length )
{
GXV_TRACE(( "featureType %d is out of registered range, "
"setting %d is unchecked\n",
diff --git a/src/3rdparty/freetype/src/gxvalid/gxvmorx.c b/src/3rdparty/freetype/src/gxvalid/gxvmorx.c
index 849d5e942..d217940ea 100644
--- a/src/3rdparty/freetype/src/gxvalid/gxvmorx.c
+++ b/src/3rdparty/freetype/src/gxvalid/gxvmorx.c
@@ -4,7 +4,8 @@
/* */
/* TrueTypeGX/AAT morx table validation (body). */
/* */
-/* Copyright 2005 by suzuki toshiya, Masatake YAMATO, Red Hat K.K., */
+/* Copyright 2005, 2008 by */
+/* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -129,7 +130,7 @@
gxv_mort_featurearray_validate( p, limit, nFeatureFlags, valid );
p += valid->subtable_length;
- if ( nSubtables >= 0x10000 )
+ if ( nSubtables >= 0x10000L )
FT_INVALID_DATA;
gxv_morx_subtables_validate( p, table + chainLength,
diff --git a/src/3rdparty/freetype/src/gxvalid/module.mk b/src/3rdparty/freetype/src/gxvalid/module.mk
index 44ef94add..9fd098e2c 100644
--- a/src/3rdparty/freetype/src/gxvalid/module.mk
+++ b/src/3rdparty/freetype/src/gxvalid/module.mk
@@ -16,7 +16,7 @@
FTMODULE_H_COMMANDS += GXVALID_MODULE
define GXVALID_MODULE
-$(OPEN_DRIVER)gxv_module_class$(CLOSE_DRIVER)
+$(OPEN_DRIVER) FT_Module_Class, gxv_module_class $(CLOSE_DRIVER)
$(ECHO_DRIVER)gxvalid $(ECHO_DRIVER_DESC)TrueTypeGX/AAT validation module$(ECHO_DRIVER_DONE)
endef
diff --git a/src/3rdparty/freetype/src/gzip/ftgzip.c b/src/3rdparty/freetype/src/gzip/ftgzip.c
index af2022d7f..0d6bd3495 100644
--- a/src/3rdparty/freetype/src/gzip/ftgzip.c
+++ b/src/3rdparty/freetype/src/gzip/ftgzip.c
@@ -8,7 +8,7 @@
/* parse compressed PCF fonts, as found with many X11 server */
/* distributions. */
/* */
-/* Copyright 2002, 2003, 2004, 2005, 2006 by */
+/* Copyright 2002, 2003, 2004, 2005, 2006, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -25,7 +25,7 @@
#include FT_INTERNAL_STREAM_H
#include FT_INTERNAL_DEBUG_H
#include FT_GZIP_H
-#include <string.h>
+#include FT_CONFIG_STANDARD_LIBRARY_H
#include FT_MODULE_ERRORS_H
@@ -569,7 +569,7 @@
if ( error )
result = 0;
- FT_Stream_Seek( stream, old_pos );
+ (void)FT_Stream_Seek( stream, old_pos );
}
return result;
diff --git a/src/3rdparty/freetype/src/gzip/inftrees.c b/src/3rdparty/freetype/src/gzip/inftrees.c
index 3c39aca6e..ef5365216 100644
--- a/src/3rdparty/freetype/src/gzip/inftrees.c
+++ b/src/3rdparty/freetype/src/gzip/inftrees.c
@@ -366,6 +366,9 @@ z_streamp z /* for messages */
if (r == Z_DATA_ERROR)
z->msg = (char*)"oversubscribed distance tree";
else if (r == Z_BUF_ERROR) {
+#if 0
+ {
+#endif
#ifdef PKZIP_BUG_WORKAROUND
r = Z_OK;
}
diff --git a/src/3rdparty/freetype/src/lzw/ftlzw.c b/src/3rdparty/freetype/src/lzw/ftlzw.c
index 45fbf7b6e..a00bd5012 100644
--- a/src/3rdparty/freetype/src/lzw/ftlzw.c
+++ b/src/3rdparty/freetype/src/lzw/ftlzw.c
@@ -8,7 +8,7 @@
/* be used to parse compressed PCF fonts, as found with many X11 server */
/* distributions. */
/* */
-/* Copyright 2004, 2005, 2006 by */
+/* Copyright 2004, 2005, 2006, 2009 by */
/* Albert Chin-A-Young. */
/* */
/* Based on code in src/gzip/ftgzip.c, Copyright 2004 by */
@@ -27,8 +27,7 @@
#include FT_INTERNAL_STREAM_H
#include FT_INTERNAL_DEBUG_H
#include FT_LZW_H
-#include <string.h>
-#include <stdio.h>
+#include FT_CONFIG_STANDARD_LIBRARY_H
#include FT_MODULE_ERRORS_H
diff --git a/src/3rdparty/freetype/src/otvalid/Jamfile b/src/3rdparty/freetype/src/otvalid/Jamfile
index 35a14c6ab..b457143de 100644
--- a/src/3rdparty/freetype/src/otvalid/Jamfile
+++ b/src/3rdparty/freetype/src/otvalid/Jamfile
@@ -16,7 +16,7 @@ SubDir FT2_TOP $(FT2_SRC_DIR) otvalid ;
if $(FT2_MULTI)
{
- _sources = otvbase otvcommn otvgdef otvgpos otvgsub otvjstf otvmod ;
+ _sources = otvbase otvcommn otvgdef otvgpos otvgsub otvjstf otvmod otvmath ;
}
else
{
diff --git a/src/3rdparty/freetype/src/otvalid/module.mk b/src/3rdparty/freetype/src/otvalid/module.mk
index aa4db047d..9cadde55e 100644
--- a/src/3rdparty/freetype/src/otvalid/module.mk
+++ b/src/3rdparty/freetype/src/otvalid/module.mk
@@ -16,7 +16,7 @@
FTMODULE_H_COMMANDS += OTVALID_MODULE
define OTVALID_MODULE
-$(OPEN_DRIVER)otv_module_class$(CLOSE_DRIVER)
+$(OPEN_DRIVER) FT_Module_Class, otv_module_class $(CLOSE_DRIVER)
$(ECHO_DRIVER)otvalid $(ECHO_DRIVER_DESC)OpenType validation module$(ECHO_DRIVER_DONE)
endef
diff --git a/src/3rdparty/freetype/src/otvalid/otvalid.h b/src/3rdparty/freetype/src/otvalid/otvalid.h
index 90255cdba..eb99b9cc4 100644
--- a/src/3rdparty/freetype/src/otvalid/otvalid.h
+++ b/src/3rdparty/freetype/src/otvalid/otvalid.h
@@ -42,6 +42,7 @@ FT_BEGIN_HEADER
otv_GDEF_validate( FT_Bytes table,
FT_Bytes gsub,
FT_Bytes gpos,
+ FT_UInt glyph_count,
FT_Validator valid );
FT_LOCAL( void )
diff --git a/src/3rdparty/freetype/src/otvalid/otvcommn.h b/src/3rdparty/freetype/src/otvalid/otvcommn.h
index 7c06b16ff..71726d5b2 100644
--- a/src/3rdparty/freetype/src/otvalid/otvcommn.h
+++ b/src/3rdparty/freetype/src/otvalid/otvcommn.h
@@ -192,12 +192,12 @@ FT_BEGIN_HEADER
valid->func[2] = OTV_FUNC( z ); \
FT_END_STMNT
-#define OTV_INIT do ; while ( 0 )
-#define OTV_ENTER do ; while ( 0 )
-#define OTV_NAME_ENTER( name ) do ; while ( 0 )
-#define OTV_EXIT do ; while ( 0 )
+#define OTV_INIT do { } while ( 0 )
+#define OTV_ENTER do { } while ( 0 )
+#define OTV_NAME_ENTER( name ) do { } while ( 0 )
+#define OTV_EXIT do { } while ( 0 )
-#define OTV_TRACE( s ) do ; while ( 0 )
+#define OTV_TRACE( s ) do { } while ( 0 )
#endif /* !FT_DEBUG_LEVEL_TRACE */
diff --git a/src/3rdparty/freetype/src/otvalid/otvgdef.c b/src/3rdparty/freetype/src/otvalid/otvgdef.c
index 77bd65165..3633ad0de 100644
--- a/src/3rdparty/freetype/src/otvalid/otvgdef.c
+++ b/src/3rdparty/freetype/src/otvalid/otvgdef.c
@@ -141,10 +141,13 @@
/*************************************************************************/
/*************************************************************************/
+ /* sets valid->glyph_count */
+
FT_LOCAL_DEF( void )
otv_GDEF_validate( FT_Bytes table,
FT_Bytes gsub,
FT_Bytes gpos,
+ FT_UInt glyph_count,
FT_Validator ftvalid )
{
OTV_ValidatorRec validrec;
@@ -183,6 +186,8 @@
else
table_size = 10; /* OpenType < 1.2 */
+ valid->glyph_count = glyph_count;
+
OTV_OPTIONAL_OFFSET( GlyphClassDef );
OTV_SIZE_CHECK( GlyphClassDef );
if ( GlyphClassDef )
diff --git a/src/3rdparty/freetype/src/otvalid/otvgpos.c b/src/3rdparty/freetype/src/otvalid/otvgpos.c
index 220f714a9..53025ec5e 100644
--- a/src/3rdparty/freetype/src/otvalid/otvgpos.c
+++ b/src/3rdparty/freetype/src/otvalid/otvgpos.c
@@ -4,7 +4,7 @@
/* */
/* OpenType GPOS table validation (body). */
/* */
-/* Copyright 2002, 2004, 2005, 2006, 2007 by */
+/* Copyright 2002, 2004, 2005, 2006, 2007, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -644,7 +644,10 @@
/*************************************************************************/
/*************************************************************************/
- /* sets valid->extra2 (0) */
+ /* UNDOCUMENTED (in OpenType 1.5): */
+ /* BaseRecord tables can contain NULL pointers. */
+
+ /* sets valid->extra2 (1) */
static void
otv_MarkBasePos_validate( FT_Bytes table,
@@ -664,7 +667,7 @@
switch ( PosFormat )
{
case 1:
- valid->extra2 = 0;
+ valid->extra2 = 1;
OTV_NEST2( MarkBasePosFormat1, BaseArray );
OTV_RUN( table, valid );
break;
diff --git a/src/3rdparty/freetype/src/otvalid/otvmath.c b/src/3rdparty/freetype/src/otvalid/otvmath.c
index b777d6a0c..50ed10cf2 100644
--- a/src/3rdparty/freetype/src/otvalid/otvmath.c
+++ b/src/3rdparty/freetype/src/otvalid/otvmath.c
@@ -4,7 +4,7 @@
/* */
/* OpenType MATH table validation (body). */
/* */
-/* Copyright 2007 by */
+/* Copyright 2007, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* Written by George Williams. */
@@ -93,6 +93,8 @@
OTV_OPTIONAL_TABLE( Coverage );
OTV_OPTIONAL_TABLE( DeviceTableOffset );
+ FT_UNUSED( isItalic ); /* only used if tracing is active */
+
OTV_NAME_ENTER( isItalic ? "MathItalicsCorrectionInfo"
: "MathTopAccentAttachment" );
diff --git a/src/3rdparty/freetype/src/otvalid/otvmod.c b/src/3rdparty/freetype/src/otvalid/otvmod.c
index c28029915..63c25f690 100644
--- a/src/3rdparty/freetype/src/otvalid/otvmod.c
+++ b/src/3rdparty/freetype/src/otvalid/otvmod.c
@@ -4,7 +4,7 @@
/* */
/* FreeType's OpenType validation module implementation (body). */
/* */
-/* Copyright 2004, 2005, 2006, 2007 by */
+/* Copyright 2004, 2005, 2006, 2007, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -168,7 +168,7 @@
{
ft_validator_init( &valid, gdef, gdef + len_gdef, FT_VALIDATE_DEFAULT );
if ( ft_setjmp( valid.jump_buffer ) == 0 )
- otv_GDEF_validate( gdef, gsub, gpos, &valid );
+ otv_GDEF_validate( gdef, gsub, gpos, face->num_glyphs, &valid );
error = valid.error;
if ( error )
goto Exit;
diff --git a/src/3rdparty/freetype/src/pcf/module.mk b/src/3rdparty/freetype/src/pcf/module.mk
index 0c51cd6fc..df383ff0f 100644
--- a/src/3rdparty/freetype/src/pcf/module.mk
+++ b/src/3rdparty/freetype/src/pcf/module.mk
@@ -27,7 +27,7 @@
FTMODULE_H_COMMANDS += PCF_DRIVER
define PCF_DRIVER
-$(OPEN_DRIVER)pcf_driver_class$(CLOSE_DRIVER)
+$(OPEN_DRIVER) FT_Driver_ClassRec, pcf_driver_class $(CLOSE_DRIVER)
$(ECHO_DRIVER)pcf $(ECHO_DRIVER_DESC)pcf bitmap fonts$(ECHO_DRIVER_DONE)
endef
diff --git a/src/3rdparty/freetype/src/pcf/pcfdrivr.c b/src/3rdparty/freetype/src/pcf/pcfdrivr.c
index 0fea30e8c..e2d4d3d87 100644
--- a/src/3rdparty/freetype/src/pcf/pcfdrivr.c
+++ b/src/3rdparty/freetype/src/pcf/pcfdrivr.c
@@ -2,7 +2,7 @@
FreeType font driver for pcf files
- Copyright (C) 2000, 2001, 2002, 2003, 2004, 2006, 2007, 2008 by
+ Copyright (C) 2000, 2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009 by
Francesco Zappa Nardelli
Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -196,10 +196,15 @@ THE SOFTWARE.
FT_CALLBACK_DEF( void )
PCF_Face_Done( FT_Face pcfface ) /* PCF_Face */
{
- PCF_Face face = (PCF_Face)pcfface;
- FT_Memory memory = FT_FACE_MEMORY( face );
+ PCF_Face face = (PCF_Face)pcfface;
+ FT_Memory memory;
+ if ( !face )
+ return;
+
+ memory = FT_FACE_MEMORY( face );
+
FT_FREE( face->encodings );
FT_FREE( face->metrics );
@@ -408,7 +413,7 @@ THE SOFTWARE.
switch ( req->type )
{
case FT_SIZE_REQUEST_TYPE_NOMINAL:
- if ( height == ( bsize->y_ppem + 32 ) >> 6 )
+ if ( height == ( ( bsize->y_ppem + 32 ) >> 6 ) )
error = PCF_Err_Ok;
break;
@@ -437,7 +442,7 @@ THE SOFTWARE.
FT_Int32 load_flags )
{
PCF_Face face = (PCF_Face)FT_SIZE_FACE( size );
- FT_Stream stream = face->root.stream;
+ FT_Stream stream;
FT_Error error = PCF_Err_Ok;
FT_Bitmap* bitmap = &slot->bitmap;
PCF_Metric metric;
@@ -454,6 +459,8 @@ THE SOFTWARE.
goto Exit;
}
+ stream = face->root.stream;
+
if ( glyph_index > 0 )
glyph_index--;
diff --git a/src/3rdparty/freetype/src/pcf/pcfread.c b/src/3rdparty/freetype/src/pcf/pcfread.c
index b9123cf57..8e04c57b3 100644
--- a/src/3rdparty/freetype/src/pcf/pcfread.c
+++ b/src/3rdparty/freetype/src/pcf/pcfread.c
@@ -2,7 +2,7 @@
FreeType font driver for pcf fonts
- Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 by
+ Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by
Francesco Zappa Nardelli
Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -48,7 +48,7 @@ THE SOFTWARE.
#define FT_COMPONENT trace_pcfread
-#if defined( FT_DEBUG_LEVEL_TRACE )
+#ifdef FT_DEBUG_LEVEL_TRACE
static const char* const tableNames[] =
{
"prop", "accl", "mtrcs", "bmps", "imtrcs",
@@ -152,7 +152,7 @@ THE SOFTWARE.
break;
}
-#if defined( FT_DEBUG_LEVEL_TRACE )
+#ifdef FT_DEBUG_LEVEL_TRACE
{
FT_UInt i, j;
@@ -470,7 +470,11 @@ THE SOFTWARE.
if ( nprops & 3 )
{
i = 4 - ( nprops & 3 );
- FT_Stream_Skip( stream, i );
+ if ( FT_STREAM_SKIP( i ) )
+ {
+ error = PCF_Err_Invalid_Stream_Skip;
+ goto Bail;
+ }
}
if ( PCF_BYTE_ORDER( format ) == MSBFirst )
@@ -623,7 +627,7 @@ THE SOFTWARE.
metrics = face->metrics;
for ( i = 0; i < nmetrics; i++ )
{
- pcf_get_metric( stream, format, metrics + i );
+ error = pcf_get_metric( stream, format, metrics + i );
metrics[i].bits = 0;
diff --git a/src/3rdparty/freetype/src/pcf/rules.mk b/src/3rdparty/freetype/src/pcf/rules.mk
index 1ad4ba897..78641528f 100644
--- a/src/3rdparty/freetype/src/pcf/rules.mk
+++ b/src/3rdparty/freetype/src/pcf/rules.mk
@@ -3,7 +3,7 @@
#
-# Copyright (C) 2000, 2001, 2003 by
+# Copyright (C) 2000, 2001, 2003, 2008 by
# Francesco Zappa Nardelli
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -35,15 +35,14 @@ PCF_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(PCF_DIR))
# pcf driver sources (i.e., C files)
#
-PCF_DRV_SRC := $(PCF_DIR)/pcfread.c \
- $(PCF_DIR)/pcfdrivr.c \
+PCF_DRV_SRC := $(PCF_DIR)/pcfdrivr.c \
+ $(PCF_DIR)/pcfread.c \
$(PCF_DIR)/pcfutil.c
# pcf driver headers
#
-PCF_DRV_H := $(PCF_DIR)/pcf.h \
- $(PCF_DIR)/pcfdrivr.h \
- $(PCF_DIR)/pcfutil.h \
+PCF_DRV_H := $(PCF_DRV_SRC:%.c=%.h) \
+ $(PCF_DIR)/pcf.h \
$(PCF_DIR)/pcferror.h
# pcf driver object(s)
diff --git a/src/3rdparty/freetype/src/pfr/module.mk b/src/3rdparty/freetype/src/pfr/module.mk
index 53ab34aa9..8d1d28a9d 100644
--- a/src/3rdparty/freetype/src/pfr/module.mk
+++ b/src/3rdparty/freetype/src/pfr/module.mk
@@ -16,7 +16,7 @@
FTMODULE_H_COMMANDS += PFR_DRIVER
define PFR_DRIVER
-$(OPEN_DRIVER)pfr_driver_class$(CLOSE_DRIVER)
+$(OPEN_DRIVER) FT_Driver_ClassRec, pfr_driver_class $(CLOSE_DRIVER)
$(ECHO_DRIVER)pfr $(ECHO_DRIVER_DESC)PFR/TrueDoc font files with extension *.pfr$(ECHO_DRIVER_DONE)
endef
diff --git a/src/3rdparty/freetype/src/pfr/pfrdrivr.c b/src/3rdparty/freetype/src/pfr/pfrdrivr.c
index 40206720e..15cca9854 100644
--- a/src/3rdparty/freetype/src/pfr/pfrdrivr.c
+++ b/src/3rdparty/freetype/src/pfr/pfrdrivr.c
@@ -4,7 +4,7 @@
/* */
/* FreeType PFR driver interface (body). */
/* */
-/* Copyright 2002, 2003, 2004, 2006 by */
+/* Copyright 2002, 2003, 2004, 2006, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -66,10 +66,16 @@
FT_Pos *anadvance )
{
PFR_Face face = (PFR_Face)pfrface;
- FT_Error error = PFR_Err_Bad_Argument;
+ FT_Error error = PFR_Err_Invalid_Argument;
*anadvance = 0;
+
+ if ( !gindex )
+ goto Exit;
+
+ gindex--;
+
if ( face )
{
PFR_PhyFont phys = &face->phy_font;
@@ -82,6 +88,7 @@
}
}
+ Exit:
return error;
}
diff --git a/src/3rdparty/freetype/src/pfr/pfrobjs.c b/src/3rdparty/freetype/src/pfr/pfrobjs.c
index 180446d73..56d617d88 100644
--- a/src/3rdparty/freetype/src/pfr/pfrobjs.c
+++ b/src/3rdparty/freetype/src/pfr/pfrobjs.c
@@ -4,7 +4,7 @@
/* */
/* FreeType PFR object methods (body). */
/* */
-/* Copyright 2002, 2003, 2004, 2005, 2006, 2007 by */
+/* Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -41,10 +41,15 @@
FT_LOCAL_DEF( void )
pfr_face_done( FT_Face pfrface ) /* PFR_Face */
{
- PFR_Face face = (PFR_Face)pfrface;
- FT_Memory memory = pfrface->driver->root.memory;
+ PFR_Face face = (PFR_Face)pfrface;
+ FT_Memory memory;
+ if ( !face )
+ return;
+
+ memory = pfrface->driver->root.memory;
+
/* we don't want dangling pointers */
pfrface->family_name = NULL;
pfrface->style_name = NULL;
diff --git a/src/3rdparty/freetype/src/psaux/afmparse.c b/src/3rdparty/freetype/src/psaux/afmparse.c
index 0528fe6ff..63a786e88 100644
--- a/src/3rdparty/freetype/src/psaux/afmparse.c
+++ b/src/3rdparty/freetype/src/psaux/afmparse.c
@@ -4,7 +4,7 @@
/* */
/* AFM parser (body). */
/* */
-/* Copyright 2006, 2007 by */
+/* Copyright 2006, 2007, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -672,7 +672,12 @@
FT_ULong index2 = KERN_INDEX( kp2->index1, kp2->index2 );
- return (int)( index1 - index2 );
+ if ( index1 > index2 )
+ return 1;
+ else if ( index1 < index2 )
+ return -1;
+ else
+ return 0;
}
diff --git a/src/3rdparty/freetype/src/psaux/module.mk b/src/3rdparty/freetype/src/psaux/module.mk
index 543152208..42bf6f519 100644
--- a/src/3rdparty/freetype/src/psaux/module.mk
+++ b/src/3rdparty/freetype/src/psaux/module.mk
@@ -16,7 +16,7 @@
FTMODULE_H_COMMANDS += PSAUX_MODULE
define PSAUX_MODULE
-$(OPEN_DRIVER)psaux_module_class$(CLOSE_DRIVER)
+$(OPEN_DRIVER) FT_Module_Class, psaux_module_class $(CLOSE_DRIVER)
$(ECHO_DRIVER)psaux $(ECHO_DRIVER_DESC)Postscript Type 1 & Type 2 helper module$(ECHO_DRIVER_DONE)
endef
diff --git a/src/3rdparty/freetype/src/psaux/psobjs.c b/src/3rdparty/freetype/src/psaux/psobjs.c
index b7b84ac83..52e30a413 100644
--- a/src/3rdparty/freetype/src/psaux/psobjs.c
+++ b/src/3rdparty/freetype/src/psaux/psobjs.c
@@ -4,7 +4,7 @@
/* */
/* Auxiliary functions for PostScript fonts (body). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by */
+/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -175,11 +175,17 @@
return PSaux_Err_Invalid_Argument;
}
+ if ( length < 0 )
+ {
+ FT_ERROR(( "ps_table_add: invalid length\n" ));
+ return PSaux_Err_Invalid_Argument;
+ }
+
/* grow the base block if needed */
if ( table->cursor + length > table->capacity )
{
FT_Error error;
- FT_Offset new_size = table->capacity;
+ FT_Offset new_size = table->capacity;
FT_Long in_offset;
@@ -376,7 +382,7 @@
/* skip octal escape or ignore backslash */
for ( i = 0; i < 3 && cur < limit; ++i )
{
- if ( ! IS_OCTAL_DIGIT( *cur ) )
+ if ( !IS_OCTAL_DIGIT( *cur ) )
break;
++cur;
@@ -1259,8 +1265,9 @@
old_cursor = parser->cursor;
old_limit = parser->limit;
- /* we store the elements count if necessary */
- if ( field->type != T1_FIELD_TYPE_BBOX )
+ /* we store the elements count if necessary; */
+ /* we further assume that `count_offset' can't be zero */
+ if ( field->type != T1_FIELD_TYPE_BBOX && field->count_offset != 0 )
*(FT_Byte*)( (FT_Byte*)objects[0] + field->count_offset ) =
(FT_Byte)num_elements;
@@ -1634,27 +1641,24 @@
t1_builder_close_contour( T1_Builder builder )
{
FT_Outline* outline = builder->current;
+ FT_Int first;
if ( !outline )
return;
- /* XXXX: We must not include the last point in the path if it */
- /* is located on the first point. */
+ first = outline->n_contours <= 1
+ ? 0 : outline->contours[outline->n_contours - 2] + 1;
+
+ /* We must not include the last point in the path if it */
+ /* is located on the first point. */
if ( outline->n_points > 1 )
{
- FT_Int first = 0;
FT_Vector* p1 = outline->points + first;
FT_Vector* p2 = outline->points + outline->n_points - 1;
FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points - 1;
- if ( outline->n_contours > 1 )
- {
- first = outline->contours[outline->n_contours - 2] + 1;
- p1 = outline->points + first;
- }
-
/* `delete' last point only if it coincides with the first */
/* point and it is not a control point (which can happen). */
if ( p1->x == p2->x && p1->y == p2->y )
@@ -1663,8 +1667,18 @@
}
if ( outline->n_contours > 0 )
- outline->contours[outline->n_contours - 1] =
- (short)( outline->n_points - 1 );
+ {
+ /* Don't add contours only consisting of one point, i.e., */
+ /* check whether begin point and last point are the same. */
+ if ( first == outline->n_points - 1 )
+ {
+ outline->n_contours--;
+ outline->n_points--;
+ }
+ else
+ outline->contours[outline->n_contours - 1] =
+ (short)( outline->n_points - 1 );
+ }
}
diff --git a/src/3rdparty/freetype/src/psaux/t1decode.c b/src/3rdparty/freetype/src/psaux/t1decode.c
index 550ba6414..bda2324d7 100644
--- a/src/3rdparty/freetype/src/psaux/t1decode.c
+++ b/src/3rdparty/freetype/src/psaux/t1decode.c
@@ -4,7 +4,7 @@
/* */
/* PostScript Type 1 decoding routines (body). */
/* */
-/* Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by */
+/* Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -354,10 +354,9 @@
( decoder->buildchar == NULL ) );
if ( decoder->len_buildchar > 0 )
- memset( &decoder->buildchar[0],
- 0,
- sizeof( decoder->buildchar[0] ) *
- decoder->len_buildchar );
+ ft_memset( &decoder->buildchar[0],
+ 0,
+ sizeof( decoder->buildchar[0] ) * decoder->len_buildchar );
FT_TRACE4(( "\nStart charstring\n" ));
@@ -777,10 +776,10 @@
idx + blend->num_designs > decoder->face->len_buildchar )
goto Unexpected_OtherSubr;
- memcpy( &decoder->buildchar[idx],
- blend->weight_vector,
- blend->num_designs *
- sizeof( blend->weight_vector[ 0 ] ) );
+ ft_memcpy( &decoder->buildchar[idx],
+ blend->weight_vector,
+ blend->num_designs *
+ sizeof( blend->weight_vector[0] ) );
}
break;
diff --git a/src/3rdparty/freetype/src/pshinter/module.mk b/src/3rdparty/freetype/src/pshinter/module.mk
index cd171d035..ed24eb7fa 100644
--- a/src/3rdparty/freetype/src/pshinter/module.mk
+++ b/src/3rdparty/freetype/src/pshinter/module.mk
@@ -16,7 +16,7 @@
FTMODULE_H_COMMANDS += PSHINTER_MODULE
define PSHINTER_MODULE
-$(OPEN_DRIVER)pshinter_module_class$(CLOSE_DRIVER)
+$(OPEN_DRIVER) FT_Module_Class, pshinter_module_class $(CLOSE_DRIVER)
$(ECHO_DRIVER)pshinter $(ECHO_DRIVER_DESC)Postscript hinter module$(ECHO_DRIVER_DONE)
endef
diff --git a/src/3rdparty/freetype/src/pshinter/pshalgo.c b/src/3rdparty/freetype/src/pshinter/pshalgo.c
index 5d7e2f490..f9ab3dae5 100644
--- a/src/3rdparty/freetype/src/pshinter/pshalgo.c
+++ b/src/3rdparty/freetype/src/pshinter/pshalgo.c
@@ -4,7 +4,7 @@
/* */
/* PostScript hinting algorithm (body). */
/* */
-/* Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by */
+/* Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used */
@@ -898,7 +898,7 @@
#ifdef DEBUG_ZONES
-#include <stdio.h>
+#include FT_CONFIG_STANDARD_LIBRARY_H
static void
psh_print_zone( PSH_Zone zone )
diff --git a/src/3rdparty/freetype/src/psnames/module.mk b/src/3rdparty/freetype/src/psnames/module.mk
index a93063b92..a6e908257 100644
--- a/src/3rdparty/freetype/src/psnames/module.mk
+++ b/src/3rdparty/freetype/src/psnames/module.mk
@@ -16,7 +16,7 @@
FTMODULE_H_COMMANDS += PSNAMES_MODULE
define PSNAMES_MODULE
-$(OPEN_DRIVER)psnames_module_class$(CLOSE_DRIVER)
+$(OPEN_DRIVER) FT_Module_Class, psnames_module_class $(CLOSE_DRIVER)
$(ECHO_DRIVER)psnames $(ECHO_DRIVER_DESC)Postscript & Unicode Glyph name handling$(ECHO_DRIVER_DONE)
endef
diff --git a/src/3rdparty/freetype/src/psnames/psmodule.c b/src/3rdparty/freetype/src/psnames/psmodule.c
index dbcfe44b1..41942a9b4 100644
--- a/src/3rdparty/freetype/src/psnames/psmodule.c
+++ b/src/3rdparty/freetype/src/psnames/psmodule.c
@@ -174,18 +174,34 @@
/* sort base glyphs before glyph variants */
if ( unicode1 == unicode2 )
- return map1->unicode - map2->unicode;
+ {
+ if ( map1->unicode > map2->unicode )
+ return 1;
+ else if ( map1->unicode < map2->unicode )
+ return -1;
+ else
+ return 0;
+ }
else
- return unicode1 - unicode2;
+ {
+ if ( unicode1 > unicode2 )
+ return 1;
+ else if ( unicode1 < unicode2 )
+ return -1;
+ else
+ return 0;
+ }
}
- /* support for old WGL4 fonts */
+ /* support for extra glyphs not handled (well) in AGL; */
+ /* we add extra mappings for them if necessary */
-#define WGL_EXTRA_LIST_SIZE 8
+#define EXTRA_GLYPH_LIST_SIZE 10
- static const FT_UInt32 ft_wgl_extra_unicodes[WGL_EXTRA_LIST_SIZE] =
+ static const FT_UInt32 ft_extra_glyph_unicodes[EXTRA_GLYPH_LIST_SIZE] =
{
+ /* WGL 4 */
0x0394,
0x03A9,
0x2215,
@@ -193,10 +209,13 @@
0x02C9,
0x03BC,
0x2219,
- 0x00A0
+ 0x00A0,
+ /* Romanian */
+ 0x021A,
+ 0x021B
};
- static const char ft_wgl_extra_glyph_names[] =
+ static const char ft_extra_glyph_names[] =
{
'D','e','l','t','a',0,
'O','m','e','g','a',0,
@@ -205,11 +224,13 @@
'm','a','c','r','o','n',0,
'm','u',0,
'p','e','r','i','o','d','c','e','n','t','e','r','e','d',0,
- 's','p','a','c','e',0
+ 's','p','a','c','e',0,
+ 'T','c','o','m','m','a','a','c','c','e','n','t',0,
+ 't','c','o','m','m','a','a','c','c','e','n','t',0
};
static const FT_Int
- ft_wgl_extra_glyph_name_offsets[WGL_EXTRA_LIST_SIZE] =
+ ft_extra_glyph_name_offsets[EXTRA_GLYPH_LIST_SIZE] =
{
0,
6,
@@ -218,29 +239,31 @@
28,
35,
38,
- 53
+ 53,
+ 59,
+ 72
};
static void
- ps_check_wgl_name( const char* gname,
- FT_UInt glyph,
- FT_UInt* wgl_glyphs,
- FT_UInt *states )
+ ps_check_extra_glyph_name( const char* gname,
+ FT_UInt glyph,
+ FT_UInt* extra_glyphs,
+ FT_UInt *states )
{
FT_UInt n;
- for ( n = 0; n < WGL_EXTRA_LIST_SIZE; n++ )
+ for ( n = 0; n < EXTRA_GLYPH_LIST_SIZE; n++ )
{
- if ( ft_strcmp( ft_wgl_extra_glyph_names +
- ft_wgl_extra_glyph_name_offsets[n], gname ) == 0 )
+ if ( ft_strcmp( ft_extra_glyph_names +
+ ft_extra_glyph_name_offsets[n], gname ) == 0 )
{
if ( states[n] == 0 )
{
- /* mark this WGL extra glyph as a candidate for the cmap */
+ /* mark this extra glyph as a candidate for the cmap */
states[n] = 1;
- wgl_glyphs[n] = glyph;
+ extra_glyphs[n] = glyph;
}
return;
@@ -250,17 +273,17 @@
static void
- ps_check_wgl_unicode( FT_UInt32 uni_char,
- FT_UInt *states )
+ ps_check_extra_glyph_unicode( FT_UInt32 uni_char,
+ FT_UInt *states )
{
FT_UInt n;
- for ( n = 0; n < WGL_EXTRA_LIST_SIZE; n++ )
+ for ( n = 0; n < EXTRA_GLYPH_LIST_SIZE; n++ )
{
- if ( uni_char == ft_wgl_extra_unicodes[n] )
+ if ( uni_char == ft_extra_glyph_unicodes[n] )
{
- /* disable this WGL extra glyph from being added to the cmap */
+ /* disable this extra glyph from being added to the cmap */
states[n] = 2;
return;
@@ -280,15 +303,15 @@
{
FT_Error error;
- FT_UInt wgl_list_states[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
- FT_UInt wgl_glyphs[WGL_EXTRA_LIST_SIZE];
+ FT_UInt extra_glyph_list_states[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
+ FT_UInt extra_glyphs[EXTRA_GLYPH_LIST_SIZE];
/* we first allocate the table */
table->num_maps = 0;
table->maps = 0;
- if ( !FT_NEW_ARRAY( table->maps, num_glyphs + WGL_EXTRA_LIST_SIZE ) )
+ if ( !FT_NEW_ARRAY( table->maps, num_glyphs + EXTRA_GLYPH_LIST_SIZE ) )
{
FT_UInt n;
FT_UInt count;
@@ -305,12 +328,14 @@
if ( gname )
{
- ps_check_wgl_name( gname, n, wgl_glyphs, wgl_list_states );
+ ps_check_extra_glyph_name( gname, n,
+ extra_glyphs, extra_glyph_list_states );
uni_char = ps_unicode_value( gname );
if ( BASE_GLYPH( uni_char ) != 0 )
{
- ps_check_wgl_unicode( uni_char, wgl_list_states );
+ ps_check_extra_glyph_unicode( uni_char,
+ extra_glyph_list_states );
map->unicode = uni_char;
map->glyph_index = n;
map++;
@@ -321,15 +346,15 @@
}
}
- for ( n = 0; n < WGL_EXTRA_LIST_SIZE; n++ )
+ for ( n = 0; n < EXTRA_GLYPH_LIST_SIZE; n++ )
{
- if ( wgl_list_states[n] == 1 )
+ if ( extra_glyph_list_states[n] == 1 )
{
- /* This glyph name has an additional WGL4 representation. */
- /* Add it to the cmap. */
+ /* This glyph name has an additional representation. */
+ /* Add it to the cmap. */
- map->unicode = ft_wgl_extra_unicodes[n];
- map->glyph_index = wgl_glyphs[n];
+ map->unicode = ft_extra_glyph_unicodes[n];
+ map->glyph_index = extra_glyphs[n];
map++;
}
}
diff --git a/src/3rdparty/freetype/src/psnames/pstables.h b/src/3rdparty/freetype/src/psnames/pstables.h
index cc40ef735..1521e9c28 100644
--- a/src/3rdparty/freetype/src/psnames/pstables.h
+++ b/src/3rdparty/freetype/src/psnames/pstables.h
@@ -4,7 +4,7 @@
/* */
/* PostScript glyph names. */
/* */
-/* Copyright 2005 by */
+/* Copyright 2005, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -561,7 +561,10 @@
* The lookup function to get the Unicode value for a given string
* is defined below the table.
*/
- static const unsigned char ft_adobe_glyph_list[54791] =
+
+#ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST
+
+ static const unsigned char ft_adobe_glyph_list[54791L] =
{
0, 52, 0,106, 2,167, 3, 63, 4,220, 6,125, 9,143, 10, 23,
11,137, 12,199, 14,246, 15, 87, 16,233, 17,219, 18,104, 19, 88,
@@ -4086,5 +4089,7 @@
return 0;
}
+#endif /* FT_CONFIG_OPTION_ADOBE_GLYPH_LIST */
+
/* END */
diff --git a/src/3rdparty/freetype/src/raster/ftmisc.h b/src/3rdparty/freetype/src/raster/ftmisc.h
index c5dbd50d0..d9d73e337 100644
--- a/src/3rdparty/freetype/src/raster/ftmisc.h
+++ b/src/3rdparty/freetype/src/raster/ftmisc.h
@@ -5,7 +5,7 @@
/* Miscellaneous macros for stand-alone rasterizer (specification */
/* only). */
/* */
-/* Copyright 2005 by */
+/* Copyright 2005, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used */
@@ -27,7 +27,8 @@
#ifndef __FTMISC_H__
#define __FTMISC_H__
-#include <string.h> /* memset */
+ /* memset */
+#include FT_CONFIG_STANDARD_LIBRARY_H
#define FT_BEGIN_HEADER
#define FT_END_HEADER
diff --git a/src/3rdparty/freetype/src/raster/ftraster.c b/src/3rdparty/freetype/src/raster/ftraster.c
index 86d77d4b7..eb9c4a45f 100644
--- a/src/3rdparty/freetype/src/raster/ftraster.c
+++ b/src/3rdparty/freetype/src/raster/ftraster.c
@@ -4,7 +4,7 @@
/* */
/* The FreeType glyph rasterizer (body). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2005, 2007, 2008 by */
+/* Copyright 1996-2001, 2002, 2003, 2005, 2007, 2008, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -181,13 +181,13 @@
/* Disable the tracing mechanism for simplicity -- developers can */
/* activate it easily by redefining these two macros. */
#ifndef FT_ERROR
-#define FT_ERROR( x ) do ; while ( 0 ) /* nothing */
+#define FT_ERROR( x ) do { } while ( 0 ) /* nothing */
#endif
#ifndef FT_TRACE
-#define FT_TRACE( x ) do ; while ( 0 ) /* nothing */
-#define FT_TRACE1( x ) do ; while ( 0 ) /* nothing */
-#define FT_TRACE6( x ) do ; while ( 0 ) /* nothing */
+#define FT_TRACE( x ) do { } while ( 0 ) /* nothing */
+#define FT_TRACE1( x ) do { } while ( 0 ) /* nothing */
+#define FT_TRACE6( x ) do { } while ( 0 ) /* nothing */
#endif
#define Raster_Err_None 0
@@ -370,7 +370,7 @@
#define RAS_VARS /* void */
#define RAS_VAR /* void */
-#define FT_UNUSED_RASTER do ; while ( 0 )
+#define FT_UNUSED_RASTER do { } while ( 0 )
#else /* FT_STATIC_RASTER */
@@ -388,7 +388,7 @@
#endif /* FT_STATIC_RASTER */
- typedef struct TWorker_ TWorker, *PWorker;
+ typedef struct TWorker_ TWorker, *PWorker;
/* prototypes used for sweep function dispatch */
@@ -518,7 +518,7 @@
};
- typedef struct TRaster_
+ typedef struct TRaster_
{
char* buffer;
long buffer_size;
@@ -531,7 +531,7 @@
#ifdef FT_STATIC_RASTER
- static TWorker cur_ras;
+ static TWorker cur_ras;
#define ras cur_ras
#else
@@ -543,24 +543,25 @@
#ifdef FT_RASTER_OPTION_ANTI_ALIASING
-static const char count_table[256] =
-{
- 0 , 1 , 1 , 2 , 1 , 2 , 2 , 3 , 1 , 2 , 2 , 3 , 2 , 3 , 3 , 4,
- 1 , 2 , 2 , 3 , 2 , 3 , 3 , 4 , 2 , 3 , 3 , 4 , 3 , 4 , 4 , 5,
- 1 , 2 , 2 , 3 , 2 , 3 , 3 , 4 , 2 , 3 , 3 , 4 , 3 , 4 , 4 , 5,
- 2 , 3 , 3 , 4 , 3 , 4 , 4 , 5 , 3 , 4 , 4 , 5 , 4 , 5 , 5 , 6,
- 1 , 2 , 2 , 3 , 2 , 3 , 3 , 4 , 2 , 3 , 3 , 4 , 3 , 4 , 4 , 5,
- 2 , 3 , 3 , 4 , 3 , 4 , 4 , 5 , 3 , 4 , 4 , 5 , 4 , 5 , 5 , 6,
- 2 , 3 , 3 , 4 , 3 , 4 , 4 , 5 , 3 , 4 , 4 , 5 , 4 , 5 , 5 , 6,
- 3 , 4 , 4 , 5 , 4 , 5 , 5 , 6 , 4 , 5 , 5 , 6 , 5 , 6 , 6 , 7,
- 1 , 2 , 2 , 3 , 2 , 3 , 3 , 4 , 2 , 3 , 3 , 4 , 3 , 4 , 4 , 5,
- 2 , 3 , 3 , 4 , 3 , 4 , 4 , 5 , 3 , 4 , 4 , 5 , 4 , 5 , 5 , 6,
- 2 , 3 , 3 , 4 , 3 , 4 , 4 , 5 , 3 , 4 , 4 , 5 , 4 , 5 , 5 , 6,
- 3 , 4 , 4 , 5 , 4 , 5 , 5 , 6 , 4 , 5 , 5 , 6 , 5 , 6 , 6 , 7,
- 2 , 3 , 3 , 4 , 3 , 4 , 4 , 5 , 3 , 4 , 4 , 5 , 4 , 5 , 5 , 6,
- 3 , 4 , 4 , 5 , 4 , 5 , 5 , 6 , 4 , 5 , 5 , 6 , 5 , 6 , 6 , 7,
- 3 , 4 , 4 , 5 , 4 , 5 , 5 , 6 , 4 , 5 , 5 , 6 , 5 , 6 , 6 , 7,
- 4 , 5 , 5 , 6 , 5 , 6 , 6 , 7 , 5 , 6 , 6 , 7 , 6 , 7 , 7 , 8 };
+ static const char count_table[256] =
+ {
+ 0 , 1 , 1 , 2 , 1 , 2 , 2 , 3 , 1 , 2 , 2 , 3 , 2 , 3 , 3 , 4,
+ 1 , 2 , 2 , 3 , 2 , 3 , 3 , 4 , 2 , 3 , 3 , 4 , 3 , 4 , 4 , 5,
+ 1 , 2 , 2 , 3 , 2 , 3 , 3 , 4 , 2 , 3 , 3 , 4 , 3 , 4 , 4 , 5,
+ 2 , 3 , 3 , 4 , 3 , 4 , 4 , 5 , 3 , 4 , 4 , 5 , 4 , 5 , 5 , 6,
+ 1 , 2 , 2 , 3 , 2 , 3 , 3 , 4 , 2 , 3 , 3 , 4 , 3 , 4 , 4 , 5,
+ 2 , 3 , 3 , 4 , 3 , 4 , 4 , 5 , 3 , 4 , 4 , 5 , 4 , 5 , 5 , 6,
+ 2 , 3 , 3 , 4 , 3 , 4 , 4 , 5 , 3 , 4 , 4 , 5 , 4 , 5 , 5 , 6,
+ 3 , 4 , 4 , 5 , 4 , 5 , 5 , 6 , 4 , 5 , 5 , 6 , 5 , 6 , 6 , 7,
+ 1 , 2 , 2 , 3 , 2 , 3 , 3 , 4 , 2 , 3 , 3 , 4 , 3 , 4 , 4 , 5,
+ 2 , 3 , 3 , 4 , 3 , 4 , 4 , 5 , 3 , 4 , 4 , 5 , 4 , 5 , 5 , 6,
+ 2 , 3 , 3 , 4 , 3 , 4 , 4 , 5 , 3 , 4 , 4 , 5 , 4 , 5 , 5 , 6,
+ 3 , 4 , 4 , 5 , 4 , 5 , 5 , 6 , 4 , 5 , 5 , 6 , 5 , 6 , 6 , 7,
+ 2 , 3 , 3 , 4 , 3 , 4 , 4 , 5 , 3 , 4 , 4 , 5 , 4 , 5 , 5 , 6,
+ 3 , 4 , 4 , 5 , 4 , 5 , 5 , 6 , 4 , 5 , 5 , 6 , 5 , 6 , 6 , 7,
+ 3 , 4 , 4 , 5 , 4 , 5 , 5 , 6 , 4 , 5 , 5 , 6 , 5 , 6 , 6 , 7,
+ 4 , 5 , 5 , 6 , 5 , 6 , 6 , 7 , 5 , 6 , 6 , 7 , 6 , 7 , 7 , 8
+a };
#endif /* FT_RASTER_OPTION_ANTI_ALIASING */
@@ -581,7 +582,7 @@ static const char count_table[256] =
/* Set_High_Precision */
/* */
/* <Description> */
- /* Sets precision variables according to param flag. */
+ /* Set precision variables according to param flag. */
/* */
/* <Input> */
/* High :: Set to True for high precision (typically for ppem < 18), */
@@ -618,7 +619,7 @@ static const char count_table[256] =
/* New_Profile */
/* */
/* <Description> */
- /* Creates a new profile in the render pool. */
+ /* Create a new profile in the render pool. */
/* */
/* <Input> */
/* aState :: The state/orientation of the new profile. */
@@ -684,7 +685,7 @@ static const char count_table[256] =
/* End_Profile */
/* */
/* <Description> */
- /* Finalizes the current profile. */
+ /* Finalize the current profile. */
/* */
/* <Return> */
/* SUCCESS on success. FAILURE in case of overflow or incoherency. */
@@ -741,7 +742,7 @@ static const char count_table[256] =
/* Insert_Y_Turn */
/* */
/* <Description> */
- /* Inserts a salient into the sorted list placed on top of the render */
+ /* Insert a salient into the sorted list placed on top of the render */
/* pool. */
/* */
/* <Input> */
@@ -796,7 +797,7 @@ static const char count_table[256] =
/* Finalize_Profile_Table */
/* */
/* <Description> */
- /* Adjusts all links in the profiles list. */
+ /* Adjust all links in the profiles list. */
/* */
/* <Return> */
/* SUCCESS on success. FAILURE in case of overflow. */
@@ -810,10 +811,10 @@ static const char count_table[256] =
n = ras.num_Profs;
+ p = ras.fProfile;
- if ( n > 1 )
+ if ( n > 1 && p )
{
- p = ras.fProfile;
while ( n > 0 )
{
if ( n > 1 )
@@ -857,7 +858,7 @@ static const char count_table[256] =
/* Split_Conic */
/* */
/* <Description> */
- /* Subdivides one conic Bezier into two joint sub-arcs in the Bezier */
+ /* Subdivide one conic Bezier into two joint sub-arcs in the Bezier */
/* stack. */
/* */
/* <Input> */
@@ -896,7 +897,7 @@ static const char count_table[256] =
/* Split_Cubic */
/* */
/* <Description> */
- /* Subdivides a third-order Bezier arc into two joint sub-arcs in the */
+ /* Subdivide a third-order Bezier arc into two joint sub-arcs in the */
/* Bezier stack. */
/* */
/* <Note> */
@@ -938,7 +939,7 @@ static const char count_table[256] =
/* Line_Up */
/* */
/* <Description> */
- /* Computes the x-coordinates of an ascending line segment and stores */
+ /* Compute the x-coordinates of an ascending line segment and store */
/* them in the render pool. */
/* */
/* <Input> */
@@ -1077,8 +1078,8 @@ static const char count_table[256] =
/* Line_Down */
/* */
/* <Description> */
- /* Computes the x-coordinates of an descending line segment and */
- /* stores them in the render pool. */
+ /* Compute the x-coordinates of an descending line segment and store */
+ /* them in the render pool. */
/* */
/* <Input> */
/* x1 :: The x-coordinate of the segment's start point. */
@@ -1128,7 +1129,7 @@ static const char count_table[256] =
/* Bezier_Up */
/* */
/* <Description> */
- /* Computes the x-coordinates of an ascending Bezier arc and stores */
+ /* Compute the x-coordinates of an ascending Bezier arc and store */
/* them in the render pool. */
/* */
/* <Input> */
@@ -1261,7 +1262,7 @@ static const char count_table[256] =
/* Bezier_Down */
/* */
/* <Description> */
- /* Computes the x-coordinates of an descending Bezier arc and stores */
+ /* Compute the x-coordinates of an descending Bezier arc and store */
/* them in the render pool. */
/* */
/* <Input> */
@@ -1310,7 +1311,7 @@ static const char count_table[256] =
/* Line_To */
/* */
/* <Description> */
- /* Injects a new line segment and adjusts Profiles list. */
+ /* Inject a new line segment and adjust the Profiles list. */
/* */
/* <Input> */
/* x :: The x-coordinate of the segment's end point (its start point */
@@ -1400,7 +1401,7 @@ static const char count_table[256] =
/* Conic_To */
/* */
/* <Description> */
- /* Injects a new conic arc and adjusts the profile list. */
+ /* Inject a new conic arc and adjust the profile list. */
/* */
/* <Input> */
/* cx :: The x-coordinate of the arc's new control point. */
@@ -1510,7 +1511,7 @@ static const char count_table[256] =
/* Cubic_To */
/* */
/* <Description> */
- /* Injects a new cubic arc and adjusts the profile list. */
+ /* Inject a new cubic arc and adjust the profile list. */
/* */
/* <Input> */
/* cx1 :: The x-coordinate of the arc's first new control point. */
@@ -1648,7 +1649,7 @@ static const char count_table[256] =
/* Decompose_Curve */
/* */
/* <Description> */
- /* Scans the outline arrays in order to emit individual segments and */
+ /* Scan the outline arrays in order to emit individual segments and */
/* Beziers by calling Line_To() and Bezier_To(). It handles all */
/* weird cases, like when the first point is off the curve, or when */
/* there are simply no `on' points in the contour! */
@@ -1869,7 +1870,7 @@ static const char count_table[256] =
/* Convert_Glyph */
/* */
/* <Description> */
- /* Converts a glyph into a series of segments and arcs and makes a */
+ /* Convert a glyph into a series of segments and arcs and make a */
/* profiles list with them. */
/* */
/* <Input> */
@@ -2150,8 +2151,10 @@ static const char count_table[256] =
f1 = (Byte) ( 0xFF >> ( e1 & 7 ) );
f2 = (Byte) ~( 0x7F >> ( e2 & 7 ) );
- if ( ras.gray_min_x > c1 ) ras.gray_min_x = (short)c1;
- if ( ras.gray_max_x < c2 ) ras.gray_max_x = (short)c2;
+ if ( ras.gray_min_x > c1 )
+ ras.gray_min_x = (short)c1;
+ if ( ras.gray_max_x < c2 )
+ ras.gray_max_x = (short)c2;
target = ras.bTarget + ras.traceOfs + c1;
c2 -= c1;
@@ -2184,14 +2187,36 @@ static const char count_table[256] =
PProfile left,
PProfile right )
{
- Long e1, e2;
+ Long e1, e2, pxl;
Short c1, f1;
/* Drop-out control */
- e1 = CEILING( x1 );
- e2 = FLOOR ( x2 );
+ /* e2 x2 x1 e1 */
+ /* */
+ /* ^ | */
+ /* | | */
+ /* +-------------+---------------------+------------+ */
+ /* | | */
+ /* | v */
+ /* */
+ /* pixel contour contour pixel */
+ /* center center */
+
+ /* drop-out mode scan conversion rules (as defined in OpenType) */
+ /* --------------------------------------------------------------- */
+ /* 0 1, 2, 3 */
+ /* 1 1, 2, 4 */
+ /* 2 1, 2 */
+ /* 3 same as mode 2 */
+ /* 4 1, 2, 5 */
+ /* 5 1, 2, 6 */
+ /* 6, 7 same as mode 2 */
+
+ e1 = CEILING( x1 );
+ e2 = FLOOR ( x2 );
+ pxl = e1;
if ( e1 > e2 )
{
@@ -2199,19 +2224,20 @@ static const char count_table[256] =
{
switch ( ras.dropOutControl )
{
- case 1:
- e1 = e2;
+ case 0: /* simple drop-outs including stubs */
+ pxl = e2;
break;
- case 4:
- e1 = CEILING( (x1 + x2 + 1) / 2 );
+ case 4: /* smart drop-outs including stubs */
+ pxl = FLOOR( ( x1 + x2 + 1 ) / 2 + ras.precision_half );
break;
- case 2:
- case 5:
- /* Drop-out Control Rule #4 */
+ case 1: /* simple drop-outs excluding stubs */
+ case 5: /* smart drop-outs excluding stubs */
+
+ /* Drop-out Control Rules #4 and #6 */
- /* The spec is not very clear regarding rule #4. It */
+ /* The spec is not very clear regarding those rules. It */
/* presents a method that is way too costly to implement */
/* while the general idea seems to get rid of `stubs'. */
/* */
@@ -2233,7 +2259,6 @@ static const char count_table[256] =
/* FIXXXME: uncommenting this line solves the disappearing */
/* bit problem in the `7' of verdana 10pts, but */
/* makes a new one in the `C' of arial 14pts */
-
#if 0
if ( x2 - x1 < ras.precision_half )
#endif
@@ -2247,41 +2272,43 @@ static const char count_table[256] =
return;
}
- /* check that the rightmost pixel isn't set */
-
- e1 = TRUNC( e1 );
+ if ( ras.dropOutControl == 1 )
+ pxl = e2;
+ else
+ pxl = FLOOR( ( x1 + x2 + 1 ) / 2 + ras.precision_half );
+ break;
- c1 = (Short)( e1 >> 3 );
- f1 = (Short)( e1 & 7 );
+ default: /* modes 2, 3, 6, 7 */
+ return; /* no drop-out control */
+ }
- if ( e1 >= 0 && e1 < ras.bWidth &&
- ras.bTarget[ras.traceOfs + c1] & ( 0x80 >> f1 ) )
- return;
+ /* check that the other pixel isn't set */
+ e1 = pxl == e1 ? e2 : e1;
- if ( ras.dropOutControl == 2 )
- e1 = e2;
- else
- e1 = CEILING( ( x1 + x2 + 1 ) / 2 );
+ e1 = TRUNC( e1 );
- break;
+ c1 = (Short)( e1 >> 3 );
+ f1 = (Short)( e1 & 7 );
- default:
- return; /* unsupported mode */
- }
+ if ( e1 >= 0 && e1 < ras.bWidth &&
+ ras.bTarget[ras.traceOfs + c1] & ( 0x80 >> f1 ) )
+ return;
}
else
return;
}
- e1 = TRUNC( e1 );
+ e1 = TRUNC( pxl );
if ( e1 >= 0 && e1 < ras.bWidth )
{
c1 = (Short)( e1 >> 3 );
f1 = (Short)( e1 & 7 );
- if ( ras.gray_min_x > c1 ) ras.gray_min_x = c1;
- if ( ras.gray_max_x < c1 ) ras.gray_max_x = c1;
+ if ( ras.gray_min_x > c1 )
+ ras.gray_min_x = c1;
+ if ( ras.gray_max_x < c1 )
+ ras.gray_max_x = c1;
ras.bTarget[ras.traceOfs + c1] |= (char)( 0x80 >> f1 );
}
@@ -2365,15 +2392,26 @@ static const char count_table[256] =
PProfile left,
PProfile right )
{
- Long e1, e2;
+ Long e1, e2, pxl;
PByte bits;
Byte f1;
/* During the horizontal sweep, we only take care of drop-outs */
- e1 = CEILING( x1 );
- e2 = FLOOR ( x2 );
+ /* e1 + <-- pixel center */
+ /* | */
+ /* x1 ---+--> <-- contour */
+ /* | */
+ /* | */
+ /* x2 <--+--- <-- contour */
+ /* | */
+ /* | */
+ /* e2 + <-- pixel center */
+
+ e1 = CEILING( x1 );
+ e2 = FLOOR ( x2 );
+ pxl = e1;
if ( e1 > e2 )
{
@@ -2381,23 +2419,17 @@ static const char count_table[256] =
{
switch ( ras.dropOutControl )
{
- case 1:
- e1 = e2;
+ case 0: /* simple drop-outs including stubs */
+ pxl = e2;
break;
- case 4:
- e1 = CEILING( ( x1 + x2 + 1 ) / 2 );
+ case 4: /* smart drop-outs including stubs */
+ pxl = FLOOR( ( x1 + x2 + 1 ) / 2 + ras.precision_half );
break;
- case 2:
- case 5:
-
- /* Drop-out Control Rule #4 */
-
- /* The spec is not very clear regarding rule #4. It */
- /* presents a method that is way too costly to implement */
- /* while the general idea seems to get rid of `stubs'. */
- /* */
+ case 1: /* simple drop-outs excluding stubs */
+ case 5: /* smart drop-outs excluding stubs */
+ /* see Vertical_Sweep_Drop for details */
/* rightmost stub test */
if ( left->next == right && left->height <= 0 )
@@ -2407,32 +2439,32 @@ static const char count_table[256] =
if ( right->next == left && left->start == y )
return;
- /* check that the rightmost pixel isn't set */
-
- e1 = TRUNC( e1 );
+ if ( ras.dropOutControl == 1 )
+ pxl = e2;
+ else
+ pxl = FLOOR( ( x1 + x2 + 1 ) / 2 + ras.precision_half );
+ break;
- bits = ras.bTarget + ( y >> 3 );
- f1 = (Byte)( 0x80 >> ( y & 7 ) );
+ default: /* modes 2, 3, 6, 7 */
+ return; /* no drop-out control */
+ }
- bits -= e1 * ras.target.pitch;
- if ( ras.target.pitch > 0 )
- bits += ( ras.target.rows - 1 ) * ras.target.pitch;
+ /* check that the other pixel isn't set */
+ e1 = pxl == e1 ? e2 : e1;
- if ( e1 >= 0 &&
- e1 < ras.target.rows &&
- *bits & f1 )
- return;
+ e1 = TRUNC( e1 );
- if ( ras.dropOutControl == 2 )
- e1 = e2;
- else
- e1 = CEILING( ( x1 + x2 + 1 ) / 2 );
+ bits = ras.bTarget + ( y >> 3 );
+ f1 = (Byte)( 0x80 >> ( y & 7 ) );
- break;
+ bits -= e1 * ras.target.pitch;
+ if ( ras.target.pitch > 0 )
+ bits += ( ras.target.rows - 1 ) * ras.target.pitch;
- default:
- return; /* unsupported mode */
- }
+ if ( e1 >= 0 &&
+ e1 < ras.target.rows &&
+ *bits & f1 )
+ return;
}
else
return;
@@ -2441,7 +2473,7 @@ static const char count_table[256] =
bits = ras.bTarget + ( y >> 3 );
f1 = (Byte)( 0x80 >> ( y & 7 ) );
- e1 = TRUNC( e1 );
+ e1 = TRUNC( pxl );
if ( e1 >= 0 && e1 < ras.target.rows )
{
@@ -2526,10 +2558,10 @@ static const char count_table[256] =
if ( ras.gray_max_x >= 0 )
{
- Long last_pixel = ras.target.width - 1;
- Int last_cell = last_pixel >> 2;
- Int last_bit = last_pixel & 3;
- Bool over = 0;
+ Long last_pixel = ras.target.width - 1;
+ Int last_cell = last_pixel >> 2;
+ Int last_bit = last_pixel & 3;
+ Bool over = 0;
if ( ras.gray_max_x >= last_cell && last_bit != 3 )
@@ -2541,8 +2573,8 @@ static const char count_table[256] =
if ( ras.gray_min_x < 0 )
ras.gray_min_x = 0;
- bit = ras.bTarget + ras.gray_min_x;
- bit2 = bit + ras.gray_width;
+ bit = ras.bTarget + ras.gray_min_x;
+ bit2 = bit + ras.gray_width;
c1 = ras.gray_max_x - ras.gray_min_x;
@@ -2627,6 +2659,7 @@ static const char count_table[256] =
/* During the horizontal sweep, we only take care of drop-outs */
+
e1 = CEILING( x1 );
e2 = FLOOR ( x2 );
@@ -2636,23 +2669,17 @@ static const char count_table[256] =
{
switch ( ras.dropOutControl )
{
- case 1:
+ case 0: /* simple drop-outs including stubs */
e1 = e2;
break;
- case 4:
- e1 = CEILING( ( x1 + x2 + 1 ) / 2 );
+ case 4: /* smart drop-outs including stubs */
+ e1 = FLOOR( ( x1 + x2 + 1 ) / 2 + ras.precision_half );
break;
- case 2:
- case 5:
-
- /* Drop-out Control Rule #4 */
-
- /* The spec is not very clear regarding rule #4. It */
- /* presents a method that is way too costly to implement */
- /* while the general idea seems to get rid of `stubs'. */
- /* */
+ case 1: /* simple drop-outs excluding stubs */
+ case 5: /* smart drop-outs excluding stubs */
+ /* see Vertical_Sweep_Drop for details */
/* rightmost stub test */
if ( left->next == right && left->height <= 0 )
@@ -2662,15 +2689,15 @@ static const char count_table[256] =
if ( right->next == left && left->start == y )
return;
- if ( ras.dropOutControl == 2 )
+ if ( ras.dropOutControl == 1 )
e1 = e2;
else
- e1 = CEILING( ( x1 + x2 + 1 ) / 2 );
+ e1 = FLOOR( ( x1 + x2 + 1 ) / 2 + ras.precision_half );
break;
- default:
- return; /* unsupported mode */
+ default: /* modes 2, 3, 6, 7 */
+ return; /* no drop-out control */
}
}
else
@@ -2722,7 +2749,7 @@ static const char count_table[256] =
TProfileList draw_left, draw_right;
- /* Init empty linked lists */
+ /* initialize empty linked lists */
Init_Linked( &waiting );
@@ -2742,8 +2769,10 @@ static const char count_table[256] =
bottom = (Short)P->start;
top = (Short)( P->start + P->height - 1 );
- if ( min_Y > bottom ) min_Y = bottom;
- if ( max_Y < top ) max_Y = top;
+ if ( min_Y > bottom )
+ min_Y = bottom;
+ if ( max_Y < top )
+ max_Y = top;
P->X = 0;
InsNew( &waiting, P );
@@ -2751,18 +2780,18 @@ static const char count_table[256] =
P = Q;
}
- /* Check the Y-turns */
+ /* check the Y-turns */
if ( ras.numTurns == 0 )
{
ras.error = Raster_Err_Invalid;
return FAILURE;
}
- /* Now inits the sweep */
+ /* now initialize the sweep */
ras.Proc_Sweep_Init( RAS_VARS &min_Y, &max_Y );
- /* Then compute the distance of each profile from min_Y */
+ /* then compute the distance of each profile from min_Y */
P = waiting;
@@ -2772,7 +2801,7 @@ static const char count_table[256] =
P = P->link;
}
- /* Let's go */
+ /* let's go */
y = min_Y;
y_height = 0;
@@ -2783,7 +2812,7 @@ static const char count_table[256] =
while ( ras.numTurns > 0 )
{
- /* look in the waiting list for new activations */
+ /* check waiting list for new activations */
P = waiting;
@@ -2810,7 +2839,7 @@ static const char count_table[256] =
P = Q;
}
- /* Sort the drawing lists */
+ /* sort the drawing lists */
Sort( &draw_left );
Sort( &draw_right );
@@ -2820,7 +2849,7 @@ static const char count_table[256] =
while ( y < y_change )
{
- /* Let's trace */
+ /* let's trace */
dropouts = 0;
@@ -2839,22 +2868,25 @@ static const char count_table[256] =
x2 = xs;
}
- if ( x2 - x1 <= ras.precision )
- {
- e1 = FLOOR( x1 );
- e2 = CEILING( x2 );
+ e1 = FLOOR( x1 );
+ e2 = CEILING( x2 );
- if ( ras.dropOutControl != 0 &&
- ( e1 > e2 || e2 == e1 + ras.precision ) )
+ if ( x2 - x1 <= ras.precision &&
+ e1 != x1 && e2 != x2 )
+ {
+ if ( e1 > e2 || e2 == e1 + ras.precision )
{
- /* a drop out was detected */
+ if ( ras.dropOutControl != 2 )
+ {
+ /* a drop-out was detected */
- P_Left ->X = x1;
- P_Right->X = x2;
+ P_Left ->X = x1;
+ P_Right->X = x2;
- /* mark profile for drop-out processing */
- P_Left->countL = 1;
- dropouts++;
+ /* mark profile for drop-out processing */
+ P_Left->countL = 1;
+ dropouts++;
+ }
goto Skip_To_Next;
}
@@ -2868,9 +2900,9 @@ static const char count_table[256] =
P_Right = P_Right->link;
}
- /* now perform the dropouts _after_ the span drawing -- */
- /* drop-outs processing has been moved out of the loop */
- /* for performance tuning */
+ /* handle drop-outs _after_ the span drawing -- */
+ /* drop-out processing has been moved out of the loop */
+ /* for performance tuning */
if ( dropouts > 0 )
goto Scan_DropOuts;
@@ -2887,7 +2919,7 @@ static const char count_table[256] =
}
}
- /* Now finalize the profiles that needs it */
+ /* now finalize the profiles that need it */
P = draw_left;
while ( P )
@@ -2908,7 +2940,7 @@ static const char count_table[256] =
}
}
- /* for gray-scaling, flushes the bitmap scanline cache */
+ /* for gray-scaling, flush the bitmap scanline cache */
while ( y <= max_Y )
{
ras.Proc_Sweep_Step( RAS_VAR );
@@ -2951,7 +2983,7 @@ static const char count_table[256] =
/* Render_Single_Pass */
/* */
/* <Description> */
- /* Performs one sweep with sub-banding. */
+ /* Perform one sweep with sub-banding. */
/* */
/* <Input> */
/* flipped :: If set, flip the direction of the outline. */
@@ -3026,7 +3058,7 @@ static const char count_table[256] =
/* Render_Glyph */
/* */
/* <Description> */
- /* Renders a glyph in a bitmap. Sub-banding if needed. */
+ /* Render a glyph in a bitmap. Sub-banding if needed. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
@@ -3039,13 +3071,23 @@ static const char count_table[256] =
Set_High_Precision( RAS_VARS ras.outline.flags &
FT_OUTLINE_HIGH_PRECISION );
- ras.scale_shift = ras.precision_shift;
- /* Drop-out mode 2 is hard-coded since this is the only mode used */
- /* on Windows platforms. Using other modes, as specified by the */
- /* font, results in misplaced pixels. */
- ras.dropOutControl = 2;
- ras.second_pass = (FT_Byte)( !( ras.outline.flags &
- FT_OUTLINE_SINGLE_PASS ) );
+ ras.scale_shift = ras.precision_shift;
+
+ if ( ras.outline.flags & FT_OUTLINE_IGNORE_DROPOUTS )
+ ras.dropOutControl = 2;
+ else
+ {
+ if ( ras.outline.flags & FT_OUTLINE_SMART_DROPOUTS )
+ ras.dropOutControl = 4;
+ else
+ ras.dropOutControl = 0;
+
+ if ( !( ras.outline.flags & FT_OUTLINE_INCLUDE_STUBS ) )
+ ras.dropOutControl += 1;
+ }
+
+ ras.second_pass = (FT_Byte)( !( ras.outline.flags &
+ FT_OUTLINE_SINGLE_PASS ) );
/* Vertical Sweep */
ras.Proc_Sweep_Init = Vertical_Sweep_Init;
@@ -3064,7 +3106,7 @@ static const char count_table[256] =
return error;
/* Horizontal Sweep */
- if ( ras.second_pass && ras.dropOutControl != 0 )
+ if ( ras.second_pass && ras.dropOutControl != 2 )
{
ras.Proc_Sweep_Init = Horizontal_Sweep_Init;
ras.Proc_Sweep_Span = Horizontal_Sweep_Span;
@@ -3085,14 +3127,13 @@ static const char count_table[256] =
#ifdef FT_RASTER_OPTION_ANTI_ALIASING
-
/*************************************************************************/
/* */
/* <Function> */
/* Render_Gray_Glyph */
/* */
/* <Description> */
- /* Renders a glyph with grayscaling. Sub-banding if needed. */
+ /* Render a glyph with grayscaling. Sub-banding if needed. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
@@ -3106,12 +3147,22 @@ static const char count_table[256] =
Set_High_Precision( RAS_VARS ras.outline.flags &
FT_OUTLINE_HIGH_PRECISION );
- ras.scale_shift = ras.precision_shift + 1;
- /* Drop-out mode 2 is hard-coded since this is the only mode used */
- /* on Windows platforms. Using other modes, as specified by the */
- /* font, results in misplaced pixels. */
- ras.dropOutControl = 2;
- ras.second_pass = !( ras.outline.flags & FT_OUTLINE_SINGLE_PASS );
+ ras.scale_shift = ras.precision_shift + 1;
+
+ if ( ras.outline.flags & FT_OUTLINE_IGNORE_DROPOUTS )
+ ras.dropOutControl = 2;
+ else
+ {
+ if ( ras.outline.flags & FT_OUTLINE_SMART_DROPOUTS )
+ ras.dropOutControl = 4;
+ else
+ ras.dropOutControl = 0;
+
+ if ( !( ras.outline.flags & FT_OUTLINE_INCLUDE_STUBS ) )
+ ras.dropOutControl += 1;
+ }
+
+ ras.second_pass = !( ras.outline.flags & FT_OUTLINE_SINGLE_PASS );
/* Vertical Sweep */
@@ -3139,7 +3190,7 @@ static const char count_table[256] =
return error;
/* Horizontal Sweep */
- if ( ras.second_pass && ras.dropOutControl != 0 )
+ if ( ras.second_pass && ras.dropOutControl != 2 )
{
ras.Proc_Sweep_Init = Horizontal_Sweep_Init;
ras.Proc_Sweep_Span = Horizontal_Gray_Sweep_Span;
@@ -3198,7 +3249,7 @@ static const char count_table[256] =
static int
- ft_black_new( void* memory,
+ ft_black_new( void* memory,
FT_Raster *araster )
{
static TRaster the_raster;
@@ -3256,9 +3307,9 @@ static const char count_table[256] =
static void
- ft_black_reset( PRaster raster,
- char* pool_base,
- long pool_size )
+ ft_black_reset( PRaster raster,
+ char* pool_base,
+ long pool_size )
{
if ( raster )
{
@@ -3283,9 +3334,9 @@ static const char count_table[256] =
static void
- ft_black_set_mode( PRaster raster,
- unsigned long mode,
- const char* palette )
+ ft_black_set_mode( PRaster raster,
+ unsigned long mode,
+ const char* palette )
{
#ifdef FT_RASTER_OPTION_ANTI_ALIASING
@@ -3351,15 +3402,15 @@ static const char count_table[256] =
if ( !target_map->buffer )
return Raster_Err_Invalid;
- ras.outline = *outline;
- ras.target = *target_map;
+ ras.outline = *outline;
+ ras.target = *target_map;
- worker->buff = (PLong) raster->buffer;
- worker->sizeBuff = worker->buff +
- raster->buffer_size / sizeof ( Long );
+ worker->buff = (PLong) raster->buffer;
+ worker->sizeBuff = worker->buff +
+ raster->buffer_size / sizeof ( Long );
#ifdef FT_RASTER_OPTION_ANTI_ALIASING
- worker->grays = raster->grays;
- worker->gray_width = raster->gray_width;
+ worker->grays = raster->grays;
+ worker->gray_width = raster->gray_width;
#endif
return ( ( params->flags & FT_RASTER_FLAG_AA )
diff --git a/src/3rdparty/freetype/src/raster/module.mk b/src/3rdparty/freetype/src/raster/module.mk
index 59c737b93..cbff5df96 100644
--- a/src/3rdparty/freetype/src/raster/module.mk
+++ b/src/3rdparty/freetype/src/raster/module.mk
@@ -16,7 +16,7 @@
FTMODULE_H_COMMANDS += RASTER_MODULE
define RASTER_MODULE
-$(OPEN_DRIVER)ft_raster1_renderer_class$(CLOSE_DRIVER)
+$(OPEN_DRIVER) FT_Renderer_Class, ft_raster1_renderer_class $(CLOSE_DRIVER)
$(ECHO_DRIVER)raster $(ECHO_DRIVER_DESC)monochrome bitmap renderer$(ECHO_DRIVER_DONE)
endef
diff --git a/src/3rdparty/freetype/src/raster/rules.mk b/src/3rdparty/freetype/src/raster/rules.mk
index 0dc8782ea..43a9af2b7 100644
--- a/src/3rdparty/freetype/src/raster/rules.mk
+++ b/src/3rdparty/freetype/src/raster/rules.mk
@@ -3,7 +3,7 @@
#
-# Copyright 1996-2000, 2001, 2003 by
+# Copyright 1996-2000, 2001, 2003, 2008 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
@@ -31,6 +31,7 @@ RASTER_DRV_SRC := $(RASTER_DIR)/ftraster.c \
# raster driver headers
#
RASTER_DRV_H := $(RASTER_DRV_SRC:%.c=%.h) \
+ $(RASTER_DIR)/ftmisc.h \
$(RASTER_DIR)/rasterrs.h
diff --git a/src/3rdparty/freetype/src/sfnt/Jamfile b/src/3rdparty/freetype/src/sfnt/Jamfile
index 6b8a40182..ad467bebe 100644
--- a/src/3rdparty/freetype/src/sfnt/Jamfile
+++ b/src/3rdparty/freetype/src/sfnt/Jamfile
@@ -16,7 +16,7 @@ SubDir FT2_TOP $(FT2_SRC_DIR) sfnt ;
if $(FT2_MULTI)
{
- _sources = sfobjs sfdriver ttcmap ttpost ttload ttsbit ttkern ttbdf ;
+ _sources = sfobjs sfdriver ttcmap ttmtx ttpost ttload ttsbit ttkern ttbdf ;
}
else
{
diff --git a/src/3rdparty/freetype/src/sfnt/module.mk b/src/3rdparty/freetype/src/sfnt/module.mk
index d33913809..95fd6a314 100644
--- a/src/3rdparty/freetype/src/sfnt/module.mk
+++ b/src/3rdparty/freetype/src/sfnt/module.mk
@@ -16,7 +16,7 @@
FTMODULE_H_COMMANDS += SFNT_MODULE
define SFNT_MODULE
-$(OPEN_DRIVER)sfnt_module_class$(CLOSE_DRIVER)
+$(OPEN_DRIVER) FT_Module_Class, sfnt_module_class $(CLOSE_DRIVER)
$(ECHO_DRIVER)sfnt $(ECHO_DRIVER_DESC)helper module for TrueType & OpenType formats$(ECHO_DRIVER_DONE)
endef
diff --git a/src/3rdparty/freetype/src/sfnt/rules.mk b/src/3rdparty/freetype/src/sfnt/rules.mk
index ff7840e7f..abda74fca 100644
--- a/src/3rdparty/freetype/src/sfnt/rules.mk
+++ b/src/3rdparty/freetype/src/sfnt/rules.mk
@@ -3,7 +3,7 @@
#
-# Copyright 1996-2000, 2002, 2003, 2004, 2005, 2006, 2007 by
+# Copyright 1996-2000, 2002, 2003, 2004, 2005, 2006, 2007, 2009 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
@@ -37,8 +37,11 @@ SFNT_DRV_SRC := $(SFNT_DIR)/ttload.c \
# SFNT driver headers
#
-SFNT_DRV_H := $(SFNT_DRV_SRC:%c=%h) \
- $(SFNT_DIR)/sferrors.h
+# Note that ttsbit0.c gets #included by ttsbit.c.
+#
+SFNT_DRV_H := $(SFNT_DRV_SRC:%c=%h) \
+ $(SFNT_DIR)/sferrors.h \
+ $(SFNT_DIR)/ttsbit0.c
# SFNT driver object(s)
diff --git a/src/3rdparty/freetype/src/sfnt/sfdriver.c b/src/3rdparty/freetype/src/sfnt/sfdriver.c
index 5ba22a6c5..142ef767d 100644
--- a/src/3rdparty/freetype/src/sfnt/sfdriver.c
+++ b/src/3rdparty/freetype/src/sfnt/sfdriver.c
@@ -4,7 +4,7 @@
/* */
/* High-level SFNT driver interface (body). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by */
+/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -151,10 +151,35 @@
}
+ static FT_UInt
+ sfnt_get_name_index( TT_Face face,
+ FT_String* glyph_name )
+ {
+ FT_Face root = &face->root;
+ FT_Long i;
+
+
+ for ( i = 0; i < root->num_glyphs; i++ )
+ {
+ FT_String* gname;
+ FT_Error error = tt_face_get_ps_name( face, i, &gname );
+
+
+ if ( error )
+ continue;
+
+ if ( !ft_strcmp( glyph_name, gname ) )
+ return (FT_UInt)i;
+ }
+
+ return 0;
+ }
+
+
static const FT_Service_GlyphDictRec sfnt_service_glyph_dict =
{
(FT_GlyphDict_GetNameFunc) sfnt_get_glyph_name,
- (FT_GlyphDict_NameIndexFunc)NULL
+ (FT_GlyphDict_NameIndexFunc)sfnt_get_name_index
};
#endif /* TT_CONFIG_OPTION_POSTSCRIPT_NAMES */
diff --git a/src/3rdparty/freetype/src/sfnt/sfobjs.c b/src/3rdparty/freetype/src/sfnt/sfobjs.c
index c25b87d8d..c826b92aa 100644
--- a/src/3rdparty/freetype/src/sfnt/sfobjs.c
+++ b/src/3rdparty/freetype/src/sfnt/sfobjs.c
@@ -123,14 +123,20 @@
/* */
/* nameid :: The name id of the name record to return. */
/* */
+ /* <InOut> */
+ /* name :: The address of a string pointer. NULL if no name is */
+ /* present. */
+ /* */
/* <Return> */
- /* Character string. NULL if no name is present. */
+ /* FreeType error code. 0 means success. */
/* */
- static FT_String*
- tt_face_get_name( TT_Face face,
- FT_UShort nameid )
+ static FT_Error
+ tt_face_get_name( TT_Face face,
+ FT_UShort nameid,
+ FT_String** name )
{
FT_Memory memory = face->root.memory;
+ FT_Error error = SFNT_Err_Ok;
FT_String* result = NULL;
FT_UShort n;
TT_NameEntryRec* rec;
@@ -145,6 +151,8 @@
TT_NameEntry_ConvertFunc convert;
+ FT_ASSERT( name );
+
rec = face->name_table.names;
for ( n = 0; n < face->num_names; n++, rec++ )
{
@@ -256,11 +264,8 @@
{
if ( rec->string == NULL )
{
- FT_Error error = SFNT_Err_Ok;
FT_Stream stream = face->name_table.stream;
- FT_UNUSED( error );
-
if ( FT_QNEW_ARRAY ( rec->string, rec->stringLength ) ||
FT_STREAM_SEEK( rec->stringOffset ) ||
@@ -277,7 +282,8 @@
}
Exit:
- return result;
+ *name = result;
+ return error;
}
@@ -363,11 +369,12 @@
if ( FT_READ_ULONG( tag ) )
return error;
- if ( tag != 0x00010000UL &&
- tag != TTAG_ttcf &&
- tag != FT_MAKE_TAG( 'O', 'T', 'T', 'O' ) &&
- tag != TTAG_true &&
- tag != 0x00020000UL )
+ if ( tag != 0x00010000UL &&
+ tag != TTAG_ttcf &&
+ tag != TTAG_OTTO &&
+ tag != TTAG_true &&
+ tag != TTAG_typ1 &&
+ tag != 0x00020000UL )
return SFNT_Err_Unknown_File_Format;
face->ttc_header.tag = TTAG_ttcf;
@@ -401,7 +408,7 @@
face->ttc_header.version = 1 << 16;
face->ttc_header.count = 1;
- if ( FT_NEW( face->ttc_header.offsets) )
+ if ( FT_NEW( face->ttc_header.offsets ) )
return error;
face->ttc_header.offsets[0] = offset;
@@ -451,7 +458,7 @@
face_index = 0;
if ( face_index >= face->ttc_header.count )
- return SFNT_Err_Bad_Argument;
+ return SFNT_Err_Invalid_Argument;
if ( FT_STREAM_SEEK( face->ttc_header.offsets[face_index] ) )
return error;
@@ -461,7 +468,8 @@
if ( error )
return error;
- face->root.num_faces = face->ttc_header.count;
+ face->root.num_faces = face->ttc_header.count;
+ face->root.face_index = face_index;
return error;
}
@@ -498,6 +506,13 @@
FT_TRACE3(( "\n" )); \
} while ( 0 )
+#define GET_NAME( id, field ) \
+ do { \
+ error = tt_face_get_name( face, TT_NAME_ID_##id, field ); \
+ if ( error ) \
+ goto Exit; \
+ } while ( 0 )
+
FT_LOCAL_DEF( FT_Error )
sfnt_load_face( FT_Stream stream,
@@ -506,7 +521,10 @@
FT_Int num_params,
FT_Parameter* params )
{
- FT_Error error, psnames_error;
+ FT_Error error;
+#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
+ FT_Error psnames_error;
+#endif
FT_Bool has_outline;
FT_Bool is_apple_sbit;
@@ -581,7 +599,10 @@
/* don't check for errors */
LOAD_( name );
LOAD_( post );
+
+#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
psnames_error = error;
+#endif
/* do not load the metrics headers and tables if this is an Apple */
/* sbit font file */
@@ -660,19 +681,20 @@
face->os2.version = 0xFFFFU;
}
-
}
/* the optional tables */
- /* embedded bitmap support. */
+ /* embedded bitmap support */
if ( sfnt->load_eblc )
{
LOAD_( eblc );
if ( error )
{
- /* return an error if this font file has no outlines */
- if ( error == SFNT_Err_Table_Missing && has_outline )
+ /* a font which contains neither bitmaps nor outlines is */
+ /* still valid (although rather useless in most cases); */
+ /* however, you can find such stripped fonts in PDFs */
+ if ( error == SFNT_Err_Table_Missing )
error = SFNT_Err_Ok;
else
goto Exit;
@@ -692,59 +714,38 @@
LOAD_( gasp );
LOAD_( kern );
- error = SFNT_Err_Ok;
-
face->root.num_glyphs = face->max_profile.numGlyphs;
-#if 0
/* Bit 8 of the `fsSelection' field in the `OS/2' table denotes */
/* a WWS-only font face. `WWS' stands for `weight', width', and */
/* `slope', a term used by Microsoft's Windows Presentation */
- /* Foundation (WPF). This flag will be introduced in version */
- /* 1.5 of the OpenType specification (but is already in use). */
+ /* Foundation (WPF). This flag has been introduced in version */
+ /* 1.5 of the OpenType specification (May 2008). */
if ( face->os2.version != 0xFFFFU && face->os2.fsSelection & 256 )
-#endif
{
- face->root.family_name =
- tt_face_get_name( face, TT_NAME_ID_PREFERRED_FAMILY );
+ GET_NAME( PREFERRED_FAMILY, &face->root.family_name );
if ( !face->root.family_name )
- face->root.family_name =
- tt_face_get_name( face, TT_NAME_ID_FONT_FAMILY );
+ GET_NAME( FONT_FAMILY, &face->root.family_name );
- face->root.style_name =
- tt_face_get_name( face, TT_NAME_ID_PREFERRED_SUBFAMILY );
+ GET_NAME( PREFERRED_SUBFAMILY, &face->root.style_name );
if ( !face->root.style_name )
- face->root.style_name =
- tt_face_get_name( face, TT_NAME_ID_FONT_SUBFAMILY );
+ GET_NAME( FONT_SUBFAMILY, &face->root.style_name );
}
-#if 0
else
{
- /* Support for `name' table ID 21 (WWS family) and 22 (WWS */
- /* subfamily) is still under consideration by Microsoft and */
- /* not implemented in the current version of WPF. */
-
- face->root.family_name =
- tt_face_get_name( face, TT_NAME_ID_WWS_FAMILY );
+ GET_NAME( WWS_FAMILY, &face->root.family_name );
if ( !face->root.family_name )
- face->root.family_name =
- tt_face_get_name( face, TT_NAME_ID_PREFERRED_FAMILY );
+ GET_NAME( PREFERRED_FAMILY, &face->root.family_name );
if ( !face->root.family_name )
- face->root.family_name =
- tt_face_get_name( face, TT_NAME_ID_FONT_FAMILY );
+ GET_NAME( FONT_FAMILY, &face->root.family_name );
- face->root.style_name =
- tt_face_get_name( face, TT_NAME_ID_WWS_SUBFAMILY );
+ GET_NAME( WWS_SUBFAMILY, &face->root.style_name );
if ( !face->root.style_name )
- face->root.style_name =
- tt_face_get_name( face, TT_NAME_ID_PREFERRED_SUBFAMILY );
+ GET_NAME( PREFERRED_SUBFAMILY, &face->root.style_name );
if ( !face->root.style_name )
- face->root.style_name =
- tt_face_get_name( face, TT_NAME_ID_FONT_SUBFAMILY );
+ GET_NAME( FONT_SUBFAMILY, &face->root.style_name );
}
-#endif
-
/* now set up root fields */
{
@@ -801,10 +802,9 @@
flags = 0;
if ( has_outline == TRUE && face->os2.version != 0xFFFFU )
{
- /* We have an OS/2 table; use the `fsSelection' field. Bit 9 */
- /* indicates an oblique font face. This flag will be */
- /* introduced in version 1.5 of the OpenType specification (but */
- /* is already in use). */
+ /* We have an OS/2 table; use the `fsSelection' field. Bit 9 */
+ /* indicates an oblique font face. This flag has been */
+ /* introduced in version 1.5 of the OpenType specification. */
if ( face->os2.fsSelection & 512 ) /* bit 9 */
flags |= FT_STYLE_FLAG_ITALIC;
@@ -817,6 +817,7 @@
else
{
/* this is an old Mac font, use the header field */
+
if ( face->header.Mac_Style & 1 )
flags |= FT_STYLE_FLAG_BOLD;
@@ -861,12 +862,78 @@
}
}
+#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
+
+ /*
+ * Now allocate the root array of FT_Bitmap_Size records and
+ * populate them. Unfortunately, it isn't possible to indicate bit
+ * depths in the FT_Bitmap_Size record. This is a design error.
+ */
+ {
+ FT_UInt i, count;
+
+
+#ifndef FT_CONFIG_OPTION_OLD_INTERNALS
+ count = face->sbit_num_strikes;
+#else
+ count = (FT_UInt)face->num_sbit_strikes;
+#endif
+
+ if ( count > 0 )
+ {
+ FT_Memory memory = face->root.stream->memory;
+ FT_UShort em_size = face->header.Units_Per_EM;
+ FT_Short avgwidth = face->os2.xAvgCharWidth;
+ FT_Size_Metrics metrics;
+
+
+ if ( em_size == 0 || face->os2.version == 0xFFFFU )
+ {
+ avgwidth = 0;
+ em_size = 1;
+ }
+
+ if ( FT_NEW_ARRAY( root->available_sizes, count ) )
+ goto Exit;
+
+ for ( i = 0; i < count; i++ )
+ {
+ FT_Bitmap_Size* bsize = root->available_sizes + i;
+
+
+ error = sfnt->load_strike_metrics( face, i, &metrics );
+ if ( error )
+ goto Exit;
+
+ bsize->height = (FT_Short)( metrics.height >> 6 );
+ bsize->width = (FT_Short)(
+ ( avgwidth * metrics.x_ppem + em_size / 2 ) / em_size );
+
+ bsize->x_ppem = metrics.x_ppem << 6;
+ bsize->y_ppem = metrics.y_ppem << 6;
+
+ /* assume 72dpi */
+ bsize->size = metrics.y_ppem << 6;
+ }
+
+ root->face_flags |= FT_FACE_FLAG_FIXED_SIZES;
+ root->num_fixed_sizes = (FT_Int)count;
+ }
+ }
+
+#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
+
+ /* a font with no bitmaps and no outlines is scalable; */
+ /* it has only empty glyphs then */
+ if ( !FT_HAS_FIXED_SIZES( root ) && !FT_IS_SCALABLE( root ) )
+ root->face_flags |= FT_FACE_FLAG_SCALABLE;
+
/*********************************************************************/
/* */
/* Set up metrics. */
/* */
- if ( has_outline == TRUE )
+ if ( FT_IS_SCALABLE( root ) )
{
/* XXX What about if outline header is missing */
/* (e.g. sfnt wrapped bitmap)? */
@@ -919,10 +986,9 @@
/* this computation is based on various versions of Times New Roman */
if ( face->horizontal.Line_Gap == 0 )
root->height = (FT_Short)( ( root->height * 115 + 50 ) / 100 );
-#endif
+#endif /* 0 */
#if 0
-
/* some fonts have the OS/2 "sTypoAscender", "sTypoDescender" & */
/* "sTypoLineGap" fields set to 0, like ARIALNB.TTF */
if ( face->os2.version != 0xFFFFU && root->ascender )
@@ -937,80 +1003,21 @@
if ( height > root->height )
root->height = height;
}
-
#endif /* 0 */
- root->max_advance_width = face->horizontal.advance_Width_Max;
+ root->max_advance_width = face->horizontal.advance_Width_Max;
+ root->max_advance_height = (FT_Short)( face->vertical_info
+ ? face->vertical.advance_Height_Max
+ : root->height );
- root->max_advance_height = (FT_Short)( face->vertical_info
- ? face->vertical.advance_Height_Max
- : root->height );
-
- root->underline_position = face->postscript.underlinePosition;
+ /* See http://www.microsoft.com/OpenType/OTSpec/post.htm -- */
+ /* Adjust underline position from top edge to centre of */
+ /* stroke to convert TrueType meaning to FreeType meaning. */
+ root->underline_position = face->postscript.underlinePosition -
+ face->postscript.underlineThickness / 2;
root->underline_thickness = face->postscript.underlineThickness;
}
-#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
-
- /*
- * Now allocate the root array of FT_Bitmap_Size records and
- * populate them. Unfortunately, it isn't possible to indicate bit
- * depths in the FT_Bitmap_Size record. This is a design error.
- */
- {
- FT_UInt i, count;
-
-
-#if !defined FT_CONFIG_OPTION_OLD_INTERNALS
- count = face->sbit_num_strikes;
-#else
- count = (FT_UInt)face->num_sbit_strikes;
-#endif
-
- if ( count > 0 )
- {
- FT_Memory memory = face->root.stream->memory;
- FT_UShort em_size = face->header.Units_Per_EM;
- FT_Short avgwidth = face->os2.xAvgCharWidth;
- FT_Size_Metrics metrics;
-
-
- if ( em_size == 0 || face->os2.version == 0xFFFFU )
- {
- avgwidth = 0;
- em_size = 1;
- }
-
- if ( FT_NEW_ARRAY( root->available_sizes, count ) )
- goto Exit;
-
- for ( i = 0; i < count; i++ )
- {
- FT_Bitmap_Size* bsize = root->available_sizes + i;
-
-
- error = sfnt->load_strike_metrics( face, i, &metrics );
- if ( error )
- goto Exit;
-
- bsize->height = (FT_Short)( metrics.height >> 6 );
- bsize->width = (FT_Short)(
- ( avgwidth * metrics.x_ppem + em_size / 2 ) / em_size );
-
- bsize->x_ppem = metrics.x_ppem << 6;
- bsize->y_ppem = metrics.y_ppem << 6;
-
- /* assume 72dpi */
- bsize->size = metrics.y_ppem << 6;
- }
-
- root->face_flags |= FT_FACE_FLAG_FIXED_SIZES;
- root->num_fixed_sizes = (FT_Int)count;
- }
- }
-
-#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
-
}
Exit:
@@ -1022,14 +1029,21 @@
#undef LOAD_
#undef LOADM_
+#undef GET_NAME
FT_LOCAL_DEF( void )
sfnt_done_face( TT_Face face )
{
- FT_Memory memory = face->root.memory;
- SFNT_Service sfnt = (SFNT_Service)face->sfnt;
+ FT_Memory memory;
+ SFNT_Service sfnt;
+
+
+ if ( !face )
+ return;
+ memory = face->root.memory;
+ sfnt = (SFNT_Service)face->sfnt;
if ( sfnt )
{
@@ -1068,7 +1082,7 @@
}
/* freeing the horizontal metrics */
-#if !defined FT_CONFIG_OPTION_OLD_INTERNALS
+#ifndef FT_CONFIG_OPTION_OLD_INTERNALS
{
FT_Stream stream = FT_FACE_STREAM( face );
diff --git a/src/3rdparty/freetype/src/sfnt/ttcmap.c b/src/3rdparty/freetype/src/sfnt/ttcmap.c
index b70b64c1f..683039153 100644
--- a/src/3rdparty/freetype/src/sfnt/ttcmap.c
+++ b/src/3rdparty/freetype/src/sfnt/ttcmap.c
@@ -4,7 +4,7 @@
/* */
/* TrueType character mapping table (cmap) support (body). */
/* */
-/* Copyright 2002, 2003, 2004, 2005, 2006, 2007 by */
+/* Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -134,7 +134,7 @@
FT_UInt gindex = 0;
- table += 6; /* go to glyph ids */
+ table += 6; /* go to glyph IDs */
while ( ++charcode < 256 )
{
gindex = table[charcode];
@@ -231,7 +231,7 @@
/* language 4 USHORT Mac language code */
/* keys 6 USHORT[256] sub-header keys */
/* subs 518 SUBHEAD[NSUBS] sub-headers array */
- /* glyph_ids 518+NSUB*8 USHORT[] glyph id array */
+ /* glyph_ids 518+NSUB*8 USHORT[] glyph ID array */
/* */
/* The `keys' table is used to map charcode high-bytes to sub-headers. */
/* The value of `NSUBS' is the number of sub-headers defined in the */
@@ -260,14 +260,14 @@
/* */
/* * The value of `offset' is read. This is a _byte_ distance from the */
/* location of the `offset' field itself into a slice of the */
- /* `glyph_ids' table. Let's call it `slice' (it's a USHORT[] too). */
+ /* `glyph_ids' table. Let's call it `slice' (it is a USHORT[] too). */
/* */
/* * The value `slice[char.lo - first]' is read. If it is 0, there is */
/* no glyph for the charcode. Otherwise, the value of `delta' is */
/* added to it (modulo 65536) to form a new glyph index. */
/* */
/* It is up to the validation routine to check that all offsets fall */
- /* within the glyph ids table (and not within the `subs' table itself or */
+ /* within the glyph IDs table (and not within the `subs' table itself or */
/* outside of the CMap). */
/* */
@@ -282,7 +282,7 @@
FT_UInt n, max_subs;
FT_Byte* keys; /* keys table */
FT_Byte* subs; /* sub-headers */
- FT_Byte* glyph_ids; /* glyph id array */
+ FT_Byte* glyph_ids; /* glyph ID array */
if ( table + length > valid->limit || length < 6 + 512 )
@@ -328,6 +328,10 @@
delta = TT_NEXT_SHORT( p );
offset = TT_NEXT_USHORT( p );
+ /* many Dynalab fonts have empty sub-headers */
+ if ( code_count == 0 )
+ continue;
+
/* check range within 0..255 */
if ( valid->level >= FT_VALIDATE_PARANOID )
{
@@ -342,7 +346,7 @@
if ( ids < glyph_ids || ids + code_count*2 > table + length )
FT_INVALID_OFFSET;
- /* check glyph ids */
+ /* check glyph IDs */
if ( valid->level >= FT_VALIDATE_TIGHT )
{
FT_Byte* limit = p + code_count * 2;
@@ -393,7 +397,7 @@
sub = subs; /* jump to first sub-header */
/* check that the sub-header for this byte is 0, which */
- /* indicates that it's really a valid one-byte value */
+ /* indicates that it is really a valid one-byte value */
/* Otherwise, return 0 */
/* */
p += char_lo * 2;
@@ -601,14 +605,14 @@
/* each segment; can be */
/* zero */
/* */
- /* glyphIds 16+NUM_SEGS*8 USHORT[] array of glyph id */
+ /* glyphIds 16+NUM_SEGS*8 USHORT[] array of glyph ID */
/* ranges */
/* */
/* Character codes are modelled by a series of ordered (increasing) */
/* intervals called segments. Each segment has start and end codes, */
/* provided by the `startCount' and `endCount' arrays. Segments must */
- /* not be overlapping and the last segment should always contain the */
- /* `0xFFFF' endCount. */
+ /* not overlap, and the last segment should always contain the value */
+ /* 0xFFFF for `endCount'. */
/* */
/* The fields `searchRange', `entrySelector' and `rangeShift' are better */
/* ignored (they are traces of over-engineering in the TrueType */
@@ -621,14 +625,14 @@
/* charcode within the segment is obtained by adding the value of */
/* `idDelta' directly to the charcode, modulo 65536. */
/* */
- /* Otherwise, a glyph index is taken from the glyph ids sub-array for */
+ /* Otherwise, a glyph index is taken from the glyph IDs sub-array for */
/* the segment, and the value of `idDelta' is added to it. */
/* */
/* */
- /* Finally, note that certain fonts contain invalid charmaps that */
- /* contain end=0xFFFF, start=0xFFFF, delta=0x0001, offset=0xFFFF at the */
- /* of their charmaps (e.g. opens___.ttf which comes with OpenOffice.org) */
- /* we need special code to deal with them correctly... */
+ /* Finally, note that a lot of fonts contain an invalid last segment, */
+ /* where `start' and `end' are correctly set to 0xFFFF but both `delta' */
+ /* and `offset' are incorrect (e.g., `opens___.ttf' which comes with */
+ /* OpenOffice.org). We need special code to deal with them correctly. */
/* */
#ifdef TT_CONFIG_CMAP_FORMAT_4
@@ -693,6 +697,23 @@
p += num_ranges * 2;
offset = FT_PEEK_USHORT( p );
+ /* some fonts have an incorrect last segment; */
+ /* we have to catch it */
+ if ( range_index >= num_ranges - 1 &&
+ cmap->cur_start == 0xFFFFU &&
+ cmap->cur_end == 0xFFFFU )
+ {
+ TT_Face face = (TT_Face)cmap->cmap.cmap.charmap.face;
+ FT_Byte* limit = face->cmap_table + face->cmap_size;
+
+
+ if ( offset && p + offset + 2 > limit )
+ {
+ cmap->cur_delta = 1;
+ offset = 0;
+ }
+ }
+
if ( offset != 0xFFFFU )
{
cmap->cur_values = offset ? p + offset : NULL;
@@ -831,7 +852,7 @@
/* */
if ( valid->level >= FT_VALIDATE_PARANOID )
{
- /* check the values of 'searchRange', 'entrySelector', 'rangeShift' */
+ /* check the values of `searchRange', `entrySelector', `rangeShift' */
FT_UInt search_range = TT_NEXT_USHORT( p );
FT_UInt entry_selector = TT_NEXT_USHORT( p );
FT_UInt range_shift = TT_NEXT_USHORT( p );
@@ -858,7 +879,7 @@
offsets = deltas + num_segs * 2;
glyph_ids = offsets + num_segs * 2;
- /* check last segment, its end count must be FFFF */
+ /* check last segment; its end count value must be 0xFFFF */
if ( valid->level >= FT_VALIDATE_PARANOID )
{
p = ends + ( num_segs - 1 ) * 2;
@@ -867,9 +888,9 @@
}
{
- FT_UInt start, end, offset, n;
- FT_UInt last_start = 0, last_end = 0;
- FT_Int delta;
+ FT_UInt start, end, offset, n;
+ FT_UInt last_start = 0, last_end = 0;
+ FT_Int delta;
FT_Byte* p_start = starts;
FT_Byte* p_end = ends;
FT_Byte* p_delta = deltas;
@@ -887,10 +908,10 @@
if ( start > end )
FT_INVALID_DATA;
- /* this test should be performed at default validation level; */
- /* unfortunately, some popular Asian fonts present overlapping */
- /* ranges in their charmaps */
- /* */
+ /* this test should be performed at default validation level; */
+ /* unfortunately, some popular Asian fonts have overlapping */
+ /* ranges in their charmaps */
+ /* */
if ( start <= last_end && n > 0 )
{
if ( valid->level >= FT_VALIDATE_TIGHT )
@@ -898,7 +919,7 @@
else
{
/* allow overlapping segments, provided their start points */
- /* and end points, respectively, are in ascending order. */
+ /* and end points, respectively, are in ascending order */
/* */
if ( last_start > start || last_end > end )
error |= TT_CMAP_FLAG_UNSORTED;
@@ -909,16 +930,27 @@
if ( offset && offset != 0xFFFFU )
{
- p += offset; /* start of glyph id array */
+ p += offset; /* start of glyph ID array */
- /* check that we point within the glyph ids table only */
+ /* check that we point within the glyph IDs table only */
if ( valid->level >= FT_VALIDATE_TIGHT )
{
if ( p < glyph_ids ||
p + ( end - start + 1 ) * 2 > table + length )
FT_INVALID_DATA;
}
- else
+ /* Some fonts handle the last segment incorrectly. In */
+ /* theory, 0xFFFF might point to an ordinary glyph -- */
+ /* a cmap 4 is versatile and could be used for any */
+ /* encoding, not only Unicode. However, reality shows */
+ /* that far too many fonts are sloppy and incorrectly */
+ /* set all fields but `start' and `end' for the last */
+ /* segment if it contains only a single character. */
+ /* */
+ /* We thus omit the test here, delaying it to the */
+ /* routines which actually access the cmap. */
+ else if ( n != num_segs - 1 ||
+ !( start == 0xFFFFU && end == 0xFFFFU ) )
{
if ( p < glyph_ids ||
p + ( end - start + 1 ) * 2 > valid->limit )
@@ -946,12 +978,12 @@
}
else if ( offset == 0xFFFFU )
{
- /* Some fonts (erroneously?) use a range offset of 0xFFFF */
+ /* some fonts (erroneously?) use a range offset of 0xFFFF */
/* to mean missing glyph in cmap table */
/* */
- if ( valid->level >= FT_VALIDATE_PARANOID ||
- n != num_segs - 1 ||
- !( start == 0xFFFFU && end == 0xFFFFU && delta == 0x1U ) )
+ if ( valid->level >= FT_VALIDATE_PARANOID ||
+ n != num_segs - 1 ||
+ !( start == 0xFFFFU && end == 0xFFFFU ) )
FT_INVALID_DATA;
}
@@ -965,9 +997,9 @@
static FT_UInt
- tt_cmap4_char_map_linear( TT_CMap cmap,
- FT_UInt* pcharcode,
- FT_Bool next )
+ tt_cmap4_char_map_linear( TT_CMap cmap,
+ FT_UInt32* pcharcode,
+ FT_Bool next )
{
FT_UInt num_segs2, start, end, offset;
FT_Int delta;
@@ -1009,6 +1041,22 @@
p += num_segs2;
offset = TT_PEEK_USHORT( p );
+ /* some fonts have an incorrect last segment; */
+ /* we have to catch it */
+ if ( i >= num_segs - 1 &&
+ start == 0xFFFFU && end == 0xFFFFU )
+ {
+ TT_Face face = (TT_Face)cmap->cmap.charmap.face;
+ FT_Byte* limit = face->cmap_table + face->cmap_size;
+
+
+ if ( offset && p + offset + 2 > limit )
+ {
+ delta = 1;
+ offset = 0;
+ }
+ }
+
if ( offset == 0xFFFFU )
continue;
@@ -1038,9 +1086,9 @@
static FT_UInt
- tt_cmap4_char_map_binary( TT_CMap cmap,
- FT_UInt* pcharcode,
- FT_Bool next )
+ tt_cmap4_char_map_binary( TT_CMap cmap,
+ FT_UInt32* pcharcode,
+ FT_Bool next )
{
FT_UInt num_segs2, start, end, offset;
FT_Int delta;
@@ -1088,6 +1136,22 @@
p += num_segs2;
offset = TT_PEEK_USHORT( p );
+ /* some fonts have an incorrect last segment; */
+ /* we have to catch it */
+ if ( mid >= num_segs - 1 &&
+ start == 0xFFFFU && end == 0xFFFFU )
+ {
+ TT_Face face = (TT_Face)cmap->cmap.charmap.face;
+ FT_Byte* limit = face->cmap_table + face->cmap_size;
+
+
+ if ( offset && p + offset + 2 > limit )
+ {
+ delta = 1;
+ offset = 0;
+ }
+ }
+
/* search the first segment containing `charcode' */
if ( cmap->flags & TT_CMAP_FLAG_OVERLAPPING )
{
@@ -1359,7 +1423,7 @@
/* */
/* first 6 USHORT first segment code */
/* count 8 USHORT segment size in chars */
- /* glyphIds 10 USHORT[count] glyph ids */
+ /* glyphIds 10 USHORT[count] glyph IDs */
/* */
/* A very simplified segment mapping. */
/* */
@@ -1506,7 +1570,7 @@
/***** *****/
/***** FORMAT 8 *****/
/***** *****/
- /***** It's hard to completely understand what the OpenType spec *****/
+ /***** It is hard to completely understand what the OpenType spec *****/
/***** says about this format, but here is my conclusion. *****/
/***** *****/
/***** The purpose of this format is to easily map UTF-16 text to *****/
@@ -1521,7 +1585,7 @@
/***** `char_hi' and `char_lo' must be in the Surrogates Area. *****/
/***** Area. *****/
/***** *****/
- /***** The 'is32' table embedded in the charmap indicates whether a *****/
+ /***** The `is32' table embedded in the charmap indicates whether a *****/
/***** given 16-bit value is in the surrogates area or not. *****/
/***** *****/
/***** So, for any given `char_code', we can assert the following: *****/
@@ -1548,11 +1612,11 @@
/* is32 12 BYTE[8192] 32-bitness bitmap */
/* count 8204 ULONG number of groups */
/* */
- /* This header is followed by 'count' groups of the following format: */
+ /* This header is followed by `count' groups of the following format: */
/* */
/* start 0 ULONG first charcode */
/* end 4 ULONG last charcode */
- /* startId 8 ULONG start glyph id for the group */
+ /* startId 8 ULONG start glyph ID for the group */
/* */
#ifdef TT_CONFIG_CMAP_FORMAT_8
@@ -1934,7 +1998,7 @@
/* */
/* start 0 ULONG first charcode */
/* end 4 ULONG last charcode */
- /* startId 8 ULONG start glyph id for the group */
+ /* startId 8 ULONG start glyph ID for the group */
/* */
#ifdef TT_CONFIG_CMAP_FORMAT_12
@@ -2727,7 +2791,7 @@
FT_UInt tot = 0;
- p += 3; /* point to the first 'cnt' field */
+ p += 3; /* point to the first `cnt' field */
for ( ; numRanges > 0; numRanges-- )
{
tot += 1 + p[0];
@@ -2774,7 +2838,7 @@
}
- static FT_UInt*
+ static FT_UInt32*
tt_cmap14_get_nondef_chars( TT_CMap cmap,
FT_Byte *p,
FT_Memory memory )
@@ -2962,7 +3026,7 @@
(TT_CMap_Info_GetFunc)tt_cmap14_get_info
};
-#endif /* TT_CONFIG_CMAP_FORMAT_0 */
+#endif /* TT_CONFIG_CMAP_FORMAT_14 */
static const TT_CMap_Class tt_cmap_classes[] =
diff --git a/src/3rdparty/freetype/src/sfnt/ttkern.c b/src/3rdparty/freetype/src/sfnt/ttkern.c
index 28e52c333..67d5115e8 100644
--- a/src/3rdparty/freetype/src/sfnt/ttkern.c
+++ b/src/3rdparty/freetype/src/sfnt/ttkern.c
@@ -5,7 +5,7 @@
/* Load the basic TrueType kerning table. This doesn't handle */
/* kerning data within the GPOS table at the moment. */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by */
+/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -103,6 +103,9 @@
p_next += length;
+ if ( p_next > p_limit ) /* handle broken table */
+ p_next = p_limit;
+
/* only use horizontal kerning tables */
if ( ( coverage & ~8 ) != 0x0001 ||
p + 8 > p_limit )
@@ -111,8 +114,8 @@
num_pairs = FT_NEXT_USHORT( p );
p += 6;
- if ( p + 6 * num_pairs > p_limit )
- goto NextTable;
+ if ( ( p_next - p ) / 6 < (int)num_pairs ) /* handle broken count */
+ num_pairs = (FT_UInt)( ( p_next - p ) / 6 );
avail |= mask;
@@ -181,18 +184,22 @@
FT_Int result = 0;
FT_UInt count, mask = 1;
FT_Byte* p = face->kern_table;
+ FT_Byte* p_limit = p + face->kern_table_size;
p += 4;
mask = 0x0001;
- for ( count = face->num_kern_tables; count > 0; count--, mask <<= 1 )
+ for ( count = face->num_kern_tables;
+ count > 0 && p + 6 <= p_limit;
+ count--, mask <<= 1 )
{
FT_Byte* base = p;
FT_Byte* next = base;
FT_UInt version = FT_NEXT_USHORT( p );
FT_UInt length = FT_NEXT_USHORT( p );
FT_UInt coverage = FT_NEXT_USHORT( p );
+ FT_UInt num_pairs;
FT_Int value = 0;
FT_UNUSED( version );
@@ -200,21 +207,27 @@
next = base + length;
+ if ( next > p_limit ) /* handle broken table */
+ next = p_limit;
+
if ( ( face->kern_avail_bits & mask ) == 0 )
goto NextTable;
if ( p + 8 > next )
goto NextTable;
+ num_pairs = FT_NEXT_USHORT( p );
+ p += 6;
+
+ if ( ( next - p ) / 6 < (int)num_pairs ) /* handle broken count */
+ num_pairs = (FT_UInt)( ( next - p ) / 6 );
+
switch ( coverage >> 8 )
{
case 0:
{
- FT_UInt num_pairs = FT_NEXT_USHORT( p );
- FT_ULong key0 = TT_KERN_INDEX( left_glyph, right_glyph );
-
+ FT_ULong key0 = TT_KERN_INDEX( left_glyph, right_glyph );
- p += 6;
if ( face->kern_order_bits & mask ) /* binary search */
{
diff --git a/src/3rdparty/freetype/src/sfnt/ttload.c b/src/3rdparty/freetype/src/sfnt/ttload.c
index 6b7c34262..c45a1ed55 100644
--- a/src/3rdparty/freetype/src/sfnt/ttload.c
+++ b/src/3rdparty/freetype/src/sfnt/ttload.c
@@ -58,6 +58,9 @@
{
TT_Table entry;
TT_Table limit;
+#ifdef FT_DEBUG_LEVEL_TRACE
+ FT_Bool zero_length = FALSE;
+#endif
FT_TRACE4(( "tt_face_lookup_table: %08p, `%c%c%c%c' -- ",
@@ -72,17 +75,28 @@
for ( ; entry < limit; entry++ )
{
- /* For compatibility with Windows, we consider 0-length */
- /* tables the same as missing tables. */
- if ( entry->Tag == tag && entry->Length != 0 )
- {
- FT_TRACE4(( "found table.\n" ));
- return entry;
+ /* For compatibility with Windows, we consider */
+ /* zero-length tables the same as missing tables. */
+ if ( entry->Tag == tag ) {
+ if ( entry->Length != 0 )
+ {
+ FT_TRACE4(( "found table.\n" ));
+ return entry;
+ }
+#ifdef FT_DEBUG_LEVEL_TRACE
+ zero_length = TRUE;
+#endif
}
}
- FT_TRACE4(( "could not find table!\n" ));
- return 0;
+#ifdef FT_DEBUG_LEVEL_TRACE
+ if ( zero_length )
+ FT_TRACE4(( "ignoring empty table!\n" ));
+ else
+ FT_TRACE4(( "could not find table!\n" ));
+#endif
+
+ return NULL;
}
@@ -124,7 +138,7 @@
*length = table->Length;
if ( FT_STREAM_SEEK( table->Offset ) )
- goto Exit;
+ goto Exit;
}
else
error = SFNT_Err_Table_Missing;
@@ -134,27 +148,30 @@
}
- /* Here, we */
- /* */
- /* - check that `num_tables' is valid */
- /* - look for a `head' table, check its size, and parse it to check */
- /* whether its `magic' field is correctly set */
- /* */
- /* When checking directory entries, ignore the tables `glyx' and `locx' */
- /* which are hacked-out versions of `glyf' and `loca' in some PostScript */
- /* Type 42 fonts, and which are generally invalid. */
- /* */
+ /* Here, we */
+ /* */
+ /* - check that `num_tables' is valid (and adjust it if necessary) */
+ /* */
+ /* - look for a `head' table, check its size, and parse it to check */
+ /* whether its `magic' field is correctly set */
+ /* */
+ /* - errors (except errors returned by stream handling) */
+ /* */
+ /* SFNT_Err_Unknown_File_Format: */
+ /* no table is defined in directory, it is not sfnt-wrapped */
+ /* data */
+ /* SFNT_Err_Table_Missing: */
+ /* table directory is valid, but essential tables */
+ /* (head/bhed/SING) are missing */
+ /* */
static FT_Error
check_table_dir( SFNT_Header sfnt,
FT_Stream stream )
{
- FT_Error error;
- FT_UInt nn;
- FT_UInt has_head = 0, has_sing = 0, has_meta = 0;
- FT_ULong offset = sfnt->offset + 12;
-
- const FT_ULong glyx_tag = FT_MAKE_TAG( 'g', 'l', 'y', 'x' );
- const FT_ULong locx_tag = FT_MAKE_TAG( 'l', 'o', 'c', 'x' );
+ FT_Error error;
+ FT_UInt nn, valid_entries = 0;
+ FT_UInt has_head = 0, has_sing = 0, has_meta = 0;
+ FT_ULong offset = sfnt->offset + 12;
static const FT_Frame_Field table_dir_entry_fields[] =
{
@@ -170,12 +187,8 @@
};
- if ( sfnt->num_tables == 0 ||
- offset + sfnt->num_tables * 16 > stream->size )
- return SFNT_Err_Unknown_File_Format;
-
if ( FT_STREAM_SEEK( offset ) )
- return error;
+ goto Exit;
for ( nn = 0; nn < sfnt->num_tables; nn++ )
{
@@ -183,12 +196,23 @@
if ( FT_STREAM_READ_FIELDS( table_dir_entry_fields, &table ) )
- return error;
+ {
+ nn--;
+ FT_TRACE2(( "check_table_dir:"
+ " can read only %d table%s in font (instead of %d)\n",
+ nn, nn == 1 ? "" : "s", sfnt->num_tables ));
+ sfnt->num_tables = nn;
+ break;
+ }
- if ( table.Offset + table.Length > stream->size &&
- table.Tag != glyx_tag &&
- table.Tag != locx_tag )
- return SFNT_Err_Unknown_File_Format;
+ /* we ignore invalid tables */
+ if ( table.Offset + table.Length > stream->size )
+ {
+ FT_TRACE2(( "check_table_dir: table entry %d invalid\n", nn ));
+ continue;
+ }
+ else
+ valid_entries++;
if ( table.Tag == TTAG_head || table.Tag == TTAG_bhed )
{
@@ -210,17 +234,26 @@
*
*/
if ( table.Length < 0x36 )
- return SFNT_Err_Unknown_File_Format;
+ {
+ FT_TRACE2(( "check_table_dir: `head' table too small\n" ));
+ error = SFNT_Err_Table_Missing;
+ goto Exit;
+ }
if ( FT_STREAM_SEEK( table.Offset + 12 ) ||
FT_READ_ULONG( magic ) )
- return error;
+ goto Exit;
if ( magic != 0x5F0F3CF5UL )
- return SFNT_Err_Unknown_File_Format;
+ {
+ FT_TRACE2(( "check_table_dir:"
+ " no magic number found in `head' table\n"));
+ error = SFNT_Err_Table_Missing;
+ goto Exit;
+ }
if ( FT_STREAM_SEEK( offset + ( nn + 1 ) * 16 ) )
- return error;
+ goto Exit;
}
else if ( table.Tag == TTAG_SING )
has_sing = 1;
@@ -228,11 +261,34 @@
has_meta = 1;
}
+ sfnt->num_tables = valid_entries;
+
+ if ( sfnt->num_tables == 0 )
+ {
+ FT_TRACE2(( "check_table_dir: no tables found\n" ));
+ error = SFNT_Err_Unknown_File_Format;
+ goto Exit;
+ }
+
/* if `sing' and `meta' tables are present, there is no `head' table */
if ( has_head || ( has_sing && has_meta ) )
- return SFNT_Err_Ok;
+ {
+ error = SFNT_Err_Ok;
+ goto Exit;
+ }
else
- return SFNT_Err_Unknown_File_Format;
+ {
+ FT_TRACE2(( "check_table_dir:" ));
+#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
+ FT_TRACE2(( " neither `head', `bhed', nor `sing' table found\n" ));
+#else
+ FT_TRACE2(( " neither `head' nor `sing' table found\n" ));
+#endif
+ error = SFNT_Err_Table_Missing;
+ }
+
+ Exit:
+ return error;
}
@@ -266,7 +322,7 @@
FT_Error error;
FT_Memory memory = stream->memory;
TT_TableRec* entry;
- TT_TableRec* limit;
+ FT_Int nn;
static const FT_Frame_Field offset_table_fields[] =
{
@@ -290,7 +346,7 @@
if ( FT_READ_ULONG( sfnt.format_tag ) ||
FT_STREAM_READ_FIELDS( offset_table_fields, &sfnt ) )
- return error;
+ goto Exit;
/* many fonts don't have these fields set correctly */
#if 0
@@ -301,51 +357,58 @@
/* load the table directory */
- FT_TRACE2(( "-- Tables count: %12u\n", sfnt.num_tables ));
- FT_TRACE2(( "-- Format version: %08lx\n", sfnt.format_tag ));
+ FT_TRACE2(( "-- Number of tables: %10u\n", sfnt.num_tables ));
+ FT_TRACE2(( "-- Format version: 0x%08lx\n", sfnt.format_tag ));
/* check first */
error = check_table_dir( &sfnt, stream );
if ( error )
{
- FT_TRACE2(( "tt_face_load_font_dir: invalid table directory!\n" ));
+ FT_TRACE2(( "tt_face_load_font_dir: invalid table directory for TrueType!\n" ));
- return error;
+ goto Exit;
}
face->num_tables = sfnt.num_tables;
face->format_tag = sfnt.format_tag;
if ( FT_QNEW_ARRAY( face->dir_tables, face->num_tables ) )
- return error;
+ goto Exit;
if ( FT_STREAM_SEEK( sfnt.offset + 12 ) ||
FT_FRAME_ENTER( face->num_tables * 16L ) )
- return error;
+ goto Exit;
entry = face->dir_tables;
- limit = entry + face->num_tables;
- for ( ; entry < limit; entry++ )
+ for ( nn = 0; nn < sfnt.num_tables; nn++ )
{
entry->Tag = FT_GET_TAG4();
entry->CheckSum = FT_GET_ULONG();
entry->Offset = FT_GET_LONG();
entry->Length = FT_GET_LONG();
- FT_TRACE2(( " %c%c%c%c - %08lx - %08lx\n",
- (FT_Char)( entry->Tag >> 24 ),
- (FT_Char)( entry->Tag >> 16 ),
- (FT_Char)( entry->Tag >> 8 ),
- (FT_Char)( entry->Tag ),
- entry->Offset,
- entry->Length ));
+ /* ignore invalid tables */
+ if ( entry->Offset + entry->Length > stream->size )
+ continue;
+ else
+ {
+ FT_TRACE2(( " %c%c%c%c - %08lx - %08lx\n",
+ (FT_Char)( entry->Tag >> 24 ),
+ (FT_Char)( entry->Tag >> 16 ),
+ (FT_Char)( entry->Tag >> 8 ),
+ (FT_Char)( entry->Tag ),
+ entry->Offset,
+ entry->Length ));
+ entry++;
+ }
}
FT_FRAME_EXIT();
FT_TRACE2(( "table directory loaded\n\n" ));
+ Exit:
return error;
}
diff --git a/src/3rdparty/freetype/src/sfnt/ttmtx.c b/src/3rdparty/freetype/src/sfnt/ttmtx.c
index 55f681aba..2a7d22c07 100644
--- a/src/3rdparty/freetype/src/sfnt/ttmtx.c
+++ b/src/3rdparty/freetype/src/sfnt/ttmtx.c
@@ -4,7 +4,7 @@
/* */
/* Load the metrics tables common to TTF and OTF fonts (body). */
/* */
-/* Copyright 2006, 2007 by */
+/* Copyright 2006, 2007, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -60,7 +60,7 @@
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
-#if !defined FT_CONFIG_OPTION_OLD_INTERNALS
+#ifndef FT_CONFIG_OPTION_OLD_INTERNALS
FT_LOCAL_DEF( FT_Error )
tt_face_load_hmtx( TT_Face face,
@@ -97,7 +97,7 @@
return error;
}
-#else /* !OPTIMIZE_MEMORY || OLD_INTERNALS */
+#else /* !FT_CONFIG_OPTION_OLD_INTERNALS */
FT_LOCAL_DEF( FT_Error )
tt_face_load_hmtx( TT_Face face,
@@ -229,7 +229,7 @@
return error;
}
-#endif /* !OPTIMIZE_MEMORY || OLD_INTERNALS */
+#endif /* !FT_CONFIG_OPTION_OLD_INTERNALS */
/*************************************************************************/
@@ -341,7 +341,7 @@
/* */
/* advance :: The advance width resp. advance height. */
/* */
-#if !defined FT_CONFIG_OPTION_OLD_INTERNALS
+#ifndef FT_CONFIG_OPTION_OLD_INTERNALS
FT_LOCAL_DEF( FT_Error )
tt_face_get_metrics( TT_Face face,
@@ -420,7 +420,7 @@
return SFNT_Err_Ok;
}
-#else /* OLD_INTERNALS */
+#else /* !FT_CONFIG_OPTION_OLD_INTERNALS */
FT_LOCAL_DEF( FT_Error )
tt_face_get_metrics( TT_Face face,
@@ -460,7 +460,7 @@
return SFNT_Err_Ok;
}
-#endif /* !OPTIMIZE_MEMORY || OLD_INTERNALS */
+#endif /* !FT_CONFIG_OPTION_OLD_INTERNALS */
/* END */
diff --git a/src/3rdparty/freetype/src/sfnt/ttpost.c b/src/3rdparty/freetype/src/sfnt/ttpost.c
index 1e6163646..ce628e210 100644
--- a/src/3rdparty/freetype/src/sfnt/ttpost.c
+++ b/src/3rdparty/freetype/src/sfnt/ttpost.c
@@ -5,7 +5,7 @@
/* Postcript name table processing for TrueType and OpenType fonts */
/* (body). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2006, 2007 by */
+/* Copyright 1996-2001, 2002, 2003, 2006, 2007, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -62,11 +62,11 @@
/* table of Mac names. Thus, it is possible to build a version of */
/* FreeType without the Type 1 driver & PSNames module. */
-#define MAC_NAME( x ) tt_post_default_names[x]
+#define MAC_NAME( x ) ( (FT_String*)tt_post_default_names[x] )
/* the 258 default Mac PS glyph names */
- static const FT_String* tt_post_default_names[258] =
+ static const FT_String* const tt_post_default_names[258] =
{
/* 0 */
".notdef", ".null", "CR", "space", "exclam",
@@ -416,13 +416,14 @@
/* tt_face_get_ps_name */
/* */
/* <Description> */
- /* Gets the PostScript glyph name of a glyph. */
+ /* Get the PostScript glyph name of a glyph. */
/* */
/* <Input> */
/* face :: A handle to the parent face. */
/* */
/* idx :: The glyph index. */
/* */
+ /* <InOut> */
/* PSname :: The address of a string pointer. Will be NULL in case */
/* of error, otherwise it is a pointer to the glyph name. */
/* */
@@ -436,9 +437,9 @@
FT_UInt idx,
FT_String** PSname )
{
- FT_Error error;
- TT_Post_Names names;
- FT_Fixed format;
+ FT_Error error;
+ TT_Post_Names names;
+ FT_Fixed format;
#ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES
FT_Service_PsCMaps psnames;
diff --git a/src/3rdparty/freetype/src/sfnt/ttsbit.c b/src/3rdparty/freetype/src/sfnt/ttsbit.c
index 8261ba553..eadaade71 100644
--- a/src/3rdparty/freetype/src/sfnt/ttsbit.c
+++ b/src/3rdparty/freetype/src/sfnt/ttsbit.c
@@ -4,7 +4,7 @@
/* */
/* TrueType and OpenType embedded bitmap support (body). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by */
+/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -24,11 +24,11 @@
* Alas, the memory-optimized sbit loader can't be used when implementing
* the `old internals' hack
*/
-#if !defined FT_CONFIG_OPTION_OLD_INTERNALS
+#ifndef FT_CONFIG_OPTION_OLD_INTERNALS
#include "ttsbit0.c"
-#else /* !FT_CONFIG_OPTION_OLD_INTERNALS */
+#else /* FT_CONFIG_OPTION_OLD_INTERNALS */
#include <ft2build.h>
#include FT_INTERNAL_DEBUG_H
@@ -83,7 +83,8 @@
FT_Int line_bits,
FT_Bool byte_padded,
FT_Int x_offset,
- FT_Int y_offset )
+ FT_Int y_offset,
+ FT_Int source_height )
{
FT_Byte* line_buff;
FT_Int line_incr;
@@ -116,7 +117,7 @@
acc = 0; /* clear accumulator */
loaded = 0; /* no bits were loaded */
- for ( height = target->rows; height > 0; height-- )
+ for ( height = source_height; height > 0; height-- )
{
FT_Byte* cur = line_buff; /* current write cursor */
FT_Int count = line_bits; /* # of bits to extract per line */
@@ -772,7 +773,7 @@
Found:
/* return successfully! */
*arange = range;
- return 0;
+ return SFNT_Err_Ok;
}
}
@@ -1230,7 +1231,7 @@
/* the sbit blitter doesn't make a difference between pixmap */
/* depths. */
blit_sbit( map, (FT_Byte*)stream->cursor, line_bits, pad_bytes,
- x_offset * pix_bits, y_offset );
+ x_offset * pix_bits, y_offset, metrics->height );
FT_FRAME_EXIT();
}
@@ -1324,7 +1325,11 @@
range->image_format, metrics, stream );
case 8: /* compound format */
- FT_Stream_Skip( stream, 1L );
+ if ( FT_STREAM_SKIP( 1L ) )
+ {
+ error = SFNT_Err_Invalid_Stream_Skip;
+ goto Exit;
+ }
/* fallthrough */
case 9:
@@ -1496,7 +1501,7 @@
return error;
}
-#endif /* !FT_CONFIG_OPTION_OLD_INTERNALS */
+#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */
/* END */
diff --git a/src/3rdparty/freetype/src/sfnt/ttsbit.h b/src/3rdparty/freetype/src/sfnt/ttsbit.h
index c6067c0e3..7ea2af184 100644
--- a/src/3rdparty/freetype/src/sfnt/ttsbit.h
+++ b/src/3rdparty/freetype/src/sfnt/ttsbit.h
@@ -4,7 +4,7 @@
/* */
/* TrueType and OpenType embedded bitmap support (specification). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by */
+/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -45,7 +45,7 @@ FT_BEGIN_HEADER
FT_ULong strike_index,
FT_Size_Metrics* metrics );
-#if defined FT_CONFIG_OPTION_OLD_INTERNALS
+#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
FT_LOCAL( FT_Error )
tt_find_sbit_image( TT_Face face,
FT_UInt glyph_index,
diff --git a/src/3rdparty/freetype/src/sfnt/ttsbit0.c b/src/3rdparty/freetype/src/sfnt/ttsbit0.c
index 37c7a9bbe..3ebcbbd74 100644
--- a/src/3rdparty/freetype/src/sfnt/ttsbit0.c
+++ b/src/3rdparty/freetype/src/sfnt/ttsbit0.c
@@ -5,7 +5,7 @@
/* TrueType and OpenType embedded bitmap support (body). */
/* This is a heap-optimized version. */
/* */
-/* Copyright 2005, 2006, 2007, 2008 by */
+/* Copyright 2005, 2006, 2007, 2008, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -39,65 +39,16 @@
#define FT_COMPONENT trace_ttsbit
- static const FT_Frame_Field tt_sbit_line_metrics_fields[] =
- {
-#undef FT_STRUCTURE
-#define FT_STRUCTURE TT_SBit_LineMetricsRec
-
- /* no FT_FRAME_START */
- FT_FRAME_CHAR( ascender ),
- FT_FRAME_CHAR( descender ),
- FT_FRAME_BYTE( max_width ),
-
- FT_FRAME_CHAR( caret_slope_numerator ),
- FT_FRAME_CHAR( caret_slope_denominator ),
- FT_FRAME_CHAR( caret_offset ),
-
- FT_FRAME_CHAR( min_origin_SB ),
- FT_FRAME_CHAR( min_advance_SB ),
- FT_FRAME_CHAR( max_before_BL ),
- FT_FRAME_CHAR( min_after_BL ),
- FT_FRAME_CHAR( pads[0] ),
- FT_FRAME_CHAR( pads[1] ),
- FT_FRAME_END
- };
-
- static const FT_Frame_Field tt_strike_start_fields[] =
- {
-#undef FT_STRUCTURE
-#define FT_STRUCTURE TT_SBit_StrikeRec
-
- /* no FT_FRAME_START */
- FT_FRAME_ULONG( ranges_offset ),
- FT_FRAME_SKIP_LONG,
- FT_FRAME_ULONG( num_ranges ),
- FT_FRAME_ULONG( color_ref ),
- FT_FRAME_END
- };
-
- static const FT_Frame_Field tt_strike_end_fields[] =
- {
- /* no FT_FRAME_START */
- FT_FRAME_USHORT( start_glyph ),
- FT_FRAME_USHORT( end_glyph ),
- FT_FRAME_BYTE ( x_ppem ),
- FT_FRAME_BYTE ( y_ppem ),
- FT_FRAME_BYTE ( bit_depth ),
- FT_FRAME_CHAR ( flags ),
- FT_FRAME_END
- };
-
-
FT_LOCAL_DEF( FT_Error )
tt_face_load_eblc( TT_Face face,
FT_Stream stream )
{
- FT_Error error = SFNT_Err_Ok;
- FT_Fixed version;
- FT_ULong num_strikes, table_size;
- FT_Byte* p;
- FT_Byte* p_limit;
- FT_UInt count;
+ FT_Error error = SFNT_Err_Ok;
+ FT_Fixed version;
+ FT_ULong num_strikes, table_size;
+ FT_Byte* p;
+ FT_Byte* p_limit;
+ FT_UInt count;
face->sbit_num_strikes = 0;
@@ -111,7 +62,7 @@
if ( table_size < 8 )
{
- FT_ERROR(( "%s: table too short!\n", "tt_face_load_sbit_strikes" ));
+ FT_ERROR(( "tt_face_load_sbit_strikes: table too short!\n" ));
error = SFNT_Err_Invalid_File_Format;
goto Exit;
}
@@ -129,8 +80,7 @@
if ( version != 0x00020000UL || num_strikes >= 0x10000UL )
{
- FT_ERROR(( "%s: invalid table version!\n",
- "tt_face_load_sbit_strikes" ));
+ FT_ERROR(( "tt_face_load_sbit_strikes: invalid table version!\n" ));
error = SFNT_Err_Invalid_File_Format;
goto Fail;
}
@@ -182,7 +132,7 @@
FT_ULong strike_index,
FT_Size_Metrics* metrics )
{
- FT_Byte* strike;
+ FT_Byte* strike;
if ( strike_index >= (FT_ULong)face->sbit_num_strikes )
@@ -374,14 +324,11 @@
if ( p + 5 > limit )
goto Fail;
- if ( !decoder->metrics_loaded )
- {
- metrics->height = p[0];
- metrics->width = p[1];
- metrics->horiBearingX = (FT_Char)p[2];
- metrics->horiBearingY = (FT_Char)p[3];
- metrics->horiAdvance = p[4];
- }
+ metrics->height = p[0];
+ metrics->width = p[1];
+ metrics->horiBearingX = (FT_Char)p[2];
+ metrics->horiBearingY = (FT_Char)p[3];
+ metrics->horiAdvance = p[4];
p += 5;
if ( big )
@@ -389,19 +336,16 @@
if ( p + 3 > limit )
goto Fail;
- if ( !decoder->metrics_loaded )
- {
- metrics->vertBearingX = (FT_Char)p[0];
- metrics->vertBearingY = (FT_Char)p[1];
- metrics->vertAdvance = p[2];
- }
+ metrics->vertBearingX = (FT_Char)p[0];
+ metrics->vertBearingY = (FT_Char)p[1];
+ metrics->vertAdvance = p[2];
p += 3;
}
decoder->metrics_loaded = 1;
*pp = p;
- return 0;
+ return SFNT_Err_Ok;
Fail:
return SFNT_Err_Invalid_Argument;
@@ -507,7 +451,7 @@
if ( w > 0 )
wval = (FT_UInt)( wval | ( *p++ & ( 0xFF00U >> w ) ) );
- /* all bits read and there are ( x_pos + w ) bits to be written */
+ /* all bits read and there are `x_pos + w' bits to be written */
write[0] = (FT_Byte)( write[0] | ( wval >> x_pos ) );
@@ -587,7 +531,12 @@
{
w = ( width < 8 - x_pos ) ? width : 8 - x_pos;
- if ( nbits < w )
+ if ( h == height )
+ {
+ rval |= *p++;
+ nbits += x_pos;
+ }
+ else if ( nbits < w )
{
rval |= *p++;
nbits += 8 - w;
@@ -598,7 +547,8 @@
nbits -= w;
}
- *write++ |= ( ( rval >> nbits ) & 0xFF ) & ~( 0xFF << w );
+ *write++ |= ( ( rval >> nbits ) & 0xFF ) &
+ ( ~( 0xFF << w ) << ( 8 - w - x_pos ) );
rval <<= 8;
w = width - w;
@@ -645,6 +595,13 @@
FT_Error error = SFNT_Err_Ok;
FT_UInt num_components, nn;
+ FT_Char horiBearingX = decoder->metrics->horiBearingX;
+ FT_Char horiBearingY = decoder->metrics->horiBearingY;
+ FT_Byte horiAdvance = decoder->metrics->horiAdvance;
+ FT_Char vertBearingX = decoder->metrics->vertBearingX;
+ FT_Char vertBearingY = decoder->metrics->vertBearingY;
+ FT_Byte vertAdvance = decoder->metrics->vertAdvance;
+
if ( p + 2 > limit )
goto Fail;
@@ -653,6 +610,13 @@
if ( p + 4 * num_components > limit )
goto Fail;
+ if ( !decoder->bitmap_allocated )
+ {
+ error = tt_sbit_decoder_alloc_bitmap( decoder );
+ if ( error )
+ goto Exit;
+ }
+
for ( nn = 0; nn < num_components; nn++ )
{
FT_UInt gindex = FT_NEXT_USHORT( p );
@@ -667,6 +631,15 @@
break;
}
+ decoder->metrics->horiBearingX = horiBearingX;
+ decoder->metrics->horiBearingY = horiBearingY;
+ decoder->metrics->horiAdvance = horiAdvance;
+ decoder->metrics->vertBearingX = vertBearingX;
+ decoder->metrics->vertBearingY = vertBearingY;
+ decoder->metrics->vertAdvance = vertAdvance;
+ decoder->metrics->width = (FT_UInt)decoder->bitmap->width;
+ decoder->metrics->height = (FT_UInt)decoder->bitmap->rows;
+
Exit:
return error;
diff --git a/src/3rdparty/freetype/src/smooth/ftgrays.c b/src/3rdparty/freetype/src/smooth/ftgrays.c
index add1dd24a..10fa2ae72 100644
--- a/src/3rdparty/freetype/src/smooth/ftgrays.c
+++ b/src/3rdparty/freetype/src/smooth/ftgrays.c
@@ -4,7 +4,7 @@
/* */
/* A new `perfect' anti-aliasing renderer (body). */
/* */
-/* Copyright 2000-2001, 2002, 2003, 2005, 2006, 2007 by */
+/* Copyright 2000-2001, 2002, 2003, 2005, 2006, 2007, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -91,11 +91,19 @@
#define FT_COMPONENT trace_smooth
+#ifdef _STANDALONE_
-#ifdef _STANDALONE_
+ /* define this to dump debugging information */
+/* #define FT_DEBUG_LEVEL_TRACE */
+
+
+#ifdef FT_DEBUG_LEVEL_TRACE
+#include <stdio.h>
+#include <stdarg.h>
+#endif
-#include <string.h> /* for ft_memcpy() */
+#include <string.h>
#include <setjmp.h>
#include <limits.h>
#define FT_UINT_MAX UINT_MAX
@@ -118,24 +126,53 @@
#include "ftimage.h"
#include "ftgrays.h"
+
/* This macro is used to indicate that a function parameter is unused. */
/* Its purpose is simply to reduce compiler warnings. Note also that */
/* simply defining it as `(void)x' doesn't avoid warnings with certain */
/* ANSI compilers (e.g. LCC). */
#define FT_UNUSED( x ) (x) = (x)
- /* Disable the tracing mechanism for simplicity -- developers can */
- /* activate it easily by redefining these two macros. */
+
+ /* we only use level 5 & 7 tracing messages; cf. ftdebug.h */
+
+#ifdef FT_DEBUG_LEVEL_TRACE
+
+ void
+ FT_Message( const char* fmt,
+ ... )
+ {
+ va_list ap;
+
+
+ va_start( ap, fmt );
+ vfprintf( stderr, fmt, ap );
+ va_end( ap );
+ }
+
+ /* we don't handle tracing levels in stand-alone mode; */
+#ifndef FT_TRACE5
+#define FT_TRACE5( varformat ) FT_Message varformat
+#endif
+#ifndef FT_TRACE7
+#define FT_TRACE7( varformat ) FT_Message varformat
+#endif
#ifndef FT_ERROR
-#define FT_ERROR( x ) do ; while ( 0 ) /* nothing */
+#define FT_ERROR( varformat ) FT_Message varformat
#endif
-#ifndef FT_TRACE
-#define FT_TRACE( x ) do ; while ( 0 ) /* nothing */
-#endif
+#else /* !FT_DEBUG_LEVEL_TRACE */
+
+#define FT_TRACE5( x ) do { } while ( 0 ) /* nothing */
+#define FT_TRACE7( x ) do { } while ( 0 ) /* nothing */
+#define FT_ERROR( x ) do { } while ( 0 ) /* nothing */
+
+#endif /* !FT_DEBUG_LEVEL_TRACE */
+
#else /* !_STANDALONE_ */
+
#include <ft2build.h>
#include "ftgrays.h"
#include FT_INTERNAL_OBJECTS_H
@@ -147,7 +184,7 @@
#define ErrRaster_Invalid_Mode Smooth_Err_Cannot_Render_Glyph
#define ErrRaster_Invalid_Outline Smooth_Err_Invalid_Outline
#define ErrRaster_Memory_Overflow Smooth_Err_Out_Of_Memory
-#define ErrRaster_Invalid_Argument Smooth_Err_Bad_Argument
+#define ErrRaster_Invalid_Argument Smooth_Err_Invalid_Argument
#endif /* !_STANDALONE_ */
@@ -160,10 +197,6 @@
#define FT_MEM_ZERO( dest, count ) FT_MEM_SET( dest, 0, count )
#endif
- /* define this to dump debugging information */
-#define xxxDEBUG_GRAYS
-
-
/* as usual, for the speed hungry :-) */
#ifndef FT_STATIC_RASTER
@@ -398,8 +431,8 @@
int x = ras.ex;
- if ( x > ras.max_ex )
- x = ras.max_ex;
+ if ( x > ras.count_ex )
+ x = ras.count_ex;
pcell = &ras.ycells[ras.ey];
for (;;)
@@ -1207,7 +1240,7 @@
x += (TCoord)ras.min_ex;
/* FT_Span.x is a 16-bit short, so limit our coordinates appropriately */
- if ( x >= 32768 )
+ if ( x >= 32767 )
x = 32767;
if ( coverage )
@@ -1229,24 +1262,23 @@
if ( ras.render_span && count > 0 )
ras.render_span( ras.span_y, count, ras.gray_spans,
ras.render_span_data );
- /* ras.render_span( span->y, ras.gray_spans, count ); */
-#ifdef DEBUG_GRAYS
+#ifdef FT_DEBUG_LEVEL_TRACE
- if ( ras.span_y >= 0 )
+ if ( count > 0 )
{
int n;
- fprintf( stderr, "y=%3d ", ras.span_y );
+ FT_TRACE7(( "y = %3d ", ras.span_y ));
span = ras.gray_spans;
for ( n = 0; n < count; n++, span++ )
- fprintf( stderr, "[%d..%d]:%02x ",
- span->x, span->x + span->len - 1, span->coverage );
- fprintf( stderr, "\n" );
+ FT_TRACE7(( "[%d..%d]:%02x ",
+ span->x, span->x + span->len - 1, span->coverage ));
+ FT_TRACE7(( "\n" ));
}
-#endif /* DEBUG_GRAYS */
+#endif /* FT_DEBUG_LEVEL_TRACE */
ras.num_gray_spans = 0;
ras.span_y = y;
@@ -1267,9 +1299,11 @@
}
-#ifdef DEBUG_GRAYS
+#ifdef FT_DEBUG_LEVEL_TRACE
- /* to be called while in the debugger */
+ /* to be called while in the debugger -- */
+ /* this function causes a compiler warning since it is unused otherwise */
+ static void
gray_dump_cells( RAS_ARG )
{
int yindex;
@@ -1288,7 +1322,7 @@
}
}
-#endif /* DEBUG_GRAYS */
+#endif /* FT_DEBUG_LEVEL_TRACE */
static void
@@ -1304,6 +1338,8 @@
ras.num_gray_spans = 0;
+ FT_TRACE7(( "gray_sweep: start\n" ));
+
for ( yindex = 0; yindex < ras.ycount; yindex++ )
{
PCell cell = ras.ycells[yindex];
@@ -1337,6 +1373,8 @@
if ( ras.render_span && ras.num_gray_spans > 0 )
ras.render_span( ras.span_y, ras.num_gray_spans,
ras.gray_spans, ras.render_span_data );
+
+ FT_TRACE7(( "gray_sweep: end\n" ));
}
@@ -1344,7 +1382,7 @@
/*************************************************************************/
/* */
- /* The following function should only compile in stand_alone mode, */
+ /* The following function should only compile in stand-alone mode, */
/* i.e., when building this component without the rest of FreeType. */
/* */
/*************************************************************************/
@@ -1355,18 +1393,19 @@
/* FT_Outline_Decompose */
/* */
/* <Description> */
- /* Walks over an outline's structure to decompose it into individual */
- /* segments and Bezier arcs. This function is also able to emit */
+ /* Walk over an outline's structure to decompose it into individual */
+ /* segments and Bézier arcs. This function is also able to emit */
/* `move to' and `close to' operations to indicate the start and end */
/* of new contours in the outline. */
/* */
/* <Input> */
/* outline :: A pointer to the source target. */
/* */
- /* func_interface :: A table of `emitters', i.e,. function pointers */
+ /* func_interface :: A table of `emitters', i.e., function pointers */
/* called during decomposition to indicate path */
/* operations. */
/* */
+ /* <InOut> */
/* user :: A typeless pointer which is passed to each */
/* emitter during the decomposition. It can be */
/* used to store the state during the */
@@ -1375,17 +1414,13 @@
/* <Return> */
/* Error code. 0 means success. */
/* */
- static
- int FT_Outline_Decompose( const FT_Outline* outline,
- const FT_Outline_Funcs* func_interface,
- void* user )
+ static int
+ FT_Outline_Decompose( const FT_Outline* outline,
+ const FT_Outline_Funcs* func_interface,
+ void* user )
{
#undef SCALED
-#if 0
#define SCALED( x ) ( ( (x) << shift ) - delta )
-#else
-#define SCALED( x ) (x)
-#endif
FT_Vector v_last;
FT_Vector v_control;
@@ -1395,17 +1430,21 @@
FT_Vector* limit;
char* tags;
+ int error;
+
int n; /* index of contour in outline */
int first; /* index of first point in contour */
- int error;
char tag; /* current point's state */
-#if 0
- int shift = func_interface->shift;
- TPos delta = func_interface->delta;
-#endif
+ int shift;
+ TPos delta;
+ if ( !outline || !func_interface )
+ return ErrRaster_Invalid_Argument;
+
+ shift = func_interface->shift;
+ delta = func_interface->delta;
first = 0;
for ( n = 0; n < outline->n_contours; n++ )
@@ -1413,22 +1452,25 @@
int last; /* index of last point in contour */
+ FT_TRACE5(( "FT_Outline_Decompose: Outline %d\n", n ));
+
last = outline->contours[n];
+ if ( last < 0 )
+ goto Invalid_Outline;
limit = outline->points + last;
- v_start = outline->points[first];
- v_last = outline->points[last];
-
+ v_start = outline->points[first];
v_start.x = SCALED( v_start.x );
v_start.y = SCALED( v_start.y );
- v_last.x = SCALED( v_last.x );
- v_last.y = SCALED( v_last.y );
+ v_last = outline->points[last];
+ v_last.x = SCALED( v_last.x );
+ v_last.y = SCALED( v_last.y );
v_control = v_start;
point = outline->points + first;
- tags = outline->tags + first;
+ tags = outline->tags + first;
tag = FT_CURVE_TAG( tags[0] );
/* A contour cannot start with a cubic control point! */
@@ -1459,6 +1501,8 @@
tags--;
}
+ FT_TRACE5(( " move to (%.2f, %.2f)\n",
+ v_start.x / 64.0, v_start.y / 64.0 ));
error = func_interface->move_to( &v_start, user );
if ( error )
goto Exit;
@@ -1479,6 +1523,8 @@
vec.x = SCALED( point->x );
vec.y = SCALED( point->y );
+ FT_TRACE5(( " line to (%.2f, %.2f)\n",
+ vec.x / 64.0, vec.y / 64.0 ));
error = func_interface->line_to( &vec, user );
if ( error )
goto Exit;
@@ -1486,53 +1532,60 @@
}
case FT_CURVE_TAG_CONIC: /* consume conic arcs */
- {
- v_control.x = SCALED( point->x );
- v_control.y = SCALED( point->y );
-
- Do_Conic:
- if ( point < limit )
- {
- FT_Vector vec;
- FT_Vector v_middle;
+ v_control.x = SCALED( point->x );
+ v_control.y = SCALED( point->y );
+ Do_Conic:
+ if ( point < limit )
+ {
+ FT_Vector vec;
+ FT_Vector v_middle;
- point++;
- tags++;
- tag = FT_CURVE_TAG( tags[0] );
-
- vec.x = SCALED( point->x );
- vec.y = SCALED( point->y );
-
- if ( tag == FT_CURVE_TAG_ON )
- {
- error = func_interface->conic_to( &v_control, &vec,
- user );
- if ( error )
- goto Exit;
- continue;
- }
- if ( tag != FT_CURVE_TAG_CONIC )
- goto Invalid_Outline;
+ point++;
+ tags++;
+ tag = FT_CURVE_TAG( tags[0] );
- v_middle.x = ( v_control.x + vec.x ) / 2;
- v_middle.y = ( v_control.y + vec.y ) / 2;
+ vec.x = SCALED( point->x );
+ vec.y = SCALED( point->y );
- error = func_interface->conic_to( &v_control, &v_middle,
- user );
+ if ( tag == FT_CURVE_TAG_ON )
+ {
+ FT_TRACE5(( " conic to (%.2f, %.2f)"
+ " with control (%.2f, %.2f)\n",
+ vec.x / 64.0, vec.y / 64.0,
+ v_control.x / 64.0, v_control.y / 64.0 ));
+ error = func_interface->conic_to( &v_control, &vec, user );
if ( error )
goto Exit;
-
- v_control = vec;
- goto Do_Conic;
+ continue;
}
- error = func_interface->conic_to( &v_control, &v_start,
- user );
- goto Close;
+ if ( tag != FT_CURVE_TAG_CONIC )
+ goto Invalid_Outline;
+
+ v_middle.x = ( v_control.x + vec.x ) / 2;
+ v_middle.y = ( v_control.y + vec.y ) / 2;
+
+ FT_TRACE5(( " conic to (%.2f, %.2f)"
+ " with control (%.2f, %.2f)\n",
+ v_middle.x / 64.0, v_middle.y / 64.0,
+ v_control.x / 64.0, v_control.y / 64.0 ));
+ error = func_interface->conic_to( &v_control, &v_middle, user );
+ if ( error )
+ goto Exit;
+
+ v_control = vec;
+ goto Do_Conic;
}
+ FT_TRACE5(( " conic to (%.2f, %.2f)"
+ " with control (%.2f, %.2f)\n",
+ v_start.x / 64.0, v_start.y / 64.0,
+ v_control.x / 64.0, v_control.y / 64.0 ));
+ error = func_interface->conic_to( &v_control, &v_start, user );
+ goto Close;
+
default: /* FT_CURVE_TAG_CUBIC */
{
FT_Vector vec1, vec2;
@@ -1559,12 +1612,22 @@
vec.x = SCALED( point->x );
vec.y = SCALED( point->y );
+ FT_TRACE5(( " cubic to (%.2f, %.2f)"
+ " with controls (%.2f, %.2f) and (%.2f, %.2f)\n",
+ vec.x / 64.0, vec.y / 64.0,
+ vec1.x / 64.0, vec1.y / 64.0,
+ vec2.x / 64.0, vec2.y / 64.0 ));
error = func_interface->cubic_to( &vec1, &vec2, &vec, user );
if ( error )
goto Exit;
continue;
}
+ FT_TRACE5(( " cubic to (%.2f, %.2f)"
+ " with controls (%.2f, %.2f) and (%.2f, %.2f)\n",
+ v_start.x / 64.0, v_start.y / 64.0,
+ vec1.x / 64.0, vec1.y / 64.0,
+ vec2.x / 64.0, vec2.y / 64.0 ));
error = func_interface->cubic_to( &vec1, &vec2, &v_start, user );
goto Close;
}
@@ -1572,6 +1635,8 @@
}
/* close the contour with a line segment */
+ FT_TRACE5(( " line to (%.2f, %.2f)\n",
+ v_start.x / 64.0, v_start.y / 64.0 ));
error = func_interface->line_to( &v_start, user );
Close:
@@ -1581,9 +1646,11 @@
first = last + 1;
}
+ FT_TRACE5(( "FT_Outline_Decompose: Done\n", n ));
return 0;
Exit:
+ FT_TRACE5(( "FT_Outline_Decompose: Error %d\n", error ));
return error;
Invalid_Outline:
@@ -1616,15 +1683,14 @@
volatile int error = 0;
+
if ( ft_setjmp( ras.jump_buffer ) == 0 )
{
error = FT_Outline_Decompose( &ras.outline, &func_interface, &ras );
gray_record_cell( RAS_VAR );
}
else
- {
error = ErrRaster_Memory_Overflow;
- }
return error;
}
@@ -1666,7 +1732,7 @@
ras.cubic_level = 16;
{
- int level = 0;
+ int level = 0;
if ( ras.count_ex > 24 || ras.count_ey > 24 )
@@ -1678,10 +1744,12 @@
ras.cubic_level <<= level;
}
- /* setup vertical bands */
+ /* set up vertical bands */
num_bands = (int)( ( ras.max_ey - ras.min_ey ) / ras.band_size );
- if ( num_bands == 0 ) num_bands = 1;
- if ( num_bands >= 39 ) num_bands = 39;
+ if ( num_bands == 0 )
+ num_bands = 1;
+ if ( num_bands >= 39 )
+ num_bands = 39;
ras.band_shoot = 0;
@@ -1760,8 +1828,8 @@
/* be some problems. */
if ( middle == bottom )
{
-#ifdef DEBUG_GRAYS
- fprintf( stderr, "Rotten glyph!\n" );
+#ifdef FT_DEBUG_LEVEL_TRACE
+ FT_TRACE7(( "gray_convert_glyph: Rotten glyph!\n" ));
#endif
return 1;
}
@@ -1813,7 +1881,7 @@
worker = raster->worker;
/* if direct mode is not set, we must have a target bitmap */
- if ( ( params->flags & FT_RASTER_FLAG_DIRECT ) == 0 )
+ if ( !( params->flags & FT_RASTER_FLAG_DIRECT ) )
{
if ( !target_map )
return ErrRaster_Invalid_Argument;
@@ -1831,7 +1899,7 @@
return ErrRaster_Invalid_Mode;
/* compute clipping box */
- if ( ( params->flags & FT_RASTER_FLAG_DIRECT ) == 0 )
+ if ( !( params->flags & FT_RASTER_FLAG_DIRECT ) )
{
/* compute clip box from target pixmap */
ras.clip_box.xMin = 0;
@@ -1840,9 +1908,7 @@
ras.clip_box.yMax = target_map->rows;
}
else if ( params->flags & FT_RASTER_FLAG_CLIP )
- {
ras.clip_box = params->clip_box;
- }
else
{
ras.clip_box.xMin = -32768L;
@@ -1859,24 +1925,24 @@
ras.band_size = raster->band_size;
ras.num_gray_spans = 0;
- if ( target_map )
- ras.target = *target_map;
-
- ras.render_span = (FT_Raster_Span_Func)gray_render_span;
- ras.render_span_data = &ras;
-
if ( params->flags & FT_RASTER_FLAG_DIRECT )
{
ras.render_span = (FT_Raster_Span_Func)params->gray_spans;
ras.render_span_data = params->user;
}
+ else
+ {
+ ras.target = *target_map;
+ ras.render_span = (FT_Raster_Span_Func)gray_render_span;
+ ras.render_span_data = &ras;
+ }
return gray_convert_glyph( worker );
}
- /**** RASTER OBJECT CREATION: In standalone mode, we simply use *****/
- /**** a static object. *****/
+ /**** RASTER OBJECT CREATION: In stand-alone mode, we simply use *****/
+ /**** a static object. *****/
#ifdef _STANDALONE_
@@ -1984,3 +2050,8 @@
/* END */
+
+
+/* Local Variables: */
+/* coding: utf-8 */
+/* End: */
diff --git a/src/3rdparty/freetype/src/smooth/ftsmooth.c b/src/3rdparty/freetype/src/smooth/ftsmooth.c
index 85d04eb45..a6db5048d 100644
--- a/src/3rdparty/freetype/src/smooth/ftsmooth.c
+++ b/src/3rdparty/freetype/src/smooth/ftsmooth.c
@@ -4,7 +4,7 @@
/* */
/* Anti-aliasing renderer interface (body). */
/* */
-/* Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006 by */
+/* Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -294,13 +294,13 @@
for ( hh = height_org; hh > 0; hh-- )
{
- memcpy( write, read, pitch );
+ ft_memcpy( write, read, pitch );
write += pitch;
- memcpy( write, read, pitch );
+ ft_memcpy( write, read, pitch );
write += pitch;
- memcpy( write, read, pitch );
+ ft_memcpy( write, read, pitch );
write += pitch;
read += pitch;
}
diff --git a/src/3rdparty/freetype/src/smooth/module.mk b/src/3rdparty/freetype/src/smooth/module.mk
index 05ad4ba0a..47f6c0407 100644
--- a/src/3rdparty/freetype/src/smooth/module.mk
+++ b/src/3rdparty/freetype/src/smooth/module.mk
@@ -16,11 +16,11 @@
FTMODULE_H_COMMANDS += SMOOTH_RENDERER
define SMOOTH_RENDERER
-$(OPEN_DRIVER)ft_smooth_renderer_class$(CLOSE_DRIVER)
+$(OPEN_DRIVER) FT_Renderer_Class, ft_smooth_renderer_class $(CLOSE_DRIVER)
$(ECHO_DRIVER)smooth $(ECHO_DRIVER_DESC)anti-aliased bitmap renderer$(ECHO_DRIVER_DONE)
-$(OPEN_DRIVER)ft_smooth_lcd_renderer_class$(CLOSE_DRIVER)
+$(OPEN_DRIVER) FT_Renderer_Class, ft_smooth_lcd_renderer_class $(CLOSE_DRIVER)
$(ECHO_DRIVER)smooth $(ECHO_DRIVER_DESC)anti-aliased bitmap renderer for LCDs$(ECHO_DRIVER_DONE)
-$(OPEN_DRIVER)ft_smooth_lcdv_renderer_class$(CLOSE_DRIVER)
+$(OPEN_DRIVER) FT_Renderer_Class, ft_smooth_lcdv_renderer_class $(CLOSE_DRIVER)
$(ECHO_DRIVER)smooth $(ECHO_DRIVER_DESC)anti-aliased bitmap renderer for vertical LCDs$(ECHO_DRIVER_DONE)
endef
diff --git a/src/3rdparty/freetype/src/tools/docmaker/content.py b/src/3rdparty/freetype/src/tools/docmaker/content.py
index c10a4edb8..0d76d19de 100644
--- a/src/3rdparty/freetype/src/tools/docmaker/content.py
+++ b/src/3rdparty/freetype/src/tools/docmaker/content.py
@@ -1,4 +1,5 @@
-# Content (c) 2002, 2004, 2006, 2007, 2008 David Turner <david@freetype.org>
+# Content (c) 2002, 2004, 2006, 2007, 2008, 2009
+# David Turner <david@freetype.org>
#
# This file contains routines used to parse the content of documentation
# comment blocks and build more structured objects out of them.
@@ -153,7 +154,7 @@ class DocField:
if mode == mode_code:
m = re_code_end.match( l )
if m and len( m.group( 1 ) ) <= margin:
- # that's it, we finised the code sequence
+ # that's it, we finished the code sequence
code = DocCode( 0, cur_lines )
self.items.append( code )
margin = -1
@@ -321,7 +322,7 @@ class DocSection:
self.blocks[block.name] = block
def process( self ):
- # lookup one block that contains a valid section description
+ # look up one block that contains a valid section description
for block in self.defs:
title = block.get_markup_text( "title" )
if title:
@@ -539,9 +540,10 @@ class DocBlock:
while start < end and not string.strip( source[end] ):
end = end - 1
- source = source[start:end + 1]
-
- self.code = source
+ if start == end:
+ self.code = []
+ else:
+ self.code = source[start:end + 1]
def location( self ):
return self.source.location()
diff --git a/src/3rdparty/freetype/src/tools/docmaker/sources.py b/src/3rdparty/freetype/src/tools/docmaker/sources.py
index dcfbf7dae..7b68c0701 100644
--- a/src/3rdparty/freetype/src/tools/docmaker/sources.py
+++ b/src/3rdparty/freetype/src/tools/docmaker/sources.py
@@ -1,4 +1,4 @@
-# Sources (c) 2002, 2003, 2004, 2006, 2007, 2008
+# Sources (c) 2002, 2003, 2004, 2006, 2007, 2008, 2009
# David Turner <david@freetype.org>
#
#
@@ -179,14 +179,14 @@ re_source_keywords = re.compile( '''\\b ( typedef |
##
## SOURCE BLOCK CLASS
##
-## A SourceProcessor is in charge or reading a C source file
+## A SourceProcessor is in charge of reading a C source file
## and decomposing it into a series of different "SourceBlocks".
## each one of these blocks can be made of the following data:
##
## - A documentation comment block that starts with "/**" and
## whose exact format will be discussed later
##
-## - normal sources lines, include comments
+## - normal sources lines, including comments
##
## the important fields in a text block are the following ones:
##
@@ -255,7 +255,7 @@ class SourceBlock:
##
## SOURCE PROCESSOR CLASS
##
-## The SourceProcessor is in charge or reading a C source file
+## The SourceProcessor is in charge of reading a C source file
## and decomposing it into a series of different "SourceBlock"
## objects.
##
@@ -301,7 +301,7 @@ class SourceProcessor:
self.process_normal_line( line )
else:
if self.format.end.match( line ):
- # that's a normal block end, add it to lines and
+ # that's a normal block end, add it to 'lines' and
# create a new block
self.lines.append( line )
self.add_block_lines()
diff --git a/src/3rdparty/freetype/src/tools/docmaker/tohtml.py b/src/3rdparty/freetype/src/tools/docmaker/tohtml.py
index 7e5c60866..fffa12097 100644
--- a/src/3rdparty/freetype/src/tools/docmaker/tohtml.py
+++ b/src/3rdparty/freetype/src/tools/docmaker/tohtml.py
@@ -15,9 +15,11 @@ html_header_1 = """\
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-<title>"""
+<title>\
+"""
-html_header_2= """ API Reference</title>
+html_header_2 = """\
+ API Reference</title>
<style type="text/css">
body { font-family: Verdana, Geneva, Arial, Helvetica, serif;
color: #000000;
@@ -45,16 +47,44 @@ html_header_2= """ API Reference</title>
</style>
</head>
<body>
-<center><h1>"""
+"""
+
+html_header_3 = """
+<table align=center><tr><td><font size=-1>[<a href="\
+"""
+
+html_header_3i = """
+<table align=center><tr><td width="100%"></td>
+<td><font size=-1>[<a href="\
+"""
+
+html_header_4 = """\
+">Index</a>]</font></td>
+<td width="100%"></td>
+<td><font size=-1>[<a href="\
+"""
+
+html_header_5 = """\
+">TOC</a>]</font></td></tr></table>
+<center><h1>\
+"""
+
+html_header_5t = """\
+">Index</a>]</font></td>
+<td width="100%"></td></tr></table>
+<center><h1>\
+"""
-html_header_3=""" API Reference</h1></center>
+html_header_6 = """\
+ API Reference</h1></center>
"""
# The HTML footer used by all generated pages.
html_footer = """\
</body>
-</html>"""
+</html>\
+"""
# The header and footer used for each section.
section_title_header = "<center><h1>"
@@ -110,12 +140,23 @@ chapter_footer = '</li></ul></td></tr></table>'
index_footer_start = """\
<hr>
<table><tr><td width="100%"></td>
-<td><font size=-2>[<a href="
+<td><font size=-2>[<a href="\
"""
index_footer_end = """\
">TOC</a>]</font></td></tr></table>
"""
+# TOC footer.
+toc_footer_start = """\
+<hr>
+<table><tr><td><font size=-2>[<a href="\
+"""
+toc_footer_end = """\
+">Index</a>]</font></td>
+<td width="100%"></td>
+</tr></table>
+"""
+
# source language keyword coloration/styling
keyword_prefix = '<span class="keyword">'
@@ -159,22 +200,39 @@ class HtmlFormatter( Formatter ):
def __init__( self, processor, project_title, file_prefix ):
Formatter.__init__( self, processor )
- global html_header_1, html_header_2, html_header_3, html_footer
+ global html_header_1, html_header_2, html_header_3
+ global html_header_4, html_header_5, html_footer
if file_prefix:
file_prefix = file_prefix + "-"
else:
file_prefix = ""
- self.headers = processor.headers
- self.project_title = project_title
- self.file_prefix = file_prefix
- self.html_header = html_header_1 + project_title + html_header_2 + \
- project_title + html_header_3
-
- self.html_footer = "<center><font size=""-2"">generated on " + \
- time.asctime( time.localtime( time.time() ) ) + \
- "</font></center>" + html_footer
+ self.headers = processor.headers
+ self.project_title = project_title
+ self.file_prefix = file_prefix
+ self.html_header = html_header_1 + project_title + \
+ html_header_2 + \
+ html_header_3 + file_prefix + "index.html" + \
+ html_header_4 + file_prefix + "toc.html" + \
+ html_header_5 + project_title + \
+ html_header_6
+
+ self.html_index_header = html_header_1 + project_title + \
+ html_header_2 + \
+ html_header_3i + file_prefix + "toc.html" + \
+ html_header_5 + project_title + \
+ html_header_6
+
+ self.html_toc_header = html_header_1 + project_title + \
+ html_header_2 + \
+ html_header_3 + file_prefix + "index.html" + \
+ html_header_5t + project_title + \
+ html_header_6
+
+ self.html_footer = "<center><font size=""-2"">generated on " + \
+ time.asctime( time.localtime( time.time() ) ) + \
+ "</font></center>" + html_footer
self.columns = 3
@@ -227,7 +285,7 @@ class HtmlFormatter( Formatter ):
return html_quote( word )
def make_html_para( self, words ):
- """ convert a paragraph's words into tagged HTML text, handle xrefs """
+ """ convert words of a paragraph into tagged HTML text, handle xrefs """
line = ""
if words:
line = self.make_html_word( words[0] )
@@ -237,6 +295,8 @@ class HtmlFormatter( Formatter ):
line = re.sub( r"(^|\W)`(.*?)'(\W|$)", \
r'\1&lsquo;\2&rsquo;\3', \
line )
+ # convert tilde into non-breakable space
+ line = string.replace( line, "~", "&nbsp;" )
return para_header + line + para_footer
@@ -338,7 +398,7 @@ class HtmlFormatter( Formatter ):
# Formatting the index
#
def index_enter( self ):
- print self.html_header
+ print self.html_index_header
self.index_items = {}
def index_name_enter( self, name ):
@@ -371,6 +431,8 @@ class HtmlFormatter( Formatter ):
self.file_prefix + "toc.html" + \
index_footer_end
+ print self.html_footer
+
self.index_items = {}
def index_dump( self, index_filename = None ):
@@ -383,7 +445,7 @@ class HtmlFormatter( Formatter ):
# Formatting the table of content
#
def toc_enter( self ):
- print self.html_header
+ print self.html_toc_header
print "<center><h1>Table of Contents</h1></center>"
def toc_chapter_enter( self, chapter ):
@@ -402,7 +464,7 @@ class HtmlFormatter( Formatter ):
def toc_chapter_exit( self, chapter ):
print "</table>"
- print chapter_footer
+ print chapter_footer
def toc_index( self, index_filename ):
print chapter_header + \
@@ -410,6 +472,10 @@ class HtmlFormatter( Formatter ):
chapter_inter + chapter_footer
def toc_exit( self ):
+ print toc_footer_start + \
+ self.file_prefix + "index.html" + \
+ toc_footer_end
+
print self.html_footer
def toc_dump( self, toc_filename = None, index_filename = None ):
diff --git a/src/3rdparty/freetype/src/tools/ftrandom/ftrandom.c b/src/3rdparty/freetype/src/tools/ftrandom/ftrandom.c
index fcff27bc3..4daac0dc1 100644
--- a/src/3rdparty/freetype/src/tools/ftrandom/ftrandom.c
+++ b/src/3rdparty/freetype/src/tools/ftrandom/ftrandom.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005 by George Williams */
+/* Copyright (C) 2005, 2007, 2008 by George Williams */
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -151,8 +151,8 @@
int load_flags = FT_LOAD_DEFAULT;
- if ( check_outlines &&
- ( face->face_flags & FT_FACE_FLAG_SCALABLE ) )
+ if ( check_outlines &&
+ FT_IS_SCALABLE( face ) )
load_flags = FT_LOAD_NO_BITMAP;
if ( nohints )
@@ -162,8 +162,8 @@
for ( gid = 0; gid < face->num_glyphs; ++gid )
{
- if ( check_outlines &&
- ( face->face_flags & FT_FACE_FLAG_SCALABLE ) )
+ if ( check_outlines &&
+ FT_IS_SCALABLE( face ) )
{
if ( !FT_Load_Glyph( face, gid, load_flags ) )
FT_Outline_Decompose( &face->glyph->outline, &outlinefuncs, NULL );
diff --git a/src/3rdparty/freetype/src/tools/glnames.py b/src/3rdparty/freetype/src/tools/glnames.py
index 9a6da3831..55573b22f 100644
--- a/src/3rdparty/freetype/src/tools/glnames.py
+++ b/src/3rdparty/freetype/src/tools/glnames.py
@@ -6,7 +6,7 @@
#
-# Copyright 1996-2000, 2003, 2005, 2007 by
+# Copyright 1996-2000, 2003, 2005, 2007, 2008 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
@@ -21,7 +21,7 @@
usage: %s <output-file>
This python script generates the glyph names tables defined in the
- PSNames module.
+ `psnames' module.
Its single argument is the name of the header file to be created.
"""
@@ -5011,7 +5011,7 @@ def dump_array( the_array, write, array_name ):
"""dumps a given encoding"""
write( " static const unsigned char " + array_name +
- "[" + repr( len( the_array ) ) + "] =\n" )
+ "[" + repr( len( the_array ) ) + "L] =\n" )
write( " {\n" )
line = ""
@@ -5067,7 +5067,7 @@ def main():
write( "/* */\n" )
write( "/* PostScript glyph names. */\n" )
write( "/* */\n" )
- write( "/* Copyright 2005 by */\n" )
+ write( "/* Copyright 2005, 2008 by */\n" )
write( "/* David Turner, Robert Wilhelm, and Werner Lemberg. */\n" )
write( "/* */\n" )
write( "/* This file is part of the FreeType project, and may only be used, */\n" )
@@ -5117,6 +5117,9 @@ def main():
* The lookup function to get the Unicode value for a given string
* is defined below the table.
*/
+
+#ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST
+
""" )
dump_array( dict_array, write, "ft_adobe_glyph_list" )
@@ -5219,6 +5222,8 @@ def main():
return 0;
}
+#endif /* FT_CONFIG_OPTION_ADOBE_GLYPH_LIST */
+
""" )
if 0: # generate unit test, or don't
diff --git a/src/3rdparty/freetype/src/truetype/module.mk b/src/3rdparty/freetype/src/truetype/module.mk
index 3b05afc7f..baee81a77 100644
--- a/src/3rdparty/freetype/src/truetype/module.mk
+++ b/src/3rdparty/freetype/src/truetype/module.mk
@@ -16,7 +16,7 @@
FTMODULE_H_COMMANDS += TRUETYPE_DRIVER
define TRUETYPE_DRIVER
-$(OPEN_DRIVER)tt_driver_class$(CLOSE_DRIVER)
+$(OPEN_DRIVER) FT_Driver_ClassRec, tt_driver_class $(CLOSE_DRIVER)
$(ECHO_DRIVER)truetype $(ECHO_DRIVER_DESC)Windows/Mac font files with extension *.ttf or *.ttc$(ECHO_DRIVER_DONE)
endef
diff --git a/src/3rdparty/freetype/src/truetype/ttdriver.c b/src/3rdparty/freetype/src/truetype/ttdriver.c
index c2cf45298..42feb05ed 100644
--- a/src/3rdparty/freetype/src/truetype/ttdriver.c
+++ b/src/3rdparty/freetype/src/truetype/ttdriver.c
@@ -4,7 +4,7 @@
/* */
/* TrueType font driver implementation (body). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by */
+/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -125,6 +125,49 @@
#undef PAIR_TAG
+ static FT_Error
+ tt_get_advances( FT_Face ttface,
+ FT_UInt start,
+ FT_UInt count,
+ FT_Int32 flags,
+ FT_Fixed *advances )
+ {
+ FT_UInt nn;
+ TT_Face face = (TT_Face) ttface;
+ FT_Bool check = FT_BOOL(
+ !( flags & FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ) );
+
+
+ /* XXX: TODO: check for sbits */
+
+ if ( flags & FT_LOAD_VERTICAL_LAYOUT )
+ {
+ for ( nn = 0; nn < count; nn++ )
+ {
+ FT_Short tsb;
+ FT_UShort ah;
+
+
+ TT_Get_VMetrics( face, start + nn, check, &tsb, &ah );
+ advances[nn] = ah;
+ }
+ }
+ else
+ {
+ for ( nn = 0; nn < count; nn++ )
+ {
+ FT_Short lsb;
+ FT_UShort aw;
+
+
+ TT_Get_HMetrics( face, start + nn, check, &lsb, &aw );
+ advances[nn] = aw;
+ }
+ }
+
+ return TT_Err_Ok;
+ }
+
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
@@ -229,7 +272,7 @@
/* glyph_index :: The index of the glyph in the font file. */
/* */
/* load_flags :: A flag indicating what to load for this glyph. The */
- /* FTLOAD_??? constants can be used to control the */
+ /* FT_LOAD_XXX constants can be used to control the */
/* glyph loading process (e.g., whether the outline */
/* should be scaled, whether to load bitmaps or not, */
/* whether to hint the outline, etc). */
@@ -258,11 +301,24 @@
if ( !face || glyph_index >= (FT_UInt)face->num_glyphs )
return TT_Err_Invalid_Argument;
+ if ( load_flags & FT_LOAD_NO_HINTING )
+ {
+ /* both FT_LOAD_NO_HINTING and FT_LOAD_NO_AUTOHINT */
+ /* are necessary to disable hinting for tricky fonts */
+
+ if ( FT_IS_TRICKY( face ) )
+ load_flags &= ~FT_LOAD_NO_HINTING;
+
+ if ( load_flags & FT_LOAD_NO_AUTOHINT )
+ load_flags |= FT_LOAD_NO_HINTING;
+ }
+
if ( load_flags & ( FT_LOAD_NO_RECURSE | FT_LOAD_NO_SCALE ) )
{
- load_flags |= FT_LOAD_NO_HINTING |
- FT_LOAD_NO_BITMAP |
- FT_LOAD_NO_SCALE;
+ load_flags |= FT_LOAD_NO_BITMAP | FT_LOAD_NO_SCALE;
+
+ if ( !FT_IS_TRICKY( face ) )
+ load_flags |= FT_LOAD_NO_HINTING;
}
/* now load the glyph outline if necessary */
@@ -404,7 +460,7 @@
tt_get_kerning,
0, /* FT_Face_AttachFunc */
- 0, /* FT_Face_GetAdvancesFunc */
+ tt_get_advances,
tt_size_request,
#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
diff --git a/src/3rdparty/freetype/src/truetype/ttgload.c b/src/3rdparty/freetype/src/truetype/ttgload.c
index f6d6f9fcd..06e9ccd1d 100644
--- a/src/3rdparty/freetype/src/truetype/ttgload.c
+++ b/src/3rdparty/freetype/src/truetype/ttgload.c
@@ -69,12 +69,12 @@
/* `check' is true, take care of monospaced fonts by returning the */
/* advance width maximum. */
/* */
- static void
- Get_HMetrics( TT_Face face,
- FT_UInt idx,
- FT_Bool check,
- FT_Short* lsb,
- FT_UShort* aw )
+ FT_LOCAL_DEF(void)
+ TT_Get_HMetrics( TT_Face face,
+ FT_UInt idx,
+ FT_Bool check,
+ FT_Short* lsb,
+ FT_UShort* aw )
{
( (SFNT_Service)face->sfnt )->get_metrics( face, 0, idx, lsb, aw );
@@ -96,12 +96,12 @@
/* The monospace `check' is probably not meaningful here, but we leave */
/* it in for a consistent interface. */
/* */
- static void
- Get_VMetrics( TT_Face face,
- FT_UInt idx,
- FT_Bool check,
- FT_Short* tsb,
- FT_UShort* ah )
+ FT_LOCAL_DEF(void)
+ TT_Get_VMetrics( TT_Face face,
+ FT_UInt idx,
+ FT_Bool check,
+ FT_Short* tsb,
+ FT_UShort* ah )
{
FT_UNUSED( check );
@@ -382,8 +382,8 @@
for ( ; vec < vec_limit; vec++, flag++ )
{
- FT_Pos y = 0;
- FT_Byte f = *flag;
+ FT_Pos y = 0;
+ FT_Byte f = *flag;
if ( f & 2 )
@@ -405,7 +405,8 @@
x += y;
vec->x = x;
- *flag = f & ~( 2 | 16 );
+ /* the cast is for stupid compilers */
+ *flag = (FT_Byte)( f & ~( 2 | 16 ) );
}
/* reading the Y coordinates */
@@ -417,8 +418,8 @@
for ( ; vec < vec_limit; vec++, flag++ )
{
- FT_Pos y = 0;
- FT_Byte f = *flag;
+ FT_Pos y = 0;
+ FT_Byte f = *flag;
if ( f & 4 )
@@ -440,7 +441,8 @@
x += y;
vec->y = x;
- *flag = f & FT_CURVE_TAG_ON;
+ /* the cast is for stupid compilers */
+ *flag = (FT_Byte)( f & FT_CURVE_TAG_ON );
}
outline->n_points = (FT_UShort)n_points;
@@ -557,10 +559,10 @@
FT_Stream stream = loader->stream;
- /* we must undo the FT_FRAME_ENTER in order to point to the */
- /* composite instructions, if we find some. */
- /* we will process them later... */
- /* */
+ /* we must undo the FT_FRAME_ENTER in order to point */
+ /* to the composite instructions, if we find some. */
+ /* We will process them later. */
+ /* */
loader->ins_pos = (FT_ULong)( FT_STREAM_POS() +
p - limit );
}
@@ -1143,16 +1145,16 @@
FT_UShort advance_width = 0, advance_height = 0;
- Get_HMetrics( face, glyph_index,
- (FT_Bool)!( loader->load_flags &
- FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ),
- &left_bearing,
- &advance_width );
- Get_VMetrics( face, glyph_index,
- (FT_Bool)!( loader->load_flags &
- FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ),
- &top_bearing,
- &advance_height );
+ TT_Get_HMetrics( face, glyph_index,
+ (FT_Bool)!( loader->load_flags &
+ FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ),
+ &left_bearing,
+ &advance_width );
+ TT_Get_VMetrics( face, glyph_index,
+ (FT_Bool)!( loader->load_flags &
+ FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ),
+ &top_bearing,
+ &advance_height );
#ifdef FT_CONFIG_OPTION_INCREMENTAL
@@ -1243,6 +1245,13 @@
if ( loader->byte_len > 0 )
{
+ if ( !loader->glyf_offset )
+ {
+ FT_TRACE2(( "no `glyf' table but non-zero `loca' entry!\n" ));
+ error = TT_Err_Invalid_Table;
+ goto Exit;
+ }
+
error = face->access_glyph_frame( loader, glyph_index,
loader->glyf_offset + offset,
loader->byte_len );
@@ -1668,8 +1677,8 @@
}
/* adjust advance width to the value contained in the hdmx table */
- if ( !face->postscript.isFixedPitch &&
- IS_HINTED( loader->load_flags ) )
+ if ( !face->postscript.isFixedPitch &&
+ IS_HINTED( loader->load_flags ) )
{
FT_Byte* widthp;
@@ -1838,12 +1847,15 @@
FT_Error error = face->goto_table( face, TTAG_glyf, stream, 0 );
- if ( error )
+ if ( error == TT_Err_Table_Missing )
+ loader->glyf_offset = 0;
+ else if ( error )
{
FT_ERROR(( "TT_Load_Glyph: could not access glyph table\n" ));
return error;
}
- loader->glyf_offset = FT_STREAM_POS();
+ else
+ loader->glyf_offset = FT_STREAM_POS();
}
/* get face's glyph loader */
@@ -1855,7 +1867,7 @@
loader->gloader = gloader;
}
- loader->load_flags = load_flags;
+ loader->load_flags = load_flags;
loader->face = (FT_Face)face;
loader->size = (FT_Size)size;
@@ -1958,6 +1970,40 @@
FT_Outline_Translate( &glyph->outline, -loader.pp1.x, 0 );
}
+#ifdef TT_USE_BYTECODE_INTERPRETER
+
+ if ( IS_HINTED( load_flags ) )
+ {
+ if ( loader.exec->GS.scan_control )
+ {
+ /* convert scan conversion mode to FT_OUTLINE_XXX flags */
+ switch ( loader.exec->GS.scan_type )
+ {
+ case 0: /* simple drop-outs including stubs */
+ glyph->outline.flags |= FT_OUTLINE_INCLUDE_STUBS;
+ break;
+ case 1: /* simple drop-outs excluding stubs */
+ /* nothing; it's the default rendering mode */
+ break;
+ case 4: /* smart drop-outs including stubs */
+ glyph->outline.flags |= FT_OUTLINE_SMART_DROPOUTS |
+ FT_OUTLINE_INCLUDE_STUBS;
+ break;
+ case 5: /* smart drop-outs excluding stubs */
+ glyph->outline.flags |= FT_OUTLINE_SMART_DROPOUTS;
+ break;
+
+ default: /* no drop-out control */
+ glyph->outline.flags |= FT_OUTLINE_IGNORE_DROPOUTS;
+ break;
+ }
+ }
+ else
+ glyph->outline.flags |= FT_OUTLINE_IGNORE_DROPOUTS;
+ }
+
+#endif /* TT_USE_BYTECODE_INTERPRETER */
+
compute_glyph_metrics( &loader, glyph_index );
}
diff --git a/src/3rdparty/freetype/src/truetype/ttgload.h b/src/3rdparty/freetype/src/truetype/ttgload.h
index b261e97de..958d67d20 100644
--- a/src/3rdparty/freetype/src/truetype/ttgload.h
+++ b/src/3rdparty/freetype/src/truetype/ttgload.h
@@ -4,7 +4,7 @@
/* */
/* TrueType Glyph Loader (specification). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006 by */
+/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -34,6 +34,20 @@ FT_BEGIN_HEADER
FT_LOCAL( void )
TT_Init_Glyph_Loading( TT_Face face );
+ FT_LOCAL( void )
+ TT_Get_HMetrics( TT_Face face,
+ FT_UInt idx,
+ FT_Bool check,
+ FT_Short* lsb,
+ FT_UShort* aw );
+
+ FT_LOCAL( void )
+ TT_Get_VMetrics( TT_Face face,
+ FT_UInt idx,
+ FT_Bool check,
+ FT_Short* tsb,
+ FT_UShort* ah );
+
FT_LOCAL( FT_Error )
TT_Load_Glyph( TT_Size size,
TT_GlyphSlot glyph,
diff --git a/src/3rdparty/freetype/src/truetype/ttgxvar.c b/src/3rdparty/freetype/src/truetype/ttgxvar.c
index 0b3adbccf..515e734b8 100644
--- a/src/3rdparty/freetype/src/truetype/ttgxvar.c
+++ b/src/3rdparty/freetype/src/truetype/ttgxvar.c
@@ -905,13 +905,15 @@
}
else
{
- for ( i = 0;
- i < num_coords && blend->normalizedcoords[i] == coords[i];
- ++i );
- if ( i == num_coords )
- manageCvt = mcvt_retain;
- else
+ manageCvt = mcvt_retain;
+ for ( i = 0; i < num_coords; ++i )
+ {
+ if ( blend->normalizedcoords[i] != coords[i] )
+ {
manageCvt = mcvt_load;
+ break;
+ }
+ }
/* If we don't change the blend coords then we don't need to do */
/* anything to the cvt table. It will be correct. Otherwise we */
diff --git a/src/3rdparty/freetype/src/truetype/ttinterp.c b/src/3rdparty/freetype/src/truetype/ttinterp.c
index f9c36560e..2279a62cb 100644
--- a/src/3rdparty/freetype/src/truetype/ttinterp.c
+++ b/src/3rdparty/freetype/src/truetype/ttinterp.c
@@ -4,7 +4,7 @@
/* */
/* TrueType bytecode interpreter (body). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by */
+/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -693,7 +693,7 @@
/* exec :: A handle to the target execution context. */
/* */
/* <Return> */
- /* TrueTyoe error code. 0 means success. */
+ /* TrueType error code. 0 means success. */
/* */
/* <Note> */
/* Only the glyph loader and debugger should call this function. */
@@ -748,6 +748,13 @@
}
+ /* The default value for `scan_control' is documented as FALSE in the */
+ /* TrueType specification. This is confusing since it implies a */
+ /* Boolean value. However, this is not the case, thus both the */
+ /* default values of our `scan_type' and `scan_control' fields (which */
+ /* the documentation's `scan_control' variable is split into) are */
+ /* zero. */
+
const TT_GraphicsState tt_default_graphics_state =
{
0, 0, 0,
@@ -761,7 +768,7 @@
1, 64, 1,
TRUE, 68, 0, 0, 9, 3,
- 0, FALSE, 2, 1, 1, 1
+ 0, FALSE, 0, 1, 1, 1
};
@@ -5092,12 +5099,8 @@
return;
}
- A *= 64;
-
-#if 0
- if ( ( args[0] & 0x100 ) != 0 && CUR.metrics.pointSize <= A )
+ if ( ( args[0] & 0x100 ) != 0 && CUR.tt_metrics.ppem <= A )
CUR.GS.scan_control = TRUE;
-#endif
if ( ( args[0] & 0x200 ) != 0 && CUR.tt_metrics.rotated )
CUR.GS.scan_control = TRUE;
@@ -5105,10 +5108,8 @@
if ( ( args[0] & 0x400 ) != 0 && CUR.tt_metrics.stretched )
CUR.GS.scan_control = TRUE;
-#if 0
- if ( ( args[0] & 0x800 ) != 0 && CUR.metrics.pointSize > A )
+ if ( ( args[0] & 0x800 ) != 0 && CUR.tt_metrics.ppem > A )
CUR.GS.scan_control = FALSE;
-#endif
if ( ( args[0] & 0x1000 ) != 0 && CUR.tt_metrics.rotated )
CUR.GS.scan_control = FALSE;
@@ -5127,16 +5128,8 @@
static void
Ins_SCANTYPE( INS_ARG )
{
- /* for compatibility with future enhancements, */
- /* we must ignore new modes */
-
- if ( args[0] >= 0 && args[0] <= 5 )
- {
- if ( args[0] == 3 )
- args[0] = 2;
-
+ if ( args[0] >= 0 )
CUR.GS.scan_type = (FT_Int)args[0];
- }
}
@@ -6395,7 +6388,7 @@
{
scale_valid = 1;
scale = TT_MULDIV( org2 + delta2 - ( org1 + delta1 ),
- 0x10000, orus2 - orus1 );
+ 0x10000L, orus2 - orus1 );
}
x = ( org1 + delta1 ) +
diff --git a/src/3rdparty/freetype/src/truetype/ttobjs.c b/src/3rdparty/freetype/src/truetype/ttobjs.c
index 801559fe4..2649a670d 100644
--- a/src/3rdparty/freetype/src/truetype/ttobjs.c
+++ b/src/3rdparty/freetype/src/truetype/ttobjs.c
@@ -4,7 +4,7 @@
/* */
/* Objects manager (body). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by */
+/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -144,6 +144,39 @@
#endif /* TT_USE_BYTECODE_INTERPRETER */
+ /* Compare the face with a list of well-known `tricky' fonts. */
+ /* This list shall be expanded as we find more of them. */
+
+ static FT_Bool
+ tt_check_trickyness( FT_String* name )
+ {
+ static const char* const trick_names[] =
+ {
+ "DFKaiSho-SB", /* dfkaisb.ttf */
+ "DFKaiShu",
+ "DFKai-SB", /* kaiu.ttf */
+ "HuaTianSongTi?", /* htst3.ttf */
+ "MingLiU", /* mingliu.ttf & mingliu.ttc */
+ "PMingLiU", /* mingliu.ttc */
+ "MingLi43", /* mingli.ttf */
+ NULL
+ };
+ int nn;
+
+
+ if ( !name )
+ return FALSE;
+
+ /* Note that we only check the face name at the moment; it might */
+ /* be worth to do more checks for a few special cases. */
+ for ( nn = 0; trick_names[nn] != NULL; nn++ )
+ if ( ft_strstr( name, trick_names[nn] ) )
+ return TRUE;
+
+ return FALSE;
+ }
+
+
/*************************************************************************/
/* */
/* <Function> */
@@ -180,7 +213,7 @@
TT_Face face = (TT_Face)ttface;
- library = face->root.driver->root.library;
+ library = ttface->driver->root.library;
sfnt = (SFNT_Service)FT_Get_Module_Interface( library, "sfnt" );
if ( !sfnt )
goto Bad_Format;
@@ -206,7 +239,7 @@
}
#ifdef TT_USE_BYTECODE_INTERPRETER
- face->root.face_flags |= FT_FACE_FLAG_HINTER;
+ ttface->face_flags |= FT_FACE_FLAG_HINTER;
#endif
/* If we are performing a simple font format check, exit immediately. */
@@ -218,16 +251,19 @@
if ( error )
goto Exit;
+ if ( tt_check_trickyness( ttface->family_name ) )
+ ttface->face_flags |= FT_FACE_FLAG_TRICKY;
+
error = tt_face_load_hdmx( face, stream );
if ( error )
goto Exit;
- if ( face->root.face_flags & FT_FACE_FLAG_SCALABLE )
+ if ( FT_IS_SCALABLE( ttface ) )
{
#ifdef FT_CONFIG_OPTION_INCREMENTAL
- if ( !face->root.internal->incremental_interface )
+ if ( !ttface->internal->incremental_interface )
error = tt_face_load_loca( face, stream );
if ( !error )
error = tt_face_load_cvt( face, stream );
@@ -267,38 +303,8 @@
if ( params[i].tag == FT_PARAM_TAG_UNPATENTED_HINTING )
unpatented_hinting = TRUE;
- /* Compare the face with a list of well-known `tricky' fonts. */
- /* This list shall be expanded as we find more of them. */
if ( !unpatented_hinting )
- {
- static const char* const trick_names[] =
- {
- "DFKaiSho-SB", /* dfkaisb.ttf */
- "DFKai-SB", /* kaiu.ttf */
- "HuaTianSongTi?", /* htst3.ttf */
- "MingLiU", /* mingliu.ttf & mingliu.ttc */
- "PMingLiU", /* mingliu.ttc */
- "MingLi43", /* mingli.ttf */
- NULL
- };
- int nn;
-
-
- /* Note that we only check the face name at the moment; it might */
- /* be worth to do more checks for a few special cases. */
- for ( nn = 0; trick_names[nn] != NULL; nn++ )
- {
- if ( ttface->family_name &&
- ft_strstr( ttface->family_name, trick_names[nn] ) )
- {
- unpatented_hinting = 1;
- break;
- }
- }
- }
-
- ttface->internal->ignore_unpatented_hinter =
- FT_BOOL( !unpatented_hinting );
+ ttface->internal->ignore_unpatented_hinter = TRUE;
}
#endif /* TT_CONFIG_OPTION_UNPATENTED_HINTING &&
@@ -330,12 +336,18 @@
FT_LOCAL_DEF( void )
tt_face_done( FT_Face ttface ) /* TT_Face */
{
- TT_Face face = (TT_Face)ttface;
- FT_Memory memory = face->root.memory;
- FT_Stream stream = face->root.stream;
+ TT_Face face = (TT_Face)ttface;
+ FT_Memory memory;
+ FT_Stream stream;
+ SFNT_Service sfnt;
+
- SFNT_Service sfnt = (SFNT_Service)face->sfnt;
+ if ( !face )
+ return;
+ memory = ttface->memory;
+ stream = ttface->stream;
+ sfnt = (SFNT_Service)face->sfnt;
/* for `extended TrueType formats' (i.e. compressed versions) */
if ( face->extra.finalizer )
@@ -674,7 +686,7 @@
if ( !size->cvt_ready )
{
FT_UInt i;
- TT_Face face = (TT_Face) size->root.face;
+ TT_Face face = (TT_Face)size->root.face;
/* Scale the cvt values to the new ppem. */
diff --git a/src/3rdparty/freetype/src/truetype/ttobjs.h b/src/3rdparty/freetype/src/truetype/ttobjs.h
index 6971013af..d4b82285e 100644
--- a/src/3rdparty/freetype/src/truetype/ttobjs.h
+++ b/src/3rdparty/freetype/src/truetype/ttobjs.h
@@ -4,7 +4,7 @@
/* */
/* Objects manager (specification). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by */
+/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -99,6 +99,10 @@ FT_BEGIN_HEADER
FT_Short delta_shift;
FT_Byte instruct_control;
+ /* According to Greg Hitchcock from Microsoft, the `scan_control' */
+ /* variable as documented in the TrueType specification is a 32-bit */
+ /* integer; the high-word part holds the SCANTYPE value, the low-word */
+ /* part the SCANCTRL value. We separate it into two fields. */
FT_Bool scan_control;
FT_Int scan_type;
diff --git a/src/3rdparty/freetype/src/truetype/ttpload.c b/src/3rdparty/freetype/src/truetype/ttpload.c
index 9d3381bf0..dc538fb08 100644
--- a/src/3rdparty/freetype/src/truetype/ttpload.c
+++ b/src/3rdparty/freetype/src/truetype/ttpload.c
@@ -4,7 +4,7 @@
/* */
/* TrueType-specific tables loader (body). */
/* */
-/* Copyright 1996-2001, 2002, 2004, 2005, 2006, 2007 by */
+/* Copyright 1996-2001, 2002, 2004, 2005, 2006, 2007, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -65,11 +65,17 @@
{
FT_Error error;
FT_ULong table_len;
+ FT_Int shift;
/* we need the size of the `glyf' table for malformed `loca' tables */
error = face->goto_table( face, TTAG_glyf, stream, &face->glyf_len );
- if ( error )
+
+ /* it is possible that a font doesn't have a glyf table at all */
+ /* or its size is zero */
+ if ( error == TT_Err_Table_Missing )
+ face->glyf_len = 0;
+ else if ( error )
goto Exit;
FT_TRACE2(( "Locations " ));
@@ -82,23 +88,65 @@
if ( face->header.Index_To_Loc_Format != 0 )
{
+ shift = 2;
+
if ( table_len >= 0x40000L )
{
FT_TRACE2(( "table too large!\n" ));
error = TT_Err_Invalid_Table;
goto Exit;
}
- face->num_locations = (FT_UInt)( table_len >> 2 );
+ face->num_locations = (FT_UInt)( table_len >> shift );
}
else
{
+ shift = 1;
+
if ( table_len >= 0x20000L )
{
FT_TRACE2(( "table too large!\n" ));
error = TT_Err_Invalid_Table;
goto Exit;
}
- face->num_locations = (FT_UInt)( table_len >> 1 );
+ face->num_locations = (FT_UInt)( table_len >> shift );
+ }
+
+ if ( face->num_locations != (FT_UInt)face->root.num_glyphs )
+ {
+ FT_TRACE2(( "glyph count mismatch! loca: %d, maxp: %d\n",
+ face->num_locations, face->root.num_glyphs ));
+
+ /* we only handle the case where `maxp' gives a larger value */
+ if ( face->num_locations < (FT_UInt)face->root.num_glyphs )
+ {
+ FT_Long new_loca_len = (FT_Long)face->root.num_glyphs << shift;
+
+ TT_Table entry = face->dir_tables;
+ TT_Table limit = entry + face->num_tables;
+
+ FT_Long pos = FT_Stream_Pos( stream );
+ FT_Long dist = 0x7FFFFFFFL;
+
+
+ /* compute the distance to next table in font file */
+ for ( ; entry < limit; entry++ )
+ {
+ FT_Long diff = entry->Offset - pos;
+
+
+ if ( diff > 0 && diff < dist )
+ dist = diff;
+ }
+
+ if ( new_loca_len <= dist )
+ {
+ face->num_locations = (FT_Long)face->root.num_glyphs;
+ table_len = new_loca_len;
+
+ FT_TRACE2(( "adjusting num_locations to %d\n",
+ face->num_locations ));
+ }
+ }
}
/*
@@ -162,6 +210,9 @@
/* Anyway, there do exist (malformed) fonts which don't obey */
/* this rule, so we are only able to provide an upper bound for */
/* the size. */
+ /* */
+ /* We get (intentionally) a wrong, non-zero result in case the */
+ /* `glyf' table is missing. */
if ( pos2 >= pos1 )
*asize = (FT_UInt)( pos2 - pos1 );
else
diff --git a/src/3rdparty/freetype/src/type1/module.mk b/src/3rdparty/freetype/src/type1/module.mk
index baf98c00e..ade0210d7 100644
--- a/src/3rdparty/freetype/src/type1/module.mk
+++ b/src/3rdparty/freetype/src/type1/module.mk
@@ -16,7 +16,7 @@
FTMODULE_H_COMMANDS += TYPE1_DRIVER
define TYPE1_DRIVER
-$(OPEN_DRIVER)t1_driver_class$(CLOSE_DRIVER)
+$(OPEN_DRIVER) FT_Driver_ClassRec, t1_driver_class $(CLOSE_DRIVER)
$(ECHO_DRIVER)type1 $(ECHO_DRIVER_DESC)Postscript font files with extension *.pfa or *.pfb$(ECHO_DRIVER_DONE)
endef
diff --git a/src/3rdparty/freetype/src/type1/t1afm.c b/src/3rdparty/freetype/src/type1/t1afm.c
index b81a8df83..5aea58820 100644
--- a/src/3rdparty/freetype/src/type1/t1afm.c
+++ b/src/3rdparty/freetype/src/type1/t1afm.c
@@ -4,7 +4,7 @@
/* */
/* AFM support for Type 1 fonts (body). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by */
+/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -88,7 +88,12 @@
FT_ULong index2 = KERN_INDEX( pair2->index1, pair2->index2 );
- return (int)( index1 - index2 );
+ if ( index1 > index2 )
+ return 1;
+ else if ( index1 < index2 )
+ return -1;
+ else
+ return 0;
}
diff --git a/src/3rdparty/freetype/src/type1/t1driver.c b/src/3rdparty/freetype/src/type1/t1driver.c
index 3ca21dc17..8c398eee2 100644
--- a/src/3rdparty/freetype/src/type1/t1driver.c
+++ b/src/3rdparty/freetype/src/type1/t1driver.c
@@ -4,7 +4,7 @@
/* */
/* Type 1 driver interface (body). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2004, 2006, 2007 by */
+/* Copyright 1996-2001, 2002, 2003, 2004, 2006, 2007, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -84,6 +84,7 @@
return 0;
}
+
static const FT_Service_GlyphDictRec t1_service_glyph_dict =
{
(FT_GlyphDict_GetNameFunc) t1_get_glyph_name,
@@ -91,10 +92,10 @@
};
- /*
- * POSTSCRIPT NAME SERVICE
- *
- */
+ /*
+ * POSTSCRIPT NAME SERVICE
+ *
+ */
static const char*
t1_get_ps_name( T1_Face face )
@@ -102,16 +103,17 @@
return (const char*) face->type1.font_name;
}
+
static const FT_Service_PsFontNameRec t1_service_ps_name =
{
(FT_PsName_GetFunc)t1_get_ps_name
};
- /*
- * MULTIPLE MASTERS SERVICE
- *
- */
+ /*
+ * MULTIPLE MASTERS SERVICE
+ *
+ */
#ifndef T1_CONFIG_OPTION_NO_MM_SUPPORT
static const FT_Service_MultiMastersRec t1_service_multi_masters =
@@ -125,17 +127,28 @@
#endif
- /*
- * POSTSCRIPT INFO SERVICE
- *
- */
+ /*
+ * POSTSCRIPT INFO SERVICE
+ *
+ */
static FT_Error
t1_ps_get_font_info( FT_Face face,
PS_FontInfoRec* afont_info )
{
*afont_info = ((T1_Face)face)->type1.font_info;
- return 0;
+
+ return T1_Err_Ok;
+ }
+
+
+ static FT_Error
+ t1_ps_get_font_extra( FT_Face face,
+ PS_FontExtraRec* afont_extra )
+ {
+ *afont_extra = ((T1_Face)face)->type1.font_extra;
+
+ return T1_Err_Ok;
}
@@ -143,6 +156,7 @@
t1_ps_has_glyph_names( FT_Face face )
{
FT_UNUSED( face );
+
return 1;
}
@@ -152,17 +166,20 @@
PS_PrivateRec* afont_private )
{
*afont_private = ((T1_Face)face)->type1.private_dict;
- return 0;
+
+ return T1_Err_Ok;
}
static const FT_Service_PsInfoRec t1_service_ps_info =
{
(PS_GetFontInfoFunc) t1_ps_get_font_info,
+ (PS_GetFontExtraFunc) t1_ps_get_font_extra,
(PS_HasGlyphNamesFunc) t1_ps_has_glyph_names,
(PS_GetFontPrivateFunc)t1_ps_get_font_private,
};
+
#ifndef T1_CONFIG_OPTION_NO_AFM
static const FT_Service_KerningRec t1_service_kerning =
{
@@ -170,10 +187,11 @@
};
#endif
- /*
- * SERVICE LIST
- *
- */
+
+ /*
+ * SERVICE LIST
+ *
+ */
static const FT_ServiceDescRec t1_services[] =
{
@@ -304,7 +322,7 @@
(FT_Face_GetKerningFunc) Get_Kerning,
(FT_Face_AttachFunc) T1_Read_Metrics,
#endif
- (FT_Face_GetAdvancesFunc) 0,
+ (FT_Face_GetAdvancesFunc) T1_Get_Advances,
(FT_Size_RequestFunc) T1_Size_Request,
(FT_Size_SelectFunc) 0
};
diff --git a/src/3rdparty/freetype/src/type1/t1gload.c b/src/3rdparty/freetype/src/type1/t1gload.c
index e08a42897..c3ac13f59 100644
--- a/src/3rdparty/freetype/src/type1/t1gload.c
+++ b/src/3rdparty/freetype/src/type1/t1gload.c
@@ -4,7 +4,7 @@
/* */
/* Type 1 Glyph Loader (body). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006 by */
+/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -203,6 +203,65 @@
FT_LOCAL_DEF( FT_Error )
+ T1_Get_Advances( T1_Face face,
+ FT_UInt first,
+ FT_UInt count,
+ FT_ULong load_flags,
+ FT_Fixed* advances )
+ {
+ T1_DecoderRec decoder;
+ T1_Font type1 = &face->type1;
+ PSAux_Service psaux = (PSAux_Service)face->psaux;
+ FT_UInt nn;
+ FT_Error error;
+
+ FT_UNUSED( load_flags );
+
+
+ if ( load_flags & FT_LOAD_VERTICAL_LAYOUT )
+ {
+ for ( nn = 0; nn < count; nn++ )
+ advances[nn] = 0;
+
+ return T1_Err_Ok;
+ }
+
+ error = psaux->t1_decoder_funcs->init( &decoder,
+ (FT_Face)face,
+ 0, /* size */
+ 0, /* glyph slot */
+ (FT_Byte**)type1->glyph_names,
+ face->blend,
+ 0,
+ FT_RENDER_MODE_NORMAL,
+ T1_Parse_Glyph );
+ if ( error )
+ return error;
+
+ decoder.builder.metrics_only = 1;
+ decoder.builder.load_points = 0;
+
+ decoder.num_subrs = type1->num_subrs;
+ decoder.subrs = type1->subrs;
+ decoder.subrs_len = type1->subrs_len;
+
+ decoder.buildchar = face->buildchar;
+ decoder.len_buildchar = face->len_buildchar;
+
+ for ( nn = 0; nn < count; nn++ )
+ {
+ error = T1_Parse_Glyph( &decoder, first + nn );
+ if ( !error )
+ advances[nn] = decoder.builder.advance.x;
+ else
+ advances[nn] = 0;
+ }
+
+ return T1_Err_Ok;
+ }
+
+
+ FT_LOCAL_DEF( FT_Error )
T1_Load_Glyph( T1_GlyphSlot glyph,
T1_Size size,
FT_UInt glyph_index,
@@ -236,8 +295,16 @@
if ( load_flags & FT_LOAD_NO_RECURSE )
load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING;
- glyph->x_scale = size->root.metrics.x_scale;
- glyph->y_scale = size->root.metrics.y_scale;
+ if ( size )
+ {
+ glyph->x_scale = size->root.metrics.x_scale;
+ glyph->y_scale = size->root.metrics.y_scale;
+ }
+ else
+ {
+ glyph->x_scale = 0x10000L;
+ glyph->y_scale = 0x10000L;
+ }
glyph->root.outline.n_points = 0;
glyph->root.outline.n_contours = 0;
@@ -371,8 +438,8 @@
}
/* Then scale the metrics */
- metrics->horiAdvance = FT_MulFix( metrics->horiAdvance, x_scale );
- metrics->vertAdvance = FT_MulFix( metrics->vertAdvance, y_scale );
+ metrics->horiAdvance = FT_MulFix( metrics->horiAdvance, x_scale );
+ metrics->vertAdvance = FT_MulFix( metrics->vertAdvance, y_scale );
}
/* compute the other metrics */
diff --git a/src/3rdparty/freetype/src/type1/t1gload.h b/src/3rdparty/freetype/src/type1/t1gload.h
index de87896dc..100df06e8 100644
--- a/src/3rdparty/freetype/src/type1/t1gload.h
+++ b/src/3rdparty/freetype/src/type1/t1gload.h
@@ -4,7 +4,7 @@
/* */
/* Type 1 Glyph Loader (specification). */
/* */
-/* Copyright 1996-2001, 2002, 2003 by */
+/* Copyright 1996-2001, 2002, 2003, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -32,6 +32,13 @@ FT_BEGIN_HEADER
FT_Pos* max_advance );
FT_LOCAL( FT_Error )
+ T1_Get_Advances( T1_Face face,
+ FT_UInt first,
+ FT_UInt count,
+ FT_ULong load_flags,
+ FT_Fixed* advances );
+
+ FT_LOCAL( FT_Error )
T1_Load_Glyph( T1_GlyphSlot glyph,
T1_Size size,
FT_UInt glyph_index,
diff --git a/src/3rdparty/freetype/src/type1/t1load.c b/src/3rdparty/freetype/src/type1/t1load.c
index 9d7c748b3..06e72cca6 100644
--- a/src/3rdparty/freetype/src/type1/t1load.c
+++ b/src/3rdparty/freetype/src/type1/t1load.c
@@ -4,7 +4,7 @@
/* */
/* Type 1 font loader (body). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by */
+/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -230,7 +230,7 @@
if ( ncv <= axismap->blend_points[0] )
- return axismap->design_points[0];
+ return FT_INT_TO_FIXED( axismap->design_points[0] );
for ( j = 1; j < axismap->num_points; ++j )
{
@@ -241,8 +241,7 @@
axismap->blend_points[j] -
axismap->blend_points[j - 1] );
-
- return axismap->design_points[j - 1] +
+ return FT_INT_TO_FIXED( axismap->design_points[j - 1] ) +
FT_MulDiv( t,
axismap->design_points[j] -
axismap->design_points[j - 1],
@@ -250,7 +249,7 @@
}
}
- return axismap->design_points[axismap->num_points - 1];
+ return FT_INT_TO_FIXED( axismap->design_points[axismap->num_points - 1] );
}
@@ -337,8 +336,8 @@
mmvar->axis[i].def = ( mmvar->axis[i].minimum +
mmvar->axis[i].maximum ) / 2;
/* Does not apply. But this value is in range */
- mmvar->axis[i].strid = 0xFFFFFFFFUL; /* Does not apply */
- mmvar->axis[i].tag = 0xFFFFFFFFUL; /* Does not apply */
+ mmvar->axis[i].strid = (FT_UInt)-1; /* Does not apply */
+ mmvar->axis[i].tag = (FT_ULong)-1; /* Does not apply */
if ( ft_strcmp( mmvar->axis[i].name, "Weight" ) == 0 )
mmvar->axis[i].tag = FT_MAKE_TAG( 'w', 'g', 'h', 't' );
@@ -348,16 +347,15 @@
mmvar->axis[i].tag = FT_MAKE_TAG( 'o', 'p', 's', 'z' );
}
- if ( blend->num_designs == 1U << blend->num_axis )
+ if ( blend->num_designs == ( 1U << blend->num_axis ) )
{
mm_weights_unmap( blend->default_weight_vector,
axiscoords,
blend->num_axis );
for ( i = 0; i < mmaster.num_axis; ++i )
- mmvar->axis[i].def =
- FT_INT_TO_FIXED( mm_axis_unmap( &blend->design_map[i],
- axiscoords[i] ) );
+ mmvar->axis[i].def = mm_axis_unmap( &blend->design_map[i],
+ axiscoords[i] );
}
*master = mmvar;
@@ -950,6 +948,12 @@
}
break;
+ case T1_FIELD_LOCATION_FONT_EXTRA:
+ dummy_object = &face->type1.font_extra;
+ objects = &dummy_object;
+ max_objects = 0;
+ break;
+
case T1_FIELD_LOCATION_PRIVATE:
dummy_object = &face->type1.private_dict;
objects = &dummy_object;
@@ -1274,6 +1278,19 @@
n++;
}
+ else if ( only_immediates )
+ {
+ /* Since the current position is not updated for */
+ /* immediates-only mode we would get an infinite loop if */
+ /* we don't do anything here. */
+ /* */
+ /* This encoding array is not valid according to the type1 */
+ /* specification (it might be an encoding for a CID type1 */
+ /* font, however), so we conclude that this font is NOT a */
+ /* type1 font. */
+ parser->root.error = FT_Err_Unknown_File_Format;
+ return;
+ }
}
else
{
@@ -1319,9 +1336,9 @@
PS_Table table = &loader->subrs;
FT_Memory memory = parser->root.memory;
FT_Error error;
- FT_Int n, num_subrs;
+ FT_Int num_subrs;
- PSAux_Service psaux = (PSAux_Service)face->psaux;
+ PSAux_Service psaux = (PSAux_Service)face->psaux;
T1_Skip_Spaces( parser );
@@ -1355,18 +1372,17 @@
goto Fail;
}
- /* the format is simple: */
- /* */
- /* `index' + binary data */
- /* */
- for ( n = 0; n < num_subrs; n++ )
+ /* the format is simple: */
+ /* */
+ /* `index' + binary data */
+ /* */
+ for (;;)
{
FT_Long idx, size;
FT_Byte* base;
- /* If the next token isn't `dup', we are also done. This */
- /* happens when there are `holes' in the Subrs array. */
+ /* If the next token isn't `dup' we are done. */
if ( ft_strncmp( (char*)parser->root.cursor, "dup", 3 ) != 0 )
break;
@@ -1615,15 +1631,11 @@
}
}
- if ( loader->num_glyphs )
- return;
- else
- loader->num_glyphs = n;
+ loader->num_glyphs = n;
/* if /.notdef is found but does not occupy index 0, do our magic. */
- if ( ft_strcmp( (const char*)".notdef",
- (const char*)name_table->elements[0] ) &&
- notdef_found )
+ if ( notdef_found &&
+ ft_strcmp( ".notdef", (const char*)name_table->elements[0] ) )
{
/* Swap glyph in index 0 with /.notdef glyph. First, add index 0 */
/* name and code entries to swap_table. Then place notdef_index */
@@ -1692,7 +1704,7 @@
/* and add our own /.notdef glyph to index 0. */
/* 0 333 hsbw endchar */
- FT_Byte notdef_glyph[] = {0x8B, 0xF7, 0xE1, 0x0D, 0x0E};
+ FT_Byte notdef_glyph[] = { 0x8B, 0xF7, 0xE1, 0x0D, 0x0E };
char* notdef_name = (char *)".notdef";
@@ -1730,7 +1742,7 @@
goto Fail;
/* we added a glyph. */
- loader->num_glyphs = n + 1;
+ loader->num_glyphs += 1;
}
return;
diff --git a/src/3rdparty/freetype/src/type1/t1objs.c b/src/3rdparty/freetype/src/type1/t1objs.c
index 40b258fce..2f90dd62f 100644
--- a/src/3rdparty/freetype/src/type1/t1objs.c
+++ b/src/3rdparty/freetype/src/type1/t1objs.c
@@ -90,7 +90,7 @@
FT_LOCAL_DEF( FT_Error )
T1_Size_Init( T1_Size size )
{
- FT_Error error = 0;
+ FT_Error error = T1_Err_Ok;
PSH_Globals_Funcs funcs = T1_Size_Get_Globals_Funcs( size );
@@ -191,72 +191,75 @@
FT_LOCAL_DEF( void )
T1_Face_Done( T1_Face face )
{
- if ( face )
- {
- FT_Memory memory = face->root.memory;
- T1_Font type1 = &face->type1;
+ FT_Memory memory;
+ T1_Font type1;
+
+
+ if ( !face )
+ return;
+ memory = face->root.memory;
+ type1 = &face->type1;
#ifndef T1_CONFIG_OPTION_NO_MM_SUPPORT
- /* release multiple masters information */
- FT_ASSERT( ( face->len_buildchar == 0 ) == ( face->buildchar == NULL ) );
+ /* release multiple masters information */
+ FT_ASSERT( ( face->len_buildchar == 0 ) == ( face->buildchar == NULL ) );
- if ( face->buildchar )
- {
- FT_FREE( face->buildchar );
+ if ( face->buildchar )
+ {
+ FT_FREE( face->buildchar );
- face->buildchar = NULL;
- face->len_buildchar = 0;
- }
+ face->buildchar = NULL;
+ face->len_buildchar = 0;
+ }
- T1_Done_Blend( face );
- face->blend = 0;
+ T1_Done_Blend( face );
+ face->blend = 0;
#endif
- /* release font info strings */
- {
- PS_FontInfo info = &type1->font_info;
+ /* release font info strings */
+ {
+ PS_FontInfo info = &type1->font_info;
- FT_FREE( info->version );
- FT_FREE( info->notice );
- FT_FREE( info->full_name );
- FT_FREE( info->family_name );
- FT_FREE( info->weight );
- }
+ FT_FREE( info->version );
+ FT_FREE( info->notice );
+ FT_FREE( info->full_name );
+ FT_FREE( info->family_name );
+ FT_FREE( info->weight );
+ }
- /* release top dictionary */
- FT_FREE( type1->charstrings_len );
- FT_FREE( type1->charstrings );
- FT_FREE( type1->glyph_names );
+ /* release top dictionary */
+ FT_FREE( type1->charstrings_len );
+ FT_FREE( type1->charstrings );
+ FT_FREE( type1->glyph_names );
- FT_FREE( type1->subrs );
- FT_FREE( type1->subrs_len );
+ FT_FREE( type1->subrs );
+ FT_FREE( type1->subrs_len );
- FT_FREE( type1->subrs_block );
- FT_FREE( type1->charstrings_block );
- FT_FREE( type1->glyph_names_block );
+ FT_FREE( type1->subrs_block );
+ FT_FREE( type1->charstrings_block );
+ FT_FREE( type1->glyph_names_block );
- FT_FREE( type1->encoding.char_index );
- FT_FREE( type1->encoding.char_name );
- FT_FREE( type1->font_name );
+ FT_FREE( type1->encoding.char_index );
+ FT_FREE( type1->encoding.char_name );
+ FT_FREE( type1->font_name );
#ifndef T1_CONFIG_OPTION_NO_AFM
- /* release afm data if present */
- if ( face->afm_data )
- T1_Done_Metrics( memory, (AFM_FontInfo)face->afm_data );
+ /* release afm data if present */
+ if ( face->afm_data )
+ T1_Done_Metrics( memory, (AFM_FontInfo)face->afm_data );
#endif
- /* release unicode map, if any */
+ /* release unicode map, if any */
#if 0
- FT_FREE( face->unicode_map_rec.maps );
- face->unicode_map_rec.num_maps = 0;
- face->unicode_map = NULL;
+ FT_FREE( face->unicode_map_rec.maps );
+ face->unicode_map_rec.num_maps = 0;
+ face->unicode_map = NULL;
#endif
- face->root.family_name = 0;
- face->root.style_name = 0;
- }
+ face->root.family_name = NULL;
+ face->root.style_name = NULL;
}
@@ -323,7 +326,7 @@
goto Exit;
/* check the face index */
- if ( face_index != 0 )
+ if ( face_index > 0 )
{
FT_ERROR(( "T1_Face_Init: invalid face index\n" ));
error = T1_Err_Invalid_Argument;
@@ -340,7 +343,7 @@
root->num_glyphs = type1->num_glyphs;
- root->face_index = face_index;
+ root->face_index = 0;
root->face_flags = FT_FACE_FLAG_SCALABLE |
FT_FACE_FLAG_HORIZONTAL |
@@ -355,15 +358,19 @@
/* XXX: TODO -- add kerning with .afm support */
+
+ /* The following code to extract the family and the style is very */
+ /* simplistic and might get some things wrong. For a full-featured */
+ /* algorithm you might have a look at the whitepaper given at */
+ /* */
+ /* http://blogs.msdn.com/text/archive/2007/04/23/wpf-font-selection-model.aspx */
+
/* get style name -- be careful, some broken fonts only */
/* have a `/FontName' dictionary entry! */
root->family_name = info->family_name;
- /* assume "Regular" style if we don't know better */
- root->style_name = (char *)"Regular";
+ root->style_name = NULL;
- if ( info->weight )
- root->style_name = info->weight;
- else if ( root->family_name )
+ if ( root->family_name )
{
char* full = info->full_name;
char* family = root->family_name;
@@ -371,6 +378,9 @@
if ( full )
{
+ FT_Bool the_same = TRUE;
+
+
while ( *full )
{
if ( *full == *family )
@@ -386,12 +396,17 @@
family++;
else
{
+ the_same = FALSE;
+
if ( !*family )
root->style_name = full;
break;
}
}
}
+
+ if ( the_same )
+ root->style_name = (char *)"Regular";
}
}
else
@@ -401,6 +416,15 @@
root->family_name = type1->font_name;
}
+ if ( !root->style_name )
+ {
+ if ( info->weight )
+ root->style_name = info->weight;
+ else
+ /* assume `Regular' style because we don't know better */
+ root->style_name = (char *)"Regular";
+ }
+
/* compute style flags */
root->style_flags = 0;
if ( info->italic_angle )
@@ -445,7 +469,7 @@
if ( !error )
root->max_advance_width = (FT_Short)max_advance;
else
- error = 0; /* clear error */
+ error = T1_Err_Ok; /* clear error */
}
root->max_advance_height = root->height;
@@ -467,7 +491,7 @@
charmap.face = root;
- /* first of all, try to synthetize a Unicode charmap */
+ /* first of all, try to synthesize a Unicode charmap */
charmap.platform_id = 3;
charmap.encoding_id = 1;
charmap.encoding = FT_ENCODING_UNICODE;
diff --git a/src/3rdparty/freetype/src/type1/t1tokens.h b/src/3rdparty/freetype/src/type1/t1tokens.h
index 788c811b0..2d692f0e6 100644
--- a/src/3rdparty/freetype/src/type1/t1tokens.h
+++ b/src/3rdparty/freetype/src/type1/t1tokens.h
@@ -4,7 +4,7 @@
/* */
/* Type 1 tokenizer (specification). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2004, 2006 by */
+/* Copyright 1996-2001, 2002, 2003, 2004, 2006, 2008, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -42,6 +42,13 @@
T1_FIELD_NUM ( "UnderlineThickness", underline_thickness,
T1_FIELD_DICT_FONTDICT )
+#undef FT_STRUCTURE
+#define FT_STRUCTURE PS_FontExtraRec
+#undef T1CODE
+#define T1CODE T1_FIELD_LOCATION_FONT_EXTRA
+
+ T1_FIELD_NUM ( "FSType", fs_type,
+ T1_FIELD_DICT_FONTDICT )
#undef FT_STRUCTURE
#define FT_STRUCTURE PS_PrivateRec
@@ -87,7 +94,9 @@
T1_FIELD_FIXED ( "ExpansionFactor", expansion_factor,
T1_FIELD_DICT_PRIVATE )
-
+ T1_FIELD_BOOL ( "ForceBold", force_bold,
+ T1_FIELD_DICT_PRIVATE )
+
#undef FT_STRUCTURE
#define FT_STRUCTURE T1_FontRec
diff --git a/src/3rdparty/freetype/src/type42/module.mk b/src/3rdparty/freetype/src/type42/module.mk
index 8bd40a5cc..b3f10a8d3 100644
--- a/src/3rdparty/freetype/src/type42/module.mk
+++ b/src/3rdparty/freetype/src/type42/module.mk
@@ -16,7 +16,7 @@
FTMODULE_H_COMMANDS += TYPE42_DRIVER
define TYPE42_DRIVER
-$(OPEN_DRIVER)t42_driver_class$(CLOSE_DRIVER)
+$(OPEN_DRIVER) FT_Driver_ClassRec, t42_driver_class $(CLOSE_DRIVER)
$(ECHO_DRIVER)type42 $(ECHO_DRIVER_DESC)Type 42 font files with no known extension$(ECHO_DRIVER_DONE)
endef
diff --git a/src/3rdparty/freetype/src/type42/rules.mk b/src/3rdparty/freetype/src/type42/rules.mk
index 556306195..eac1081eb 100644
--- a/src/3rdparty/freetype/src/type42/rules.mk
+++ b/src/3rdparty/freetype/src/type42/rules.mk
@@ -3,7 +3,7 @@
#
-# Copyright 2002, 2003 by
+# Copyright 2002, 2003, 2008 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
@@ -32,7 +32,8 @@ T42_DRV_SRC := $(T42_DIR)/t42objs.c \
# Type42 driver headers
#
T42_DRV_H := $(T42_DRV_SRC:%.c=%.h) \
- $(T42_DIR)/t42error.h
+ $(T42_DIR)/t42error.h \
+ $(T42_DIR)/t42types.h
# Type42 driver object(s)
diff --git a/src/3rdparty/freetype/src/type42/t42drivr.c b/src/3rdparty/freetype/src/type42/t42drivr.c
index a6e4cf4b6..820c67961 100644
--- a/src/3rdparty/freetype/src/type42/t42drivr.c
+++ b/src/3rdparty/freetype/src/type42/t42drivr.c
@@ -4,7 +4,7 @@
/* */
/* High-level Type 42 driver interface (body). */
/* */
-/* Copyright 2002, 2003, 2004, 2006, 2007 by Roberto Alameda. */
+/* Copyright 2002, 2003, 2004, 2006, 2007, 2009 by Roberto Alameda. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
@@ -49,11 +49,11 @@
#define FT_COMPONENT trace_t42
- /*
- *
- * GLYPH DICT SERVICE
- *
- */
+ /*
+ *
+ * GLYPH DICT SERVICE
+ *
+ */
static FT_Error
t42_get_glyph_name( T42_Face face,
@@ -94,11 +94,11 @@
};
- /*
- *
- * POSTSCRIPT NAME SERVICE
- *
- */
+ /*
+ *
+ * POSTSCRIPT NAME SERVICE
+ *
+ */
static const char*
t42_get_ps_font_name( T42_Face face )
@@ -113,17 +113,28 @@
};
- /*
- *
- * POSTSCRIPT INFO SERVICE
- *
- */
+ /*
+ *
+ * POSTSCRIPT INFO SERVICE
+ *
+ */
static FT_Error
t42_ps_get_font_info( FT_Face face,
PS_FontInfoRec* afont_info )
{
*afont_info = ((T42_Face)face)->type1.font_info;
+
+ return T42_Err_Ok;
+ }
+
+
+ static FT_Error
+ t42_ps_get_font_extra( FT_Face face,
+ PS_FontExtraRec* afont_extra )
+ {
+ *afont_extra = ((T42_Face)face)->type1.font_extra;
+
return T42_Err_Ok;
}
@@ -132,6 +143,7 @@
t42_ps_has_glyph_names( FT_Face face )
{
FT_UNUSED( face );
+
return 1;
}
@@ -141,6 +153,7 @@
PS_PrivateRec* afont_private )
{
*afont_private = ((T42_Face)face)->type1.private_dict;
+
return T42_Err_Ok;
}
@@ -148,16 +161,17 @@
static const FT_Service_PsInfoRec t42_service_ps_info =
{
(PS_GetFontInfoFunc) t42_ps_get_font_info,
+ (PS_GetFontExtraFunc) t42_ps_get_font_extra,
(PS_HasGlyphNamesFunc) t42_ps_has_glyph_names,
(PS_GetFontPrivateFunc)t42_ps_get_font_private
};
- /*
- *
- * SERVICE LIST
- *
- */
+ /*
+ *
+ * SERVICE LIST
+ *
+ */
static const FT_ServiceDescRec t42_services[] =
{
diff --git a/src/3rdparty/freetype/src/type42/t42objs.c b/src/3rdparty/freetype/src/type42/t42objs.c
index db04fde36..16e9809ce 100644
--- a/src/3rdparty/freetype/src/type42/t42objs.c
+++ b/src/3rdparty/freetype/src/type42/t42objs.c
@@ -4,7 +4,7 @@
/* */
/* Type 42 objects manager (body). */
/* */
-/* Copyright 2002, 2003, 2004, 2005, 2006, 2007 by Roberto Alameda. */
+/* Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008 by Roberto Alameda. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
@@ -188,7 +188,7 @@
goto Exit;
/* check the face index */
- if ( face_index != 0 )
+ if ( face_index > 0 )
{
FT_ERROR(( "T42_Face_Init: invalid face index\n" ));
error = T42_Err_Invalid_Argument;
@@ -202,7 +202,7 @@
root->num_glyphs = type1->num_glyphs;
root->num_charmaps = 0;
- root->face_index = face_index;
+ root->face_index = 0;
root->face_flags = FT_FACE_FLAG_SCALABLE |
FT_FACE_FLAG_HORIZONTAL |
@@ -328,7 +328,7 @@
charmap.face = root;
- /* first of all, try to synthetize a Unicode charmap */
+ /* first of all, try to synthesize a Unicode charmap */
charmap.platform_id = 3;
charmap.encoding_id = 1;
charmap.encoding = FT_ENCODING_UNICODE;
@@ -392,50 +392,50 @@
FT_Memory memory;
- if ( face )
- {
- type1 = &face->type1;
- info = &type1->font_info;
- memory = face->root.memory;
+ if ( !face )
+ return;
+
+ type1 = &face->type1;
+ info = &type1->font_info;
+ memory = face->root.memory;
- /* delete internal ttf face prior to freeing face->ttf_data */
- if ( face->ttf_face )
- FT_Done_Face( face->ttf_face );
+ /* delete internal ttf face prior to freeing face->ttf_data */
+ if ( face->ttf_face )
+ FT_Done_Face( face->ttf_face );
- /* release font info strings */
- FT_FREE( info->version );
- FT_FREE( info->notice );
- FT_FREE( info->full_name );
- FT_FREE( info->family_name );
- FT_FREE( info->weight );
+ /* release font info strings */
+ FT_FREE( info->version );
+ FT_FREE( info->notice );
+ FT_FREE( info->full_name );
+ FT_FREE( info->family_name );
+ FT_FREE( info->weight );
- /* release top dictionary */
- FT_FREE( type1->charstrings_len );
- FT_FREE( type1->charstrings );
- FT_FREE( type1->glyph_names );
+ /* release top dictionary */
+ FT_FREE( type1->charstrings_len );
+ FT_FREE( type1->charstrings );
+ FT_FREE( type1->glyph_names );
- FT_FREE( type1->charstrings_block );
- FT_FREE( type1->glyph_names_block );
+ FT_FREE( type1->charstrings_block );
+ FT_FREE( type1->glyph_names_block );
- FT_FREE( type1->encoding.char_index );
- FT_FREE( type1->encoding.char_name );
- FT_FREE( type1->font_name );
+ FT_FREE( type1->encoding.char_index );
+ FT_FREE( type1->encoding.char_name );
+ FT_FREE( type1->font_name );
- FT_FREE( face->ttf_data );
+ FT_FREE( face->ttf_data );
#if 0
- /* release afm data if present */
- if ( face->afm_data )
- T1_Done_AFM( memory, (T1_AFM*)face->afm_data );
+ /* release afm data if present */
+ if ( face->afm_data )
+ T1_Done_AFM( memory, (T1_AFM*)face->afm_data );
#endif
- /* release unicode map, if any */
- FT_FREE( face->unicode_map.maps );
- face->unicode_map.num_maps = 0;
+ /* release unicode map, if any */
+ FT_FREE( face->unicode_map.maps );
+ face->unicode_map.num_maps = 0;
- face->root.family_name = 0;
- face->root.style_name = 0;
- }
+ face->root.family_name = 0;
+ face->root.style_name = 0;
}
@@ -519,7 +519,7 @@
FT_Activate_Size( size->ttsize );
- error = FT_Select_Size( face->ttf_face, strike_index );
+ error = FT_Select_Size( face->ttf_face, (FT_Int)strike_index );
if ( !error )
( (FT_Size)size )->metrics = face->ttf_face->size->metrics;
diff --git a/src/3rdparty/freetype/src/type42/t42parse.c b/src/3rdparty/freetype/src/type42/t42parse.c
index 7d8c267ce..b9e408c45 100644
--- a/src/3rdparty/freetype/src/type42/t42parse.c
+++ b/src/3rdparty/freetype/src/type42/t42parse.c
@@ -4,7 +4,8 @@
/* */
/* Type 42 font parser (body). */
/* */
-/* Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008 by Roberto Alameda. */
+/* Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */
+/* Roberto Alameda. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
@@ -70,6 +71,13 @@
T1_FIELD_NUM ( "UnderlineThickness", underline_thickness, 0 )
#undef FT_STRUCTURE
+#define FT_STRUCTURE PS_FontExtraRec
+#undef T1CODE
+#define T1CODE T1_FIELD_LOCATION_FONT_EXTRA
+
+ T1_FIELD_NUM ( "FSType", fs_type, 0 )
+
+#undef FT_STRUCTURE
#define FT_STRUCTURE T1_FontRec
#undef T1CODE
#define T1CODE T1_FIELD_LOCATION_FONT_DICT
diff --git a/src/3rdparty/freetype/src/type42/t42types.h b/src/3rdparty/freetype/src/type42/t42types.h
index 6626b0445..c7c2db490 100644
--- a/src/3rdparty/freetype/src/type42/t42types.h
+++ b/src/3rdparty/freetype/src/type42/t42types.h
@@ -4,7 +4,7 @@
/* */
/* Type 42 font data types (specification only). */
/* */
-/* Copyright 2002, 2003, 2006 by Roberto Alameda. */
+/* Copyright 2002, 2003, 2006, 2008 by Roberto Alameda. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
@@ -35,7 +35,9 @@ FT_BEGIN_HEADER
T1_FontRec type1;
const void* psnames;
const void* psaux;
+#if 0
const void* afm_data;
+#endif
FT_Byte* ttf_data;
FT_ULong ttf_size;
FT_Face ttf_face;
@@ -48,7 +50,7 @@ FT_BEGIN_HEADER
FT_END_HEADER
-#endif /* __T1TYPES_H__ */
+#endif /* __T42TYPES_H__ */
/* END */
diff --git a/src/3rdparty/freetype/src/winfonts/module.mk b/src/3rdparty/freetype/src/winfonts/module.mk
index 0ace3ae6d..b44d7f057 100644
--- a/src/3rdparty/freetype/src/winfonts/module.mk
+++ b/src/3rdparty/freetype/src/winfonts/module.mk
@@ -16,7 +16,7 @@
FTMODULE_H_COMMANDS += WINDOWS_DRIVER
define WINDOWS_DRIVER
-$(OPEN_DRIVER)winfnt_driver_class$(CLOSE_DRIVER)
+$(OPEN_DRIVER) FT_Driver_ClassRec, winfnt_driver_class $(CLOSE_DRIVER)
$(ECHO_DRIVER)winfnt $(ECHO_DRIVER_DESC)Windows bitmap fonts with extension *.fnt or *.fon$(ECHO_DRIVER_DONE)
endef
diff --git a/src/3rdparty/freetype/src/winfonts/winfnt.c b/src/3rdparty/freetype/src/winfonts/winfnt.c
index 833fb888a..f6e9859b4 100644
--- a/src/3rdparty/freetype/src/winfonts/winfnt.c
+++ b/src/3rdparty/freetype/src/winfonts/winfnt.c
@@ -360,7 +360,7 @@
if ( face_index >= font_count )
{
- error = FNT_Err_Bad_Argument;
+ error = FNT_Err_Invalid_Argument;
goto Exit;
}
else if ( face_index < 0 )
@@ -566,7 +566,7 @@
if ( face_index >= face->root.num_faces )
{
- error = FNT_Err_Bad_Argument;
+ error = FNT_Err_Invalid_Argument;
goto Exit;
}
}
@@ -612,8 +612,9 @@
char_code -= cmap->first;
if ( char_code < cmap->count )
- gindex = char_code + 1; /* we artificially increase the glyph index; */
- /* FNT_Load_Glyph reverts to the right one */
+ /* we artificially increase the glyph index; */
+ /* FNT_Load_Glyph reverts to the right one */
+ gindex = (FT_UInt)( char_code + 1 );
return gindex;
}
@@ -638,7 +639,7 @@
if ( char_code < cmap->count )
{
result = cmap->first + char_code;
- gindex = char_code + 1;
+ gindex = (FT_UInt)( char_code + 1 );
}
}
@@ -665,16 +666,18 @@
static void
FNT_Face_Done( FNT_Face face )
{
- if ( face )
- {
- FT_Memory memory = FT_FACE_MEMORY( face );
+ FT_Memory memory;
- fnt_font_done( face );
+ if ( !face )
+ return;
- FT_FREE( face->root.available_sizes );
- face->root.num_fixed_sizes = 0;
- }
+ memory = FT_FACE_MEMORY( face );
+
+ fnt_font_done( face );
+
+ FT_FREE( face->root.available_sizes );
+ face->root.num_fixed_sizes = 0;
}
@@ -716,7 +719,7 @@
if ( !error )
{
if ( face_index > 0 )
- error = FNT_Err_Bad_Argument;
+ error = FNT_Err_Invalid_Argument;
else if ( face_index < 0 )
goto Exit;
}
@@ -733,6 +736,8 @@
FT_PtrDist family_size;
+ root->face_index = face_index;
+
root->face_flags = FT_FACE_FLAG_FIXED_SIZES |
FT_FACE_FLAG_HORIZONTAL;
@@ -780,7 +785,7 @@
* => nominal_point_size contains incorrect value;
* use pixel_height as the nominal height
*/
- if ( bsize->y_ppem > font->header.pixel_height << 6 )
+ if ( bsize->y_ppem > ( font->header.pixel_height << 6 ) )
{
FT_TRACE2(( "use pixel_height as the nominal height\n" ));
@@ -909,7 +914,7 @@
switch ( req->type )
{
case FT_SIZE_REQUEST_TYPE_NOMINAL:
- if ( height == ( bsize->y_ppem + 32 ) >> 6 )
+ if ( height == ( ( bsize->y_ppem + 32 ) >> 6 ) )
error = FNT_Err_Ok;
break;