projects
/
reactos.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[CMAKE]
[reactos.git]
/
lib
/
3rdparty
/
freetype
/
src
/
autofit
/
afglobal.c
diff --git
a/lib/3rdparty/freetype/src/autofit/afglobal.c
b/lib/3rdparty/freetype/src/autofit/afglobal.c
index
1875f52
..
178c884
100644
(file)
--- a/
lib/3rdparty/freetype/src/autofit/afglobal.c
+++ b/
lib/3rdparty/freetype/src/autofit/afglobal.c
@@
-4,7
+4,7
@@
/* */
/* Auto-fitter routines to compute global hinting values (body). */
/* */
/* */
/* Auto-fitter routines to compute global hinting values (body). */
/* */
-/* Copyright 2003, 2004, 2005, 2006, 2007
by
*/
+/* Copyright 2003, 2004, 2005, 2006, 2007
, 2008, 2009, 2010 by
*/
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@
-21,6
+21,7
@@
#include "aflatin.h"
#include "afcjk.h"
#include "afindic.h"
#include "aflatin.h"
#include "afcjk.h"
#include "afindic.h"
+#include "afpic.h"
#include "aferrors.h"
#include "aferrors.h"
@@
-28,6
+29,11
@@
#include "aflatin2.h"
#endif
#include "aflatin2.h"
#endif
+#ifndef FT_CONFIG_OPTION_PIC
+
+/* when updating this table, don't forget to update
+ AF_SCRIPT_CLASSES_COUNT and autofit_module_class_pic_init */
+
/* populate this list when you add new scripts */
static AF_ScriptClass const af_script_classes[] =
{
/* populate this list when you add new scripts */
static AF_ScriptClass const af_script_classes[] =
{
@@
-37,14
+43,18
@@
#endif
&af_latin_script_class,
&af_cjk_script_class,
#endif
&af_latin_script_class,
&af_cjk_script_class,
- &af_indic_script_class,
+ &af_indic_script_class,
NULL /* do not remove */
};
NULL /* do not remove */
};
+#endif /* FT_CONFIG_OPTION_PIC */
+
/* index of default script in `af_script_classes' */
#define AF_SCRIPT_LIST_DEFAULT 2
/* index of default script in `af_script_classes' */
#define AF_SCRIPT_LIST_DEFAULT 2
- /* indicates an uncovered glyph */
-#define AF_SCRIPT_LIST_NONE 255
+ /* a bit mask indicating an uncovered glyph */
+#define AF_SCRIPT_LIST_NONE 0x7F
+ /* if this flag is set, we have an ASCII digit */
+#define AF_DIGIT 0x80
/*
/*
@@
-55,7
+65,7
@@
typedef struct AF_FaceGlobalsRec_
{
FT_Face face;
typedef struct AF_FaceGlobalsRec_
{
FT_Face face;
- FT_
UInt
glyph_count; /* same as face->num_glyphs */
+ FT_
Long
glyph_count; /* same as face->num_glyphs */
FT_Byte* glyph_scripts;
AF_ScriptMetrics metrics[AF_SCRIPT_MAX];
FT_Byte* glyph_scripts;
AF_ScriptMetrics metrics[AF_SCRIPT_MAX];
@@
-72,7
+82,7
@@
FT_Face face = globals->face;
FT_CharMap old_charmap = face->charmap;
FT_Byte* gscripts = globals->glyph_scripts;
FT_Face face = globals->face;
FT_CharMap old_charmap = face->charmap;
FT_Byte* gscripts = globals->glyph_scripts;
- FT_UInt ss;
+ FT_UInt ss
, i
;
/* the value 255 means `uncovered glyph' */
/* the value 255 means `uncovered glyph' */
@@
-84,17
+94,17
@@
if ( error )
{
/*
if ( error )
{
/*
- * Ignore this error; we simply use
Latin as the standard
- *
script.
XXX: Shouldn't we rather disable hinting?
+ * Ignore this error; we simply use
the default script.
+ * XXX: Shouldn't we rather disable hinting?
*/
error = AF_Err_Ok;
goto Exit;
}
/* scan each script in a Unicode charmap */
*/
error = AF_Err_Ok;
goto Exit;
}
/* scan each script in a Unicode charmap */
- for ( ss = 0;
af_script_classes
[ss]; ss++ )
+ for ( ss = 0;
AF_SCRIPT_CLASSES_GET
[ss]; ss++ )
{
{
- AF_ScriptClass clazz =
af_script_classes
[ss];
+ AF_ScriptClass clazz =
AF_SCRIPT_CLASSES_GET
[ss];
AF_Script_UniRange range;
AF_Script_UniRange range;
@@
-114,7
+124,7
@@
gindex = FT_Get_Char_Index( face, charcode );
if ( gindex != 0 &&
gindex = FT_Get_Char_Index( face, charcode );
if ( gindex != 0 &&
- gindex <
globals->glyph_count
&&
+ gindex <
(FT_ULong)globals->glyph_count
&&
gscripts[gindex] == AF_SCRIPT_LIST_NONE )
{
gscripts[gindex] = (FT_Byte)ss;
gscripts[gindex] == AF_SCRIPT_LIST_NONE )
{
gscripts[gindex] = (FT_Byte)ss;
@@
-127,7
+137,7
@@
if ( gindex == 0 || charcode > range->last )
break;
if ( gindex == 0 || charcode > range->last )
break;
- if ( gindex <
globals->glyph_count
&&
+ if ( gindex <
(FT_ULong)globals->glyph_count
&&
gscripts[gindex] == AF_SCRIPT_LIST_NONE )
{
gscripts[gindex] = (FT_Byte)ss;
gscripts[gindex] == AF_SCRIPT_LIST_NONE )
{
gscripts[gindex] = (FT_Byte)ss;
@@
-136,19
+146,32
@@
}
}
}
}
+ /* mark ASCII digits */
+ for ( i = 0x30; i <= 0x39; i++ )
+ {
+ FT_UInt gindex = FT_Get_Char_Index( face, i );
+
+
+ if ( gindex != 0 && gindex < (FT_ULong)globals->glyph_count )
+ gscripts[gindex] |= AF_DIGIT;
+ }
+
Exit:
/*
* By default, all uncovered glyphs are set to the latin script.
* XXX: Shouldn't we disable hinting or do something similar?
*/
{
Exit:
/*
* By default, all uncovered glyphs are set to the latin script.
* XXX: Shouldn't we disable hinting or do something similar?
*/
{
- FT_
UInt
nn;
+ FT_
Long
nn;
for ( nn = 0; nn < globals->glyph_count; nn++ )
{
for ( nn = 0; nn < globals->glyph_count; nn++ )
{
- if ( gscripts[nn] == AF_SCRIPT_LIST_NONE )
- gscripts[nn] = AF_SCRIPT_LIST_DEFAULT;
+ if ( ( gscripts[nn] & ~AF_DIGIT ) == AF_SCRIPT_LIST_NONE )
+ {
+ gscripts[nn] &= ~AF_SCRIPT_LIST_NONE;
+ gscripts[nn] |= AF_SCRIPT_LIST_DEFAULT;
+ }
}
}
}
}
@@
-163,7
+186,7
@@
{
FT_Error error;
FT_Memory memory;
{
FT_Error error;
FT_Memory memory;
- AF_FaceGlobals globals;
+ AF_FaceGlobals globals
= NULL
;
memory = face->memory;
memory = face->memory;
@@
-201,7
+224,7
@@
{
if ( globals->metrics[nn] )
{
{
if ( globals->metrics[nn] )
{
- AF_ScriptClass clazz =
af_script_classes
[nn];
+ AF_ScriptClass clazz =
AF_SCRIPT_CLASSES_GET
[nn];
FT_ASSERT( globals->metrics[nn]->clazz == clazz );
FT_ASSERT( globals->metrics[nn]->clazz == clazz );
@@
-232,12
+255,12
@@
FT_UInt gidx;
AF_ScriptClass clazz;
FT_UInt script = options & 15;
FT_UInt gidx;
AF_ScriptClass clazz;
FT_UInt script = options & 15;
- const FT_
UInt script_max = sizeof ( af_script_classes
) /
- sizeof (
af_script_classes
[0] );
+ const FT_
Offset script_max = sizeof ( AF_SCRIPT_CLASSES_GET
) /
+ sizeof (
AF_SCRIPT_CLASSES_GET
[0] );
FT_Error error = AF_Err_Ok;
FT_Error error = AF_Err_Ok;
- if ( gindex >= globals->glyph_count )
+ if ( gindex >=
(FT_ULong)
globals->glyph_count )
{
error = AF_Err_Invalid_Argument;
goto Exit;
{
error = AF_Err_Invalid_Argument;
goto Exit;
@@
-245,9
+268,9
@@
gidx = script;
if ( gidx == 0 || gidx + 1 >= script_max )
gidx = script;
if ( gidx == 0 || gidx + 1 >= script_max )
- gidx = globals->glyph_scripts[gindex];
+ gidx = globals->glyph_scripts[gindex]
& AF_SCRIPT_LIST_NONE
;
- clazz =
af_script_classes
[gidx];
+ clazz =
AF_SCRIPT_CLASSES_GET
[gidx];
if ( script == 0 )
script = clazz->script;
if ( script == 0 )
script = clazz->script;
@@
-286,4
+309,15
@@
}
}
+ FT_LOCAL_DEF( FT_Bool )
+ af_face_globals_is_digit( AF_FaceGlobals globals,
+ FT_UInt gindex )
+ {
+ if ( gindex < (FT_ULong)globals->glyph_count )
+ return (FT_Bool)( globals->glyph_scripts[gindex] & AF_DIGIT );
+
+ return (FT_Bool)0;
+ }
+
+
/* END */
/* END */