FreeType2: skip static lib, build custom source into libspectre.
This commit is contained in:
parent
093149e72c
commit
f5b7fa8178
247 changed files with 123377 additions and 88 deletions
21
bam.lua
21
bam.lua
|
|
@ -80,11 +80,7 @@ settings.cc.includes:Add("include/")
|
|||
settings.cc.includes:Add("source/")
|
||||
|
||||
-- FreeType2
|
||||
if TARGET_OS == "Win32" then
|
||||
settings.cc.includes:Add("vendor/FreeType2/include")
|
||||
else
|
||||
settings.cc.includes:Add("/usr/include/freetype2")
|
||||
end
|
||||
settings.cc.includes:Add("vendor/FreeType2/include")
|
||||
|
||||
-- STB
|
||||
settings.cc.includes:Add("vendor/stb/include")
|
||||
|
|
@ -194,6 +190,10 @@ local scene_module = Module("source/Scene", {
|
|||
-- Build target
|
||||
--------------------------------
|
||||
|
||||
-- Dependancies
|
||||
Import("vendor/FreeType2/build.lua")
|
||||
|
||||
-- engine
|
||||
local obj = Compile(settings, {
|
||||
system_module,
|
||||
platform_common_module,
|
||||
|
|
@ -209,7 +209,8 @@ local obj = Compile(settings, {
|
|||
|
||||
local libspectre = StaticLibrary(settings,
|
||||
"spectre",
|
||||
obj
|
||||
obj,
|
||||
ft2_obj
|
||||
)
|
||||
|
||||
--------------------------------
|
||||
|
|
@ -230,14 +231,6 @@ if TARGET_OS == "Win32" then
|
|||
|
||||
-- Windows needs to link against these.
|
||||
example_settings.link.libs:Add("opengl32", "gdi32", "user32")
|
||||
|
||||
-- Staticly link freetype on windows.
|
||||
example_settings.link.libpath:Add("vendor/FreeType2/lib/x86")
|
||||
if example_settings.debug > 0 then
|
||||
example_settings.link.libs:Add("freetype-d-s")
|
||||
else
|
||||
example_settings.link.libs:Add("freetype-s")
|
||||
end
|
||||
end
|
||||
|
||||
-- For now, to get examples working
|
||||
|
|
|
|||
4
vendor/FreeType2/.gitignore
vendored
Normal file
4
vendor/FreeType2/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
|
||||
# Ignore FreeTypes own build files.
|
||||
*.mk
|
||||
Jamfile
|
||||
58
vendor/FreeType2/build.lua
vendored
Normal file
58
vendor/FreeType2/build.lua
vendored
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
--------------------------------
|
||||
-- --
|
||||
-- FreeType2 build config --
|
||||
-- --
|
||||
--------------------------------
|
||||
local basepath = PathDir(ModuleFilename())
|
||||
|
||||
-- Modules
|
||||
--------------------------------
|
||||
local ft_modules = {
|
||||
"base",
|
||||
"autofit",
|
||||
"cff",
|
||||
"psaux",
|
||||
"pshinter",
|
||||
"psnames",
|
||||
"raster",
|
||||
"sfnt",
|
||||
"smooth",
|
||||
"truetype",
|
||||
}
|
||||
|
||||
-- Settings
|
||||
--------------------------------
|
||||
settings = TableDeepCopy(global_settings)
|
||||
|
||||
settings.labelprefix = "[FT2] "
|
||||
|
||||
-- Compile flags
|
||||
settings.cc.includes:Add("include")
|
||||
settings.cc.flags:Add("-DFT2_BUILD_LIBRARY")
|
||||
|
||||
-- Build target
|
||||
--------------------------------
|
||||
|
||||
local obj = {}
|
||||
|
||||
-- Compile each module to object files.
|
||||
for k,name in pairs(ft_modules) do
|
||||
local mod_base = PathJoin(basepath, string.format("src/%s/", name))
|
||||
local module_file = PathJoin(mod_base, "module.lua")
|
||||
|
||||
-- Check if we have a module.lua file
|
||||
-- that defines the modules sources
|
||||
local f = io.open(module_file)
|
||||
if f then
|
||||
Import(module_file)
|
||||
else
|
||||
-- Otherwise, We assume there is a <name>.c
|
||||
src = PathJoin(mod_base, string.format("%s.c", name))
|
||||
end
|
||||
|
||||
obj[name] = Compile(settings, src)
|
||||
PseudoTarget("ft2_" .. name, obj[name])
|
||||
end
|
||||
|
||||
ft2_obj = TableFlatten(obj)
|
||||
PseudoTarget("ft2", ft2_obj)
|
||||
|
|
@ -461,8 +461,6 @@ FT_BEGIN_HEADER
|
|||
#define FT_EXPORT( x ) __declspec( dllexport ) x
|
||||
#elif defined( __GNUC__ ) && __GNUC__ >= 4
|
||||
#define FT_EXPORT( x ) __attribute__(( visibility( "default" ) )) x
|
||||
#elif defined( __SUNPRO_C ) && __SUNPRO_C >= 0x550
|
||||
#define FT_EXPORT( x ) __global x
|
||||
#elif defined( __cplusplus )
|
||||
#define FT_EXPORT( x ) extern "C" x
|
||||
#else
|
||||
|
|
|
|||
|
|
@ -1,32 +1,34 @@
|
|||
/*
|
||||
* Spectre FreeType2 module config.
|
||||
* This file registers the FreeType modules compiled into the library.
|
||||
*
|
||||
* If you use GNU make, this file IS NOT USED! Instead, it is created in
|
||||
* the objects directory (normally `<topdir>/objs/') based on information
|
||||
* from `<topdir>/modules.cfg'.
|
||||
*
|
||||
* Please read `docs/INSTALL.ANY' and `docs/CUSTOMIZE' how to compile
|
||||
* FreeType without GNU make.
|
||||
*
|
||||
*/
|
||||
|
||||
FT_USE_MODULE( FT_Module_Class, autofit_module_class )
|
||||
/*
|
||||
* Drivers
|
||||
*/
|
||||
FT_USE_MODULE( FT_Driver_ClassRec, tt_driver_class )
|
||||
FT_USE_MODULE( FT_Driver_ClassRec, t1_driver_class )
|
||||
FT_USE_MODULE( FT_Driver_ClassRec, cff_driver_class )
|
||||
FT_USE_MODULE( FT_Driver_ClassRec, t1cid_driver_class )
|
||||
FT_USE_MODULE( FT_Driver_ClassRec, pfr_driver_class )
|
||||
FT_USE_MODULE( FT_Driver_ClassRec, t42_driver_class )
|
||||
FT_USE_MODULE( FT_Driver_ClassRec, winfnt_driver_class )
|
||||
FT_USE_MODULE( FT_Driver_ClassRec, pcf_driver_class )
|
||||
FT_USE_MODULE( FT_Module_Class, psaux_module_class )
|
||||
FT_USE_MODULE( FT_Module_Class, psnames_module_class )
|
||||
FT_USE_MODULE( FT_Module_Class, pshinter_module_class )
|
||||
FT_USE_MODULE( FT_Renderer_Class, ft_raster1_renderer_class )
|
||||
FT_USE_MODULE( FT_Module_Class, sfnt_module_class )
|
||||
FT_USE_MODULE( FT_Renderer_Class, ft_smooth_renderer_class )
|
||||
FT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcd_renderer_class )
|
||||
FT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcdv_renderer_class )
|
||||
FT_USE_MODULE( FT_Driver_ClassRec, bdf_driver_class )
|
||||
/* FT_USE_MODULE( FT_Driver_ClassRec, t1_driver_class ) */
|
||||
/* FT_USE_MODULE( FT_Driver_ClassRec, t1cid_driver_class ) */
|
||||
/* FT_USE_MODULE( FT_Driver_ClassRec, pfr_driver_class ) */
|
||||
/* FT_USE_MODULE( FT_Driver_ClassRec, t42_driver_class ) */
|
||||
/* FT_USE_MODULE( FT_Driver_ClassRec, winfnt_driver_class ) */
|
||||
/* FT_USE_MODULE( FT_Driver_ClassRec, pcf_driver_class ) */
|
||||
/* FT_USE_MODULE( FT_Driver_ClassRec, bdf_driver_class ) */
|
||||
|
||||
/* EOF */
|
||||
/*
|
||||
* Rendering
|
||||
*/
|
||||
FT_USE_MODULE( FT_Renderer_Class, ft_raster1_renderer_class ) /* Monochrome */
|
||||
FT_USE_MODULE( FT_Renderer_Class, ft_smooth_renderer_class ) /* AntiAlias */
|
||||
/* FT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcd_renderer_class ) */
|
||||
/* FT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcdv_renderer_class ) */
|
||||
|
||||
/*
|
||||
* Dependancies
|
||||
*/
|
||||
FT_USE_MODULE( FT_Module_Class, autofit_module_class )
|
||||
FT_USE_MODULE( FT_Module_Class, psaux_module_class ) /* needed by CFF/OpenType driver */
|
||||
FT_USE_MODULE( FT_Module_Class, psnames_module_class ) /* needed by CFF/OpenType & TrueType driver */
|
||||
FT_USE_MODULE( FT_Module_Class, pshinter_module_class ) /* needed by CFF/OpenType driver */
|
||||
FT_USE_MODULE( FT_Module_Class, sfnt_module_class ) /* needed by TrueType driver */
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ FT_BEGIN_HEADER
|
|||
/* cff:no-stem-darkening=1 \ */
|
||||
/* autofitter:warping=1 */
|
||||
/* */
|
||||
#define FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
|
||||
/* #define FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES */
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
|
|
@ -178,7 +178,7 @@ FT_BEGIN_HEADER
|
|||
/* */
|
||||
/* Define this macro if you want to enable this `feature'. */
|
||||
/* */
|
||||
#define FT_CONFIG_OPTION_USE_LZW
|
||||
/* #define FT_CONFIG_OPTION_USE_LZW */
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
|
|
@ -193,7 +193,7 @@ FT_BEGIN_HEADER
|
|||
/* Define this macro if you want to enable this `feature'. See also */
|
||||
/* the macro FT_CONFIG_OPTION_SYSTEM_ZLIB below. */
|
||||
/* */
|
||||
#define FT_CONFIG_OPTION_USE_ZLIB
|
||||
/* #define FT_CONFIG_OPTION_USE_ZLIB */
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
|
|
@ -486,6 +486,35 @@ FT_BEGIN_HEADER
|
|||
#undef FT_CONFIG_OPTION_USE_MODULE_ERRORS
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* Position Independent Code */
|
||||
/* */
|
||||
/* If this macro is set (which is _not_ the default), FreeType2 will */
|
||||
/* avoid creating constants that require address fixups. Instead the */
|
||||
/* constants will be moved into a struct and additional intialization */
|
||||
/* code will be used. */
|
||||
/* */
|
||||
/* Setting this macro is needed for systems that prohibit address */
|
||||
/* fixups, such as BREW. [Note that standard compilers like gcc or */
|
||||
/* clang handle PIC generation automatically; you don't have to set */
|
||||
/* FT_CONFIG_OPTION_PIC, which is only necessary for very special */
|
||||
/* compilers.] */
|
||||
/* */
|
||||
/* Note that FT_CONFIG_OPTION_PIC support is not available for all */
|
||||
/* modules (see `modules.cfg' for a complete list). For building with */
|
||||
/* FT_CONFIG_OPTION_PIC support, do the following. */
|
||||
/* */
|
||||
/* 0. Clone the repository. */
|
||||
/* 1. Define FT_CONFIG_OPTION_PIC. */
|
||||
/* 2. Remove all subdirectories in `src' that don't have */
|
||||
/* FT_CONFIG_OPTION_PIC support. */
|
||||
/* 3. Comment out the corresponding modules in `modules.cfg'. */
|
||||
/* 4. Compile. */
|
||||
/* */
|
||||
/* #define FT_CONFIG_OPTION_PIC */
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/**** ****/
|
||||
|
|
@ -629,8 +658,8 @@ FT_BEGIN_HEADER
|
|||
/* [1] https://www.microsoft.com/typography/cleartype/truetypecleartype.aspx */
|
||||
/* */
|
||||
/* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING 1 */
|
||||
#define TT_CONFIG_OPTION_SUBPIXEL_HINTING 2
|
||||
/* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING ( 1 | 2 ) */
|
||||
/* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING 2 */
|
||||
#define TT_CONFIG_OPTION_SUBPIXEL_HINTING ( 1 | 2 )
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
|
|
|
|||
|
|
@ -197,6 +197,8 @@ FT_BEGIN_HEADER
|
|||
} FT_AutoHinter_InterfaceRec, *FT_AutoHinter_Interface;
|
||||
|
||||
|
||||
#ifndef FT_CONFIG_OPTION_PIC
|
||||
|
||||
#define FT_DEFINE_AUTOHINTER_INTERFACE( \
|
||||
class_, \
|
||||
reset_face_, \
|
||||
|
|
@ -212,6 +214,27 @@ FT_BEGIN_HEADER
|
|||
load_glyph_ \
|
||||
};
|
||||
|
||||
#else /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
#define FT_DEFINE_AUTOHINTER_INTERFACE( \
|
||||
class_, \
|
||||
reset_face_, \
|
||||
get_global_hints_, \
|
||||
done_global_hints_, \
|
||||
load_glyph_ ) \
|
||||
void \
|
||||
FT_Init_Class_ ## class_( FT_Library library, \
|
||||
FT_AutoHinter_InterfaceRec* clazz ) \
|
||||
{ \
|
||||
FT_UNUSED( library ); \
|
||||
\
|
||||
clazz->reset_face = reset_face_; \
|
||||
clazz->get_global_hints = get_global_hints_; \
|
||||
clazz->done_global_hints = done_global_hints_; \
|
||||
clazz->load_glyph = load_glyph_; \
|
||||
}
|
||||
|
||||
#endif /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
FT_END_HEADER
|
||||
|
||||
|
|
|
|||
|
|
@ -341,7 +341,6 @@ FT_BEGIN_HEADER
|
|||
*/
|
||||
|
||||
#ifndef FT_CONFIG_OPTION_NO_ASSEMBLER
|
||||
|
||||
#if defined( __GNUC__ ) && \
|
||||
( __GNUC__ > 3 || ( __GNUC__ == 3 && __GNUC_MINOR__ >= 4 ) )
|
||||
|
||||
|
|
@ -355,30 +354,7 @@ FT_BEGIN_HEADER
|
|||
|
||||
#endif
|
||||
|
||||
|
||||
#elif defined( _MSC_VER )
|
||||
|
||||
#if FT_SIZEOF_INT == 4
|
||||
|
||||
#include <intrin.h>
|
||||
|
||||
static inline FT_Int32
|
||||
FT_MSB_i386( FT_UInt32 x )
|
||||
{
|
||||
unsigned long where;
|
||||
|
||||
|
||||
_BitScanReverse( &where, x );
|
||||
|
||||
return (FT_Int32)where;
|
||||
}
|
||||
|
||||
#define FT_MSB( x ) ( FT_MSB_i386( x ) )
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* __GNUC__ */
|
||||
#endif /* !FT_CONFIG_OPTION_NO_ASSEMBLER */
|
||||
|
||||
#ifndef FT_MSB
|
||||
|
|
|
|||
123
vendor/FreeType2/include/freetype/internal/ftdrv.h
vendored
123
vendor/FreeType2/include/freetype/internal/ftdrv.h
vendored
|
|
@ -199,13 +199,30 @@ FT_BEGIN_HEADER
|
|||
/* <Description> */
|
||||
/* Used to initialize an instance of FT_Driver_ClassRec struct. */
|
||||
/* */
|
||||
/* When FT_CONFIG_OPTION_PIC is defined a `create' function has to be */
|
||||
/* called with a pointer where the allocated structure is returned. */
|
||||
/* And when it is no longer needed a `destroy' function needs to be */
|
||||
/* called to release that allocation. */
|
||||
/* */
|
||||
/* `ftinit.c' (ft_create_default_module_classes) already contains a */
|
||||
/* mechanism to call these functions for the default modules */
|
||||
/* described in `ftmodule.h'. */
|
||||
/* */
|
||||
/* The struct will be allocated in the global scope (or the scope */
|
||||
/* where the macro is used). */
|
||||
/* Notice that the created `create' and `destroy' functions call */
|
||||
/* `pic_init' and `pic_free' to allow you to manually allocate and */
|
||||
/* initialize any additional global data, like a module specific */
|
||||
/* interface, and put them in the global pic container defined in */
|
||||
/* `ftpic.h'. If you don't need them just implement the functions as */
|
||||
/* empty to resolve the link error. Also the `pic_init' and */
|
||||
/* `pic_free' functions should be declared in `pic.h', to be referred */
|
||||
/* by driver definition calling `FT_DEFINE_DRIVER' in following. */
|
||||
/* */
|
||||
/* When FT_CONFIG_OPTION_PIC is not defined the struct will be */
|
||||
/* allocated in the global scope (or the scope where the macro is */
|
||||
/* used). */
|
||||
/* */
|
||||
#ifndef FT_CONFIG_OPTION_PIC
|
||||
|
||||
#define FT_DECLARE_DRIVER( class_ ) \
|
||||
FT_CALLBACK_TABLE \
|
||||
const FT_Driver_ClassRec class_;
|
||||
|
|
@ -272,6 +289,108 @@ FT_BEGIN_HEADER
|
|||
select_size_ \
|
||||
};
|
||||
|
||||
#else /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
#define FT_DECLARE_DRIVER( class_ ) FT_DECLARE_MODULE( class_ )
|
||||
|
||||
#define FT_DEFINE_DRIVER( \
|
||||
class_, \
|
||||
flags_, \
|
||||
size_, \
|
||||
name_, \
|
||||
version_, \
|
||||
requires_, \
|
||||
interface_, \
|
||||
init_, \
|
||||
done_, \
|
||||
get_interface_, \
|
||||
face_object_size_, \
|
||||
size_object_size_, \
|
||||
slot_object_size_, \
|
||||
init_face_, \
|
||||
done_face_, \
|
||||
init_size_, \
|
||||
done_size_, \
|
||||
init_slot_, \
|
||||
done_slot_, \
|
||||
load_glyph_, \
|
||||
get_kerning_, \
|
||||
attach_file_, \
|
||||
get_advances_, \
|
||||
request_size_, \
|
||||
select_size_ ) \
|
||||
void \
|
||||
FT_Destroy_Class_ ## class_( FT_Library library, \
|
||||
FT_Module_Class* clazz ) \
|
||||
{ \
|
||||
FT_Memory memory = library->memory; \
|
||||
FT_Driver_Class dclazz = (FT_Driver_Class)clazz; \
|
||||
\
|
||||
\
|
||||
class_ ## _pic_free( library ); \
|
||||
if ( dclazz ) \
|
||||
FT_FREE( dclazz ); \
|
||||
} \
|
||||
\
|
||||
\
|
||||
FT_Error \
|
||||
FT_Create_Class_ ## class_( FT_Library library, \
|
||||
FT_Module_Class** output_class ) \
|
||||
{ \
|
||||
FT_Driver_Class clazz = NULL; \
|
||||
FT_Error error; \
|
||||
FT_Memory memory = library->memory; \
|
||||
\
|
||||
\
|
||||
if ( FT_ALLOC( clazz, sizeof ( *clazz ) ) ) \
|
||||
return error; \
|
||||
\
|
||||
error = class_ ## _pic_init( library ); \
|
||||
if ( error ) \
|
||||
{ \
|
||||
FT_FREE( clazz ); \
|
||||
return error; \
|
||||
} \
|
||||
\
|
||||
FT_DEFINE_ROOT_MODULE( flags_, \
|
||||
size_, \
|
||||
name_, \
|
||||
version_, \
|
||||
requires_, \
|
||||
interface_, \
|
||||
init_, \
|
||||
done_, \
|
||||
get_interface_ ) \
|
||||
\
|
||||
clazz->face_object_size = face_object_size_; \
|
||||
clazz->size_object_size = size_object_size_; \
|
||||
clazz->slot_object_size = slot_object_size_; \
|
||||
\
|
||||
clazz->init_face = init_face_; \
|
||||
clazz->done_face = done_face_; \
|
||||
\
|
||||
clazz->init_size = init_size_; \
|
||||
clazz->done_size = done_size_; \
|
||||
\
|
||||
clazz->init_slot = init_slot_; \
|
||||
clazz->done_slot = done_slot_; \
|
||||
\
|
||||
clazz->load_glyph = load_glyph_; \
|
||||
\
|
||||
clazz->get_kerning = get_kerning_; \
|
||||
clazz->attach_file = attach_file_; \
|
||||
clazz->get_advances = get_advances_; \
|
||||
\
|
||||
clazz->request_size = request_size_; \
|
||||
clazz->select_size = select_size_; \
|
||||
\
|
||||
*output_class = (FT_Module_Class*)clazz; \
|
||||
\
|
||||
return FT_Err_Ok; \
|
||||
}
|
||||
|
||||
|
||||
#endif /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
FT_END_HEADER
|
||||
|
||||
|
|
|
|||
433
vendor/FreeType2/include/freetype/internal/ftobjs.h
vendored
433
vendor/FreeType2/include/freetype/internal/ftobjs.h
vendored
|
|
@ -35,6 +35,7 @@
|
|||
#include FT_INTERNAL_DRIVER_H
|
||||
#include FT_INTERNAL_AUTOHINT_H
|
||||
#include FT_INTERNAL_SERVICE_H
|
||||
#include FT_INTERNAL_PIC_H
|
||||
#include FT_INTERNAL_CALC_H
|
||||
|
||||
#ifdef FT_CONFIG_OPTION_INCREMENTAL
|
||||
|
|
@ -227,6 +228,8 @@ FT_BEGIN_HEADER
|
|||
} FT_CMap_ClassRec;
|
||||
|
||||
|
||||
#ifndef FT_CONFIG_OPTION_PIC
|
||||
|
||||
#define FT_DECLARE_CMAP_CLASS( class_ ) \
|
||||
FT_CALLBACK_TABLE const FT_CMap_ClassRec class_;
|
||||
|
||||
|
|
@ -257,6 +260,45 @@ FT_BEGIN_HEADER
|
|||
variantchar_list_ \
|
||||
};
|
||||
|
||||
#else /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
#define FT_DECLARE_CMAP_CLASS( class_ ) \
|
||||
void \
|
||||
FT_Init_Class_ ## class_( FT_Library library, \
|
||||
FT_CMap_ClassRec* clazz );
|
||||
|
||||
#define FT_DEFINE_CMAP_CLASS( \
|
||||
class_, \
|
||||
size_, \
|
||||
init_, \
|
||||
done_, \
|
||||
char_index_, \
|
||||
char_next_, \
|
||||
char_var_index_, \
|
||||
char_var_default_, \
|
||||
variant_list_, \
|
||||
charvariant_list_, \
|
||||
variantchar_list_ ) \
|
||||
void \
|
||||
FT_Init_Class_ ## class_( FT_Library library, \
|
||||
FT_CMap_ClassRec* clazz ) \
|
||||
{ \
|
||||
FT_UNUSED( library ); \
|
||||
\
|
||||
clazz->size = size_; \
|
||||
clazz->init = init_; \
|
||||
clazz->done = done_; \
|
||||
clazz->char_index = char_index_; \
|
||||
clazz->char_next = char_next_; \
|
||||
clazz->char_var_index = char_var_index_; \
|
||||
clazz->char_var_default = char_var_default_; \
|
||||
clazz->variant_list = variant_list_; \
|
||||
clazz->charvariant_list = charvariant_list_; \
|
||||
clazz->variantchar_list = variantchar_list_; \
|
||||
}
|
||||
|
||||
#endif /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
|
||||
/* create a new charmap and add it to charmap->face */
|
||||
FT_BASE( FT_Error )
|
||||
|
|
@ -893,6 +935,10 @@ FT_BEGIN_HEADER
|
|||
FT_Bitmap_LcdFilterFunc lcd_filter_func; /* filtering callback */
|
||||
#endif
|
||||
|
||||
#ifdef FT_CONFIG_OPTION_PIC
|
||||
FT_PIC_Container pic_container;
|
||||
#endif
|
||||
|
||||
FT_Int refcount;
|
||||
|
||||
} FT_LibraryRec;
|
||||
|
|
@ -967,6 +1013,22 @@ FT_BEGIN_HEADER
|
|||
#endif
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/**** ****/
|
||||
/**** ****/
|
||||
/**** P I C S U P P O R T ****/
|
||||
/**** ****/
|
||||
/**** ****/
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
|
||||
|
||||
/* PIC support macros for ftimage.h */
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Macro> */
|
||||
|
|
@ -974,9 +1036,14 @@ FT_BEGIN_HEADER
|
|||
/* */
|
||||
/* <Description> */
|
||||
/* Used to initialize an instance of FT_Outline_Funcs struct. */
|
||||
/* The struct will be allocated in the global scope (or the scope */
|
||||
/* where the macro is used). */
|
||||
/* When FT_CONFIG_OPTION_PIC is defined an init function will need */
|
||||
/* to be called with a pre-allocated structure to be filled. */
|
||||
/* When FT_CONFIG_OPTION_PIC is not defined the struct will be */
|
||||
/* allocated in the global scope (or the scope where the macro */
|
||||
/* is used). */
|
||||
/* */
|
||||
#ifndef FT_CONFIG_OPTION_PIC
|
||||
|
||||
#define FT_DEFINE_OUTLINE_FUNCS( \
|
||||
class_, \
|
||||
move_to_, \
|
||||
|
|
@ -995,6 +1062,31 @@ FT_BEGIN_HEADER
|
|||
delta_ \
|
||||
};
|
||||
|
||||
#else /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
#define FT_DEFINE_OUTLINE_FUNCS( \
|
||||
class_, \
|
||||
move_to_, \
|
||||
line_to_, \
|
||||
conic_to_, \
|
||||
cubic_to_, \
|
||||
shift_, \
|
||||
delta_ ) \
|
||||
static FT_Error \
|
||||
Init_Class_ ## class_( FT_Outline_Funcs* clazz ) \
|
||||
{ \
|
||||
clazz->move_to = move_to_; \
|
||||
clazz->line_to = line_to_; \
|
||||
clazz->conic_to = conic_to_; \
|
||||
clazz->cubic_to = cubic_to_; \
|
||||
clazz->shift = shift_; \
|
||||
clazz->delta = delta_; \
|
||||
\
|
||||
return FT_Err_Ok; \
|
||||
}
|
||||
|
||||
#endif /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
|
|
@ -1003,9 +1095,14 @@ FT_BEGIN_HEADER
|
|||
/* */
|
||||
/* <Description> */
|
||||
/* Used to initialize an instance of FT_Raster_Funcs struct. */
|
||||
/* The struct will be allocated in the global scope (or the scope */
|
||||
/* where the macro is used). */
|
||||
/* When FT_CONFIG_OPTION_PIC is defined an init function will need */
|
||||
/* to be called with a pre-allocated structure to be filled. */
|
||||
/* When FT_CONFIG_OPTION_PIC is not defined the struct will be */
|
||||
/* allocated in the global scope (or the scope where the macro */
|
||||
/* is used). */
|
||||
/* */
|
||||
#ifndef FT_CONFIG_OPTION_PIC
|
||||
|
||||
#define FT_DEFINE_RASTER_FUNCS( \
|
||||
class_, \
|
||||
glyph_format_, \
|
||||
|
|
@ -1024,6 +1121,31 @@ FT_BEGIN_HEADER
|
|||
raster_done_ \
|
||||
};
|
||||
|
||||
#else /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
#define FT_DEFINE_RASTER_FUNCS( \
|
||||
class_, \
|
||||
glyph_format_, \
|
||||
raster_new_, \
|
||||
raster_reset_, \
|
||||
raster_set_mode_, \
|
||||
raster_render_, \
|
||||
raster_done_ ) \
|
||||
void \
|
||||
FT_Init_Class_ ## class_( FT_Raster_Funcs* clazz ) \
|
||||
{ \
|
||||
clazz->glyph_format = glyph_format_; \
|
||||
clazz->raster_new = raster_new_; \
|
||||
clazz->raster_reset = raster_reset_; \
|
||||
clazz->raster_set_mode = raster_set_mode_; \
|
||||
clazz->raster_render = raster_render_; \
|
||||
clazz->raster_done = raster_done_; \
|
||||
}
|
||||
|
||||
#endif /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
|
||||
/* PIC support macros for ftrender.h */
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
|
|
@ -1032,9 +1154,15 @@ FT_BEGIN_HEADER
|
|||
/* FT_DEFINE_GLYPH */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* The struct will be allocated in the global scope (or the scope */
|
||||
/* where the macro is used). */
|
||||
/* Used to initialize an instance of FT_Glyph_Class struct. */
|
||||
/* When FT_CONFIG_OPTION_PIC is defined an init function will need */
|
||||
/* to be called with a pre-allocated structure to be filled. */
|
||||
/* When FT_CONFIG_OPTION_PIC is not defined the struct will be */
|
||||
/* allocated in the global scope (or the scope where the macro */
|
||||
/* is used). */
|
||||
/* */
|
||||
#ifndef FT_CONFIG_OPTION_PIC
|
||||
|
||||
#define FT_DEFINE_GLYPH( \
|
||||
class_, \
|
||||
size_, \
|
||||
|
|
@ -1058,6 +1186,33 @@ FT_BEGIN_HEADER
|
|||
prepare_ \
|
||||
};
|
||||
|
||||
#else /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
#define FT_DEFINE_GLYPH( \
|
||||
class_, \
|
||||
size_, \
|
||||
format_, \
|
||||
init_, \
|
||||
done_, \
|
||||
copy_, \
|
||||
transform_, \
|
||||
bbox_, \
|
||||
prepare_ ) \
|
||||
void \
|
||||
FT_Init_Class_ ## class_( FT_Glyph_Class* clazz ) \
|
||||
{ \
|
||||
clazz->glyph_size = size_; \
|
||||
clazz->glyph_format = format_; \
|
||||
clazz->glyph_init = init_; \
|
||||
clazz->glyph_done = done_; \
|
||||
clazz->glyph_copy = copy_; \
|
||||
clazz->glyph_transform = transform_; \
|
||||
clazz->glyph_bbox = bbox_; \
|
||||
clazz->glyph_prepare = prepare_; \
|
||||
}
|
||||
|
||||
#endif /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
|
|
@ -1074,9 +1229,30 @@ FT_BEGIN_HEADER
|
|||
/* <Description> */
|
||||
/* Used to initialize an instance of FT_Renderer_Class struct. */
|
||||
/* */
|
||||
/* The struct will be allocated in the global scope (or the scope */
|
||||
/* where the macro is used). */
|
||||
/* When FT_CONFIG_OPTION_PIC is defined a `create' function will */
|
||||
/* need to be called with a pointer where the allocated structure is */
|
||||
/* returned. And when it is no longer needed a `destroy' function */
|
||||
/* needs to be called to release that allocation. */
|
||||
/* `ftinit.c' (ft_create_default_module_classes) already contains */
|
||||
/* a mechanism to call these functions for the default modules */
|
||||
/* described in `ftmodule.h'. */
|
||||
/* */
|
||||
/* Notice that the created `create' and `destroy' functions call */
|
||||
/* `pic_init' and `pic_free' to allow you to manually allocate and */
|
||||
/* initialize any additional global data, like a module specific */
|
||||
/* interface, and put them in the global pic container defined in */
|
||||
/* `ftpic.h'. If you don't need them just implement the functions as */
|
||||
/* empty to resolve the link error. Also the `pic_init' and */
|
||||
/* `pic_free' functions should be declared in `pic.h', to be referred */
|
||||
/* by the renderer definition calling `FT_DEFINE_RENDERER' in the */
|
||||
/* following. */
|
||||
/* */
|
||||
/* When FT_CONFIG_OPTION_PIC is not defined the struct will be */
|
||||
/* allocated in the global scope (or the scope where the macro */
|
||||
/* is used). */
|
||||
/* */
|
||||
#ifndef FT_CONFIG_OPTION_PIC
|
||||
|
||||
#define FT_DECLARE_RENDERER( class_ ) \
|
||||
FT_EXPORT_VAR( const FT_Renderer_Class ) class_;
|
||||
|
||||
|
|
@ -1119,6 +1295,128 @@ FT_BEGIN_HEADER
|
|||
raster_class_ \
|
||||
};
|
||||
|
||||
#else /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
#define FT_DECLARE_RENDERER( class_ ) FT_DECLARE_MODULE( class_ )
|
||||
|
||||
#define FT_DEFINE_RENDERER( \
|
||||
class_, \
|
||||
flags_, \
|
||||
size_, \
|
||||
name_, \
|
||||
version_, \
|
||||
requires_, \
|
||||
interface_, \
|
||||
init_, \
|
||||
done_, \
|
||||
get_interface_, \
|
||||
glyph_format_, \
|
||||
render_glyph_, \
|
||||
transform_glyph_, \
|
||||
get_glyph_cbox_, \
|
||||
set_mode_, \
|
||||
raster_class_ ) \
|
||||
void \
|
||||
FT_Destroy_Class_ ## class_( FT_Library library, \
|
||||
FT_Module_Class* clazz ) \
|
||||
{ \
|
||||
FT_Renderer_Class* rclazz = (FT_Renderer_Class*)clazz; \
|
||||
FT_Memory memory = library->memory; \
|
||||
\
|
||||
\
|
||||
class_ ## _pic_free( library ); \
|
||||
if ( rclazz ) \
|
||||
FT_FREE( rclazz ); \
|
||||
} \
|
||||
\
|
||||
\
|
||||
FT_Error \
|
||||
FT_Create_Class_ ## class_( FT_Library library, \
|
||||
FT_Module_Class** output_class ) \
|
||||
{ \
|
||||
FT_Renderer_Class* clazz = NULL; \
|
||||
FT_Error error; \
|
||||
FT_Memory memory = library->memory; \
|
||||
\
|
||||
\
|
||||
if ( FT_ALLOC( clazz, sizeof ( *clazz ) ) ) \
|
||||
return error; \
|
||||
\
|
||||
error = class_ ## _pic_init( library ); \
|
||||
if ( error ) \
|
||||
{ \
|
||||
FT_FREE( clazz ); \
|
||||
return error; \
|
||||
} \
|
||||
\
|
||||
FT_DEFINE_ROOT_MODULE( flags_, \
|
||||
size_, \
|
||||
name_, \
|
||||
version_, \
|
||||
requires_, \
|
||||
interface_, \
|
||||
init_, \
|
||||
done_, \
|
||||
get_interface_ ) \
|
||||
\
|
||||
clazz->glyph_format = glyph_format_; \
|
||||
\
|
||||
clazz->render_glyph = render_glyph_; \
|
||||
clazz->transform_glyph = transform_glyph_; \
|
||||
clazz->get_glyph_cbox = get_glyph_cbox_; \
|
||||
clazz->set_mode = set_mode_; \
|
||||
\
|
||||
clazz->raster_class = raster_class_; \
|
||||
\
|
||||
*output_class = (FT_Module_Class*)clazz; \
|
||||
\
|
||||
return FT_Err_Ok; \
|
||||
}
|
||||
|
||||
#endif /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
|
||||
/* PIC support macros for ftmodapi.h **/
|
||||
|
||||
|
||||
#ifdef FT_CONFIG_OPTION_PIC
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <FuncType> */
|
||||
/* FT_Module_Creator */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* A function used to create (allocate) a new module class object. */
|
||||
/* The object's members are initialized, but the module itself is */
|
||||
/* not. */
|
||||
/* */
|
||||
/* <Input> */
|
||||
/* memory :: A handle to the memory manager. */
|
||||
/* output_class :: Initialized with the newly allocated class. */
|
||||
/* */
|
||||
typedef FT_Error
|
||||
(*FT_Module_Creator)( FT_Memory memory,
|
||||
FT_Module_Class** output_class );
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <FuncType> */
|
||||
/* FT_Module_Destroyer */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* A function used to destroy (deallocate) a module class object. */
|
||||
/* */
|
||||
/* <Input> */
|
||||
/* memory :: A handle to the memory manager. */
|
||||
/* clazz :: Module class to destroy. */
|
||||
/* */
|
||||
typedef void
|
||||
(*FT_Module_Destroyer)( FT_Memory memory,
|
||||
FT_Module_Class* clazz );
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
|
|
@ -1135,8 +1433,27 @@ FT_BEGIN_HEADER
|
|||
/* <Description> */
|
||||
/* Used to initialize an instance of an FT_Module_Class struct. */
|
||||
/* */
|
||||
/* The struct will be allocated in the global scope (or the scope */
|
||||
/* where the macro is used). */
|
||||
/* When FT_CONFIG_OPTION_PIC is defined a `create' function needs */
|
||||
/* to be called with a pointer where the allocated structure is */
|
||||
/* returned. And when it is no longer needed a `destroy' function */
|
||||
/* needs to be called to release that allocation. */
|
||||
/* `ftinit.c' (ft_create_default_module_classes) already contains */
|
||||
/* a mechanism to call these functions for the default modules */
|
||||
/* described in `ftmodule.h'. */
|
||||
/* */
|
||||
/* Notice that the created `create' and `destroy' functions call */
|
||||
/* `pic_init' and `pic_free' to allow you to manually allocate and */
|
||||
/* initialize any additional global data, like a module specific */
|
||||
/* interface, and put them in the global pic container defined in */
|
||||
/* `ftpic.h'. If you don't need them just implement the functions as */
|
||||
/* empty to resolve the link error. Also the `pic_init' and */
|
||||
/* `pic_free' functions should be declared in `pic.h', to be referred */
|
||||
/* by the module definition calling `FT_DEFINE_MODULE' in the */
|
||||
/* following. */
|
||||
/* */
|
||||
/* When FT_CONFIG_OPTION_PIC is not defined the struct will be */
|
||||
/* allocated in the global scope (or the scope where the macro */
|
||||
/* is used). */
|
||||
/* */
|
||||
/* <Macro> */
|
||||
/* FT_DEFINE_ROOT_MODULE */
|
||||
|
|
@ -1146,6 +1463,8 @@ FT_BEGIN_HEADER
|
|||
/* another struct that contains it or in a function that initializes */
|
||||
/* that containing struct. */
|
||||
/* */
|
||||
#ifndef FT_CONFIG_OPTION_PIC
|
||||
|
||||
#define FT_DECLARE_MODULE( class_ ) \
|
||||
FT_CALLBACK_TABLE \
|
||||
const FT_Module_Class class_;
|
||||
|
|
@ -1204,6 +1523,100 @@ FT_BEGIN_HEADER
|
|||
};
|
||||
|
||||
|
||||
#else /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
#define FT_DECLARE_MODULE( class_ ) \
|
||||
FT_Error \
|
||||
FT_Create_Class_ ## class_( FT_Library library, \
|
||||
FT_Module_Class** output_class ); \
|
||||
void \
|
||||
FT_Destroy_Class_ ## class_( FT_Library library, \
|
||||
FT_Module_Class* clazz );
|
||||
|
||||
#define FT_DEFINE_ROOT_MODULE( \
|
||||
flags_, \
|
||||
size_, \
|
||||
name_, \
|
||||
version_, \
|
||||
requires_, \
|
||||
interface_, \
|
||||
init_, \
|
||||
done_, \
|
||||
get_interface_ ) \
|
||||
clazz->root.module_flags = flags_; \
|
||||
clazz->root.module_size = size_; \
|
||||
clazz->root.module_name = name_; \
|
||||
clazz->root.module_version = version_; \
|
||||
clazz->root.module_requires = requires_; \
|
||||
\
|
||||
clazz->root.module_interface = interface_; \
|
||||
\
|
||||
clazz->root.module_init = init_; \
|
||||
clazz->root.module_done = done_; \
|
||||
clazz->root.get_interface = get_interface_;
|
||||
|
||||
#define FT_DEFINE_MODULE( \
|
||||
class_, \
|
||||
flags_, \
|
||||
size_, \
|
||||
name_, \
|
||||
version_, \
|
||||
requires_, \
|
||||
interface_, \
|
||||
init_, \
|
||||
done_, \
|
||||
get_interface_ ) \
|
||||
void \
|
||||
FT_Destroy_Class_ ## class_( FT_Library library, \
|
||||
FT_Module_Class* clazz ) \
|
||||
{ \
|
||||
FT_Memory memory = library->memory; \
|
||||
\
|
||||
\
|
||||
class_ ## _pic_free( library ); \
|
||||
if ( clazz ) \
|
||||
FT_FREE( clazz ); \
|
||||
} \
|
||||
\
|
||||
\
|
||||
FT_Error \
|
||||
FT_Create_Class_ ## class_( FT_Library library, \
|
||||
FT_Module_Class** output_class ) \
|
||||
{ \
|
||||
FT_Memory memory = library->memory; \
|
||||
FT_Module_Class* clazz = NULL; \
|
||||
FT_Error error; \
|
||||
\
|
||||
\
|
||||
if ( FT_ALLOC( clazz, sizeof ( *clazz ) ) ) \
|
||||
return error; \
|
||||
error = class_ ## _pic_init( library ); \
|
||||
if ( error ) \
|
||||
{ \
|
||||
FT_FREE( clazz ); \
|
||||
return error; \
|
||||
} \
|
||||
\
|
||||
clazz->module_flags = flags_; \
|
||||
clazz->module_size = size_; \
|
||||
clazz->module_name = name_; \
|
||||
clazz->module_version = version_; \
|
||||
clazz->module_requires = requires_; \
|
||||
\
|
||||
clazz->module_interface = interface_; \
|
||||
\
|
||||
clazz->module_init = init_; \
|
||||
clazz->module_done = done_; \
|
||||
clazz->get_interface = get_interface_; \
|
||||
\
|
||||
*output_class = clazz; \
|
||||
\
|
||||
return FT_Err_Ok; \
|
||||
}
|
||||
|
||||
#endif /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
|
||||
FT_END_HEADER
|
||||
|
||||
#endif /* FTOBJS_H_ */
|
||||
|
|
|
|||
71
vendor/FreeType2/include/freetype/internal/ftpic.h
vendored
Normal file
71
vendor/FreeType2/include/freetype/internal/ftpic.h
vendored
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
/***************************************************************************/
|
||||
/* */
|
||||
/* ftpic.h */
|
||||
/* */
|
||||
/* The FreeType position independent code services (declaration). */
|
||||
/* */
|
||||
/* Copyright 2009-2018 by */
|
||||
/* Oran Agra and Mickey Gabel. */
|
||||
/* */
|
||||
/* 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. */
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* Modules that ordinarily have const global data that need address */
|
||||
/* can instead define pointers here. */
|
||||
/* */
|
||||
/*************************************************************************/
|
||||
|
||||
|
||||
#ifndef FTPIC_H_
|
||||
#define FTPIC_H_
|
||||
|
||||
|
||||
FT_BEGIN_HEADER
|
||||
|
||||
#ifdef FT_CONFIG_OPTION_PIC
|
||||
|
||||
typedef struct FT_PIC_Container_
|
||||
{
|
||||
/* pic containers for base */
|
||||
void* base;
|
||||
|
||||
/* pic containers for modules */
|
||||
void* autofit;
|
||||
void* cff;
|
||||
void* pshinter;
|
||||
void* psnames;
|
||||
void* raster;
|
||||
void* sfnt;
|
||||
void* smooth;
|
||||
void* truetype;
|
||||
|
||||
} FT_PIC_Container;
|
||||
|
||||
|
||||
/* Initialize the various function tables, structs, etc. */
|
||||
/* stored in the container. */
|
||||
FT_BASE( FT_Error )
|
||||
ft_pic_container_init( FT_Library library );
|
||||
|
||||
|
||||
/* Destroy the contents of the container. */
|
||||
FT_BASE( void )
|
||||
ft_pic_container_destroy( FT_Library library );
|
||||
|
||||
#endif /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
/* */
|
||||
|
||||
FT_END_HEADER
|
||||
|
||||
#endif /* FTPIC_H_ */
|
||||
|
||||
|
||||
/* END */
|
||||
|
|
@ -80,15 +80,35 @@ FT_BEGIN_HEADER
|
|||
FT_RFork_Rule type;
|
||||
} ft_raccess_guess_rec;
|
||||
|
||||
#ifndef FT_CONFIG_OPTION_PIC
|
||||
|
||||
/* this array is a storage in non-PIC mode, so ; is needed in END */
|
||||
#define CONST_FT_RFORK_RULE_ARRAY_BEGIN( name, type ) \
|
||||
static const type name[] = {
|
||||
#define CONST_FT_RFORK_RULE_ARRAY_ENTRY( func_suffix, type_suffix ) \
|
||||
{ raccess_guess_ ## func_suffix, \
|
||||
FT_RFork_Rule_ ## type_suffix },
|
||||
/* this array is a storage, thus a final `;' is needed */
|
||||
#define CONST_FT_RFORK_RULE_ARRAY_END };
|
||||
|
||||
#else /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
/* this array is a function in PIC mode, so no ; is needed in END */
|
||||
#define CONST_FT_RFORK_RULE_ARRAY_BEGIN( name, type ) \
|
||||
void \
|
||||
FT_Init_Table_ ## name( type* storage ) \
|
||||
{ \
|
||||
type* local = storage; \
|
||||
\
|
||||
\
|
||||
int i = 0;
|
||||
#define CONST_FT_RFORK_RULE_ARRAY_ENTRY( func_suffix, type_suffix ) \
|
||||
local[i].func = raccess_guess_ ## func_suffix; \
|
||||
local[i].type = FT_RFork_Rule_ ## type_suffix; \
|
||||
i++;
|
||||
#define CONST_FT_RFORK_RULE_ARRAY_END }
|
||||
|
||||
#endif /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
#endif /* FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK */
|
||||
|
||||
|
||||
|
|
|
|||
506
vendor/FreeType2/include/freetype/internal/ftserv.h
vendored
506
vendor/FreeType2/include/freetype/internal/ftserv.h
vendored
|
|
@ -168,15 +168,24 @@ FT_BEGIN_HEADER
|
|||
/* FT_DEFINE_SERVICEDESCREC6 */
|
||||
/* FT_DEFINE_SERVICEDESCREC7 */
|
||||
/* FT_DEFINE_SERVICEDESCREC8 */
|
||||
/* FT_DEFINE_SERVICEDESCREC9 */
|
||||
/* FT_DEFINE_SERVICEDESCREC10 */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* Used to initialize an array of FT_ServiceDescRec structures. */
|
||||
/* */
|
||||
/* The array will be allocated in the global scope (or the scope */
|
||||
/* where the macro is used). */
|
||||
/* When FT_CONFIG_OPTION_PIC is defined a `create' function needs to */
|
||||
/* be called with a pointer to return an allocated array. As soon as */
|
||||
/* it is no longer needed, a `destroy' function needs to be called to */
|
||||
/* release that allocation. */
|
||||
/* */
|
||||
/* These functions should be manually called from the `pic_init' and */
|
||||
/* `pic_free' functions of your module (see FT_DEFINE_MODULE). */
|
||||
/* */
|
||||
/* When FT_CONFIG_OPTION_PIC is not defined the array will be */
|
||||
/* allocated in the global scope (or the scope where the macro is */
|
||||
/* used). */
|
||||
/* */
|
||||
#ifndef FT_CONFIG_OPTION_PIC
|
||||
|
||||
#define FT_DEFINE_SERVICEDESCREC1( class_, \
|
||||
serv_id_1, serv_data_1 ) \
|
||||
static const FT_ServiceDescRec class_[] = \
|
||||
|
|
@ -347,6 +356,495 @@ FT_BEGIN_HEADER
|
|||
{ NULL, NULL } \
|
||||
};
|
||||
|
||||
#else /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
#define FT_DEFINE_SERVICEDESCREC1( class_, \
|
||||
serv_id_1, serv_data_1 ) \
|
||||
void \
|
||||
FT_Destroy_Class_ ## class_( FT_Library library, \
|
||||
FT_ServiceDescRec* clazz ) \
|
||||
{ \
|
||||
FT_Memory memory = library->memory; \
|
||||
\
|
||||
\
|
||||
if ( clazz ) \
|
||||
FT_FREE( clazz ); \
|
||||
} \
|
||||
\
|
||||
FT_Error \
|
||||
FT_Create_Class_ ## class_( FT_Library library, \
|
||||
FT_ServiceDescRec** output_class ) \
|
||||
{ \
|
||||
FT_ServiceDescRec* clazz = NULL; \
|
||||
FT_Error error; \
|
||||
FT_Memory memory = library->memory; \
|
||||
\
|
||||
\
|
||||
if ( FT_ALLOC( clazz, sizeof ( *clazz ) * 2 ) ) \
|
||||
return error; \
|
||||
\
|
||||
clazz[0].serv_id = serv_id_1; \
|
||||
clazz[0].serv_data = serv_data_1; \
|
||||
clazz[1].serv_id = NULL; \
|
||||
clazz[1].serv_data = NULL; \
|
||||
\
|
||||
*output_class = clazz; \
|
||||
\
|
||||
return FT_Err_Ok; \
|
||||
}
|
||||
|
||||
#define FT_DEFINE_SERVICEDESCREC2( class_, \
|
||||
serv_id_1, serv_data_1, \
|
||||
serv_id_2, serv_data_2 ) \
|
||||
void \
|
||||
FT_Destroy_Class_ ## class_( FT_Library library, \
|
||||
FT_ServiceDescRec* clazz ) \
|
||||
{ \
|
||||
FT_Memory memory = library->memory; \
|
||||
\
|
||||
\
|
||||
if ( clazz ) \
|
||||
FT_FREE( clazz ); \
|
||||
} \
|
||||
\
|
||||
FT_Error \
|
||||
FT_Create_Class_ ## class_( FT_Library library, \
|
||||
FT_ServiceDescRec** output_class ) \
|
||||
{ \
|
||||
FT_ServiceDescRec* clazz = NULL; \
|
||||
FT_Error error; \
|
||||
FT_Memory memory = library->memory; \
|
||||
\
|
||||
\
|
||||
if ( FT_ALLOC( clazz, sizeof ( *clazz ) * 3 ) ) \
|
||||
return error; \
|
||||
\
|
||||
clazz[0].serv_id = serv_id_1; \
|
||||
clazz[0].serv_data = serv_data_1; \
|
||||
clazz[1].serv_id = serv_id_2; \
|
||||
clazz[1].serv_data = serv_data_2; \
|
||||
clazz[2].serv_id = NULL; \
|
||||
clazz[2].serv_data = NULL; \
|
||||
\
|
||||
*output_class = clazz; \
|
||||
\
|
||||
return FT_Err_Ok; \
|
||||
}
|
||||
|
||||
#define FT_DEFINE_SERVICEDESCREC3( class_, \
|
||||
serv_id_1, serv_data_1, \
|
||||
serv_id_2, serv_data_2, \
|
||||
serv_id_3, serv_data_3 ) \
|
||||
void \
|
||||
FT_Destroy_Class_ ## class_( FT_Library library, \
|
||||
FT_ServiceDescRec* clazz ) \
|
||||
{ \
|
||||
FT_Memory memory = library->memory; \
|
||||
\
|
||||
\
|
||||
if ( clazz ) \
|
||||
FT_FREE( clazz ); \
|
||||
} \
|
||||
\
|
||||
FT_Error \
|
||||
FT_Create_Class_ ## class_( FT_Library library, \
|
||||
FT_ServiceDescRec** output_class ) \
|
||||
{ \
|
||||
FT_ServiceDescRec* clazz = NULL; \
|
||||
FT_Error error; \
|
||||
FT_Memory memory = library->memory; \
|
||||
\
|
||||
\
|
||||
if ( FT_ALLOC( clazz, sizeof ( *clazz ) * 4 ) ) \
|
||||
return error; \
|
||||
\
|
||||
clazz[0].serv_id = serv_id_1; \
|
||||
clazz[0].serv_data = serv_data_1; \
|
||||
clazz[1].serv_id = serv_id_2; \
|
||||
clazz[1].serv_data = serv_data_2; \
|
||||
clazz[2].serv_id = serv_id_3; \
|
||||
clazz[2].serv_data = serv_data_3; \
|
||||
clazz[3].serv_id = NULL; \
|
||||
clazz[3].serv_data = NULL; \
|
||||
\
|
||||
*output_class = clazz; \
|
||||
\
|
||||
return FT_Err_Ok; \
|
||||
}
|
||||
|
||||
#define FT_DEFINE_SERVICEDESCREC4( class_, \
|
||||
serv_id_1, serv_data_1, \
|
||||
serv_id_2, serv_data_2, \
|
||||
serv_id_3, serv_data_3, \
|
||||
serv_id_4, serv_data_4 ) \
|
||||
void \
|
||||
FT_Destroy_Class_ ## class_( FT_Library library, \
|
||||
FT_ServiceDescRec* clazz ) \
|
||||
{ \
|
||||
FT_Memory memory = library->memory; \
|
||||
\
|
||||
\
|
||||
if ( clazz ) \
|
||||
FT_FREE( clazz ); \
|
||||
} \
|
||||
\
|
||||
FT_Error \
|
||||
FT_Create_Class_ ## class_( FT_Library library, \
|
||||
FT_ServiceDescRec** output_class ) \
|
||||
{ \
|
||||
FT_ServiceDescRec* clazz = NULL; \
|
||||
FT_Error error; \
|
||||
FT_Memory memory = library->memory; \
|
||||
\
|
||||
\
|
||||
if ( FT_ALLOC( clazz, sizeof ( *clazz ) * 5 ) ) \
|
||||
return error; \
|
||||
\
|
||||
clazz[0].serv_id = serv_id_1; \
|
||||
clazz[0].serv_data = serv_data_1; \
|
||||
clazz[1].serv_id = serv_id_2; \
|
||||
clazz[1].serv_data = serv_data_2; \
|
||||
clazz[2].serv_id = serv_id_3; \
|
||||
clazz[2].serv_data = serv_data_3; \
|
||||
clazz[3].serv_id = serv_id_4; \
|
||||
clazz[3].serv_data = serv_data_4; \
|
||||
clazz[4].serv_id = NULL; \
|
||||
clazz[4].serv_data = NULL; \
|
||||
\
|
||||
*output_class = clazz; \
|
||||
\
|
||||
return FT_Err_Ok; \
|
||||
}
|
||||
|
||||
#define FT_DEFINE_SERVICEDESCREC5( class_, \
|
||||
serv_id_1, serv_data_1, \
|
||||
serv_id_2, serv_data_2, \
|
||||
serv_id_3, serv_data_3, \
|
||||
serv_id_4, serv_data_4, \
|
||||
serv_id_5, serv_data_5 ) \
|
||||
void \
|
||||
FT_Destroy_Class_ ## class_( FT_Library library, \
|
||||
FT_ServiceDescRec* clazz ) \
|
||||
{ \
|
||||
FT_Memory memory = library->memory; \
|
||||
\
|
||||
\
|
||||
if ( clazz ) \
|
||||
FT_FREE( clazz ); \
|
||||
} \
|
||||
\
|
||||
FT_Error \
|
||||
FT_Create_Class_ ## class_( FT_Library library, \
|
||||
FT_ServiceDescRec** output_class ) \
|
||||
{ \
|
||||
FT_ServiceDescRec* clazz = NULL; \
|
||||
FT_Error error; \
|
||||
FT_Memory memory = library->memory; \
|
||||
\
|
||||
\
|
||||
if ( FT_ALLOC( clazz, sizeof ( *clazz ) * 6 ) ) \
|
||||
return error; \
|
||||
\
|
||||
clazz[0].serv_id = serv_id_1; \
|
||||
clazz[0].serv_data = serv_data_1; \
|
||||
clazz[1].serv_id = serv_id_2; \
|
||||
clazz[1].serv_data = serv_data_2; \
|
||||
clazz[2].serv_id = serv_id_3; \
|
||||
clazz[2].serv_data = serv_data_3; \
|
||||
clazz[3].serv_id = serv_id_4; \
|
||||
clazz[3].serv_data = serv_data_4; \
|
||||
clazz[4].serv_id = serv_id_5; \
|
||||
clazz[4].serv_data = serv_data_5; \
|
||||
clazz[5].serv_id = NULL; \
|
||||
clazz[5].serv_data = NULL; \
|
||||
\
|
||||
*output_class = clazz; \
|
||||
\
|
||||
return FT_Err_Ok; \
|
||||
}
|
||||
|
||||
#define FT_DEFINE_SERVICEDESCREC6( class_, \
|
||||
serv_id_1, serv_data_1, \
|
||||
serv_id_2, serv_data_2, \
|
||||
serv_id_3, serv_data_3, \
|
||||
serv_id_4, serv_data_4, \
|
||||
serv_id_5, serv_data_5, \
|
||||
serv_id_6, serv_data_6 ) \
|
||||
void \
|
||||
FT_Destroy_Class_ ## class_( FT_Library library, \
|
||||
FT_ServiceDescRec* clazz ) \
|
||||
{ \
|
||||
FT_Memory memory = library->memory; \
|
||||
\
|
||||
\
|
||||
if ( clazz ) \
|
||||
FT_FREE( clazz ); \
|
||||
} \
|
||||
\
|
||||
FT_Error \
|
||||
FT_Create_Class_ ## class_( FT_Library library, \
|
||||
FT_ServiceDescRec** output_class ) \
|
||||
{ \
|
||||
FT_ServiceDescRec* clazz = NULL; \
|
||||
FT_Error error; \
|
||||
FT_Memory memory = library->memory; \
|
||||
\
|
||||
\
|
||||
if ( FT_ALLOC( clazz, sizeof ( *clazz ) * 7 ) ) \
|
||||
return error; \
|
||||
\
|
||||
clazz[0].serv_id = serv_id_1; \
|
||||
clazz[0].serv_data = serv_data_1; \
|
||||
clazz[1].serv_id = serv_id_2; \
|
||||
clazz[1].serv_data = serv_data_2; \
|
||||
clazz[2].serv_id = serv_id_3; \
|
||||
clazz[2].serv_data = serv_data_3; \
|
||||
clazz[3].serv_id = serv_id_4; \
|
||||
clazz[3].serv_data = serv_data_4; \
|
||||
clazz[4].serv_id = serv_id_5; \
|
||||
clazz[4].serv_data = serv_data_5; \
|
||||
clazz[5].serv_id = serv_id_6; \
|
||||
clazz[5].serv_data = serv_data_6; \
|
||||
clazz[6].serv_id = NULL; \
|
||||
clazz[6].serv_data = NULL; \
|
||||
\
|
||||
*output_class = clazz; \
|
||||
\
|
||||
return FT_Err_Ok; \
|
||||
}
|
||||
|
||||
#define FT_DEFINE_SERVICEDESCREC7( class_, \
|
||||
serv_id_1, serv_data_1, \
|
||||
serv_id_2, serv_data_2, \
|
||||
serv_id_3, serv_data_3, \
|
||||
serv_id_4, serv_data_4, \
|
||||
serv_id_5, serv_data_5, \
|
||||
serv_id_6, serv_data_6, \
|
||||
serv_id_7, serv_data_7 ) \
|
||||
void \
|
||||
FT_Destroy_Class_ ## class_( FT_Library library, \
|
||||
FT_ServiceDescRec* clazz ) \
|
||||
{ \
|
||||
FT_Memory memory = library->memory; \
|
||||
\
|
||||
\
|
||||
if ( clazz ) \
|
||||
FT_FREE( clazz ); \
|
||||
} \
|
||||
\
|
||||
FT_Error \
|
||||
FT_Create_Class_ ## class_( FT_Library library, \
|
||||
FT_ServiceDescRec** output_class ) \
|
||||
{ \
|
||||
FT_ServiceDescRec* clazz = NULL; \
|
||||
FT_Error error; \
|
||||
FT_Memory memory = library->memory; \
|
||||
\
|
||||
\
|
||||
if ( FT_ALLOC( clazz, sizeof ( *clazz ) * 8 ) ) \
|
||||
return error; \
|
||||
\
|
||||
clazz[0].serv_id = serv_id_1; \
|
||||
clazz[0].serv_data = serv_data_1; \
|
||||
clazz[1].serv_id = serv_id_2; \
|
||||
clazz[1].serv_data = serv_data_2; \
|
||||
clazz[2].serv_id = serv_id_3; \
|
||||
clazz[2].serv_data = serv_data_3; \
|
||||
clazz[3].serv_id = serv_id_4; \
|
||||
clazz[3].serv_data = serv_data_4; \
|
||||
clazz[4].serv_id = serv_id_5; \
|
||||
clazz[4].serv_data = serv_data_5; \
|
||||
clazz[5].serv_id = serv_id_6; \
|
||||
clazz[5].serv_data = serv_data_6; \
|
||||
clazz[6].serv_id = serv_id_7; \
|
||||
clazz[6].serv_data = serv_data_7; \
|
||||
clazz[7].serv_id = NULL; \
|
||||
clazz[7].serv_data = NULL; \
|
||||
\
|
||||
*output_class = clazz; \
|
||||
\
|
||||
return FT_Err_Ok; \
|
||||
}
|
||||
|
||||
#define FT_DEFINE_SERVICEDESCREC8( class_, \
|
||||
serv_id_1, serv_data_1, \
|
||||
serv_id_2, serv_data_2, \
|
||||
serv_id_3, serv_data_3, \
|
||||
serv_id_4, serv_data_4, \
|
||||
serv_id_5, serv_data_5, \
|
||||
serv_id_6, serv_data_6, \
|
||||
serv_id_7, serv_data_7, \
|
||||
serv_id_8, serv_data_8 ) \
|
||||
void \
|
||||
FT_Destroy_Class_ ## class_( FT_Library library, \
|
||||
FT_ServiceDescRec* clazz ) \
|
||||
{ \
|
||||
FT_Memory memory = library->memory; \
|
||||
\
|
||||
\
|
||||
if ( clazz ) \
|
||||
FT_FREE( clazz ); \
|
||||
} \
|
||||
\
|
||||
FT_Error \
|
||||
FT_Create_Class_ ## class_( FT_Library library, \
|
||||
FT_ServiceDescRec** output_class ) \
|
||||
{ \
|
||||
FT_ServiceDescRec* clazz = NULL; \
|
||||
FT_Error error; \
|
||||
FT_Memory memory = library->memory; \
|
||||
\
|
||||
\
|
||||
if ( FT_ALLOC( clazz, sizeof ( *clazz ) * 9 ) ) \
|
||||
return error; \
|
||||
\
|
||||
clazz[0].serv_id = serv_id_1; \
|
||||
clazz[0].serv_data = serv_data_1; \
|
||||
clazz[1].serv_id = serv_id_2; \
|
||||
clazz[1].serv_data = serv_data_2; \
|
||||
clazz[2].serv_id = serv_id_3; \
|
||||
clazz[2].serv_data = serv_data_3; \
|
||||
clazz[3].serv_id = serv_id_4; \
|
||||
clazz[3].serv_data = serv_data_4; \
|
||||
clazz[4].serv_id = serv_id_5; \
|
||||
clazz[4].serv_data = serv_data_5; \
|
||||
clazz[5].serv_id = serv_id_6; \
|
||||
clazz[5].serv_data = serv_data_6; \
|
||||
clazz[6].serv_id = serv_id_7; \
|
||||
clazz[6].serv_data = serv_data_7; \
|
||||
clazz[7].serv_id = serv_id_8; \
|
||||
clazz[7].serv_data = serv_data_8; \
|
||||
clazz[8].serv_id = NULL; \
|
||||
clazz[8].serv_data = NULL; \
|
||||
\
|
||||
*output_class = clazz; \
|
||||
\
|
||||
return FT_Err_Ok; \
|
||||
}
|
||||
|
||||
#define FT_DEFINE_SERVICEDESCREC9( class_, \
|
||||
serv_id_1, serv_data_1, \
|
||||
serv_id_2, serv_data_2, \
|
||||
serv_id_3, serv_data_3, \
|
||||
serv_id_4, serv_data_4, \
|
||||
serv_id_5, serv_data_5, \
|
||||
serv_id_6, serv_data_6, \
|
||||
serv_id_7, serv_data_7, \
|
||||
serv_id_8, serv_data_8, \
|
||||
serv_id_9, serv_data_9 ) \
|
||||
void \
|
||||
FT_Destroy_Class_ ## class_( FT_Library library, \
|
||||
FT_ServiceDescRec* clazz ) \
|
||||
{ \
|
||||
FT_Memory memory = library->memory; \
|
||||
\
|
||||
\
|
||||
if ( clazz ) \
|
||||
FT_FREE( clazz ); \
|
||||
} \
|
||||
\
|
||||
FT_Error \
|
||||
FT_Create_Class_ ## class_( FT_Library library, \
|
||||
FT_ServiceDescRec** output_class ) \
|
||||
{ \
|
||||
FT_ServiceDescRec* clazz = NULL; \
|
||||
FT_Error error; \
|
||||
FT_Memory memory = library->memory; \
|
||||
\
|
||||
\
|
||||
if ( FT_ALLOC( clazz, sizeof ( *clazz ) * 10 ) ) \
|
||||
return error; \
|
||||
\
|
||||
clazz[0].serv_id = serv_id_1; \
|
||||
clazz[0].serv_data = serv_data_1; \
|
||||
clazz[1].serv_id = serv_id_2; \
|
||||
clazz[1].serv_data = serv_data_2; \
|
||||
clazz[2].serv_id = serv_id_3; \
|
||||
clazz[2].serv_data = serv_data_3; \
|
||||
clazz[3].serv_id = serv_id_4; \
|
||||
clazz[3].serv_data = serv_data_4; \
|
||||
clazz[4].serv_id = serv_id_5; \
|
||||
clazz[4].serv_data = serv_data_5; \
|
||||
clazz[5].serv_id = serv_id_6; \
|
||||
clazz[5].serv_data = serv_data_6; \
|
||||
clazz[6].serv_id = serv_id_7; \
|
||||
clazz[6].serv_data = serv_data_7; \
|
||||
clazz[7].serv_id = serv_id_8; \
|
||||
clazz[7].serv_data = serv_data_8; \
|
||||
clazz[8].serv_id = serv_id_9; \
|
||||
clazz[8].serv_data = serv_data_9; \
|
||||
clazz[9].serv_id = NULL; \
|
||||
clazz[9].serv_data = NULL; \
|
||||
\
|
||||
*output_class = clazz; \
|
||||
\
|
||||
return FT_Err_Ok; \
|
||||
}
|
||||
|
||||
#define FT_DEFINE_SERVICEDESCREC10( class_, \
|
||||
serv_id_1, serv_data_1, \
|
||||
serv_id_2, serv_data_2, \
|
||||
serv_id_3, serv_data_3, \
|
||||
serv_id_4, serv_data_4, \
|
||||
serv_id_5, serv_data_5, \
|
||||
serv_id_6, serv_data_6, \
|
||||
serv_id_7, serv_data_7, \
|
||||
serv_id_8, serv_data_8, \
|
||||
serv_id_9, serv_data_9, \
|
||||
serv_id_10, serv_data_10 ) \
|
||||
void \
|
||||
FT_Destroy_Class_ ## class_( FT_Library library, \
|
||||
FT_ServiceDescRec* clazz ) \
|
||||
{ \
|
||||
FT_Memory memory = library->memory; \
|
||||
\
|
||||
\
|
||||
if ( clazz ) \
|
||||
FT_FREE( clazz ); \
|
||||
} \
|
||||
\
|
||||
FT_Error \
|
||||
FT_Create_Class_ ## class_( FT_Library library, \
|
||||
FT_ServiceDescRec** output_class ) \
|
||||
{ \
|
||||
FT_ServiceDescRec* clazz = NULL; \
|
||||
FT_Error error; \
|
||||
FT_Memory memory = library->memory; \
|
||||
\
|
||||
\
|
||||
if ( FT_ALLOC( clazz, sizeof ( *clazz ) * 11 ) ) \
|
||||
return error; \
|
||||
\
|
||||
clazz[ 0].serv_id = serv_id_1; \
|
||||
clazz[ 0].serv_data = serv_data_1; \
|
||||
clazz[ 1].serv_id = serv_id_2; \
|
||||
clazz[ 1].serv_data = serv_data_2; \
|
||||
clazz[ 2].serv_id = serv_id_3; \
|
||||
clazz[ 2].serv_data = serv_data_3; \
|
||||
clazz[ 3].serv_id = serv_id_4; \
|
||||
clazz[ 3].serv_data = serv_data_4; \
|
||||
clazz[ 4].serv_id = serv_id_5; \
|
||||
clazz[ 4].serv_data = serv_data_5; \
|
||||
clazz[ 5].serv_id = serv_id_6; \
|
||||
clazz[ 5].serv_data = serv_data_6; \
|
||||
clazz[ 6].serv_id = serv_id_7; \
|
||||
clazz[ 6].serv_data = serv_data_7; \
|
||||
clazz[ 7].serv_id = serv_id_8; \
|
||||
clazz[ 7].serv_data = serv_data_8; \
|
||||
clazz[ 8].serv_id = serv_id_9; \
|
||||
clazz[ 8].serv_data = serv_data_9; \
|
||||
clazz[ 9].serv_id = serv_id_10; \
|
||||
clazz[ 9].serv_data = serv_data_10; \
|
||||
clazz[10].serv_id = NULL; \
|
||||
clazz[10].serv_data = NULL; \
|
||||
\
|
||||
*output_class = clazz; \
|
||||
\
|
||||
return FT_Err_Ok; \
|
||||
}
|
||||
|
||||
#endif /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
|
||||
/*
|
||||
* Parse a list of FT_ServiceDescRec descriptors and look for
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
|
||||
#define FT_INTERNAL_OBJECTS_H <freetype/internal/ftobjs.h>
|
||||
#define FT_INTERNAL_PIC_H <freetype/internal/ftpic.h>
|
||||
#define FT_INTERNAL_STREAM_H <freetype/internal/ftstream.h>
|
||||
#define FT_INTERNAL_MEMORY_H <freetype/internal/ftmemory.h>
|
||||
#define FT_INTERNAL_DEBUG_H <freetype/internal/ftdebug.h>
|
||||
|
|
|
|||
|
|
@ -680,6 +680,8 @@ FT_BEGIN_HEADER
|
|||
typedef PSHinter_Interface* PSHinter_Service;
|
||||
|
||||
|
||||
#ifndef FT_CONFIG_OPTION_PIC
|
||||
|
||||
#define FT_DEFINE_PSHINTER_INTERFACE( \
|
||||
class_, \
|
||||
get_globals_funcs_, \
|
||||
|
|
@ -692,6 +694,25 @@ FT_BEGIN_HEADER
|
|||
get_t2_funcs_ \
|
||||
};
|
||||
|
||||
#else /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
#define FT_DEFINE_PSHINTER_INTERFACE( \
|
||||
class_, \
|
||||
get_globals_funcs_, \
|
||||
get_t1_funcs_, \
|
||||
get_t2_funcs_ ) \
|
||||
void \
|
||||
FT_Init_Class_ ## class_( FT_Library library, \
|
||||
PSHinter_Interface* clazz ) \
|
||||
{ \
|
||||
FT_UNUSED( library ); \
|
||||
\
|
||||
clazz->get_globals_funcs = get_globals_funcs_; \
|
||||
clazz->get_t1_funcs = get_t1_funcs_; \
|
||||
clazz->get_t2_funcs = get_t2_funcs_; \
|
||||
}
|
||||
|
||||
#endif /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
FT_END_HEADER
|
||||
|
||||
|
|
|
|||
|
|
@ -46,6 +46,8 @@ FT_BEGIN_HEADER
|
|||
};
|
||||
|
||||
|
||||
#ifndef FT_CONFIG_OPTION_PIC
|
||||
|
||||
#define FT_DEFINE_SERVICE_BDFRec( class_, \
|
||||
get_charset_id_, \
|
||||
get_property_ ) \
|
||||
|
|
@ -54,6 +56,20 @@ FT_BEGIN_HEADER
|
|||
get_charset_id_, get_property_ \
|
||||
};
|
||||
|
||||
#else /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
#define FT_DEFINE_SERVICE_BDFRec( class_, \
|
||||
get_charset_id_, \
|
||||
get_property_ ) \
|
||||
void \
|
||||
FT_Init_Class_ ## class_( FT_Service_BDFRec* clazz ) \
|
||||
{ \
|
||||
clazz->get_charset_id = get_charset_id_; \
|
||||
clazz->get_property = get_property_; \
|
||||
}
|
||||
|
||||
#endif /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
/* */
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -65,6 +65,8 @@ FT_BEGIN_HEADER
|
|||
};
|
||||
|
||||
|
||||
#ifndef FT_CONFIG_OPTION_PIC
|
||||
|
||||
#define FT_DEFINE_SERVICE_CFFLOADREC( class_, \
|
||||
get_standard_encoding_, \
|
||||
load_private_dict_, \
|
||||
|
|
@ -80,6 +82,26 @@ FT_BEGIN_HEADER
|
|||
blend_build_vector_ \
|
||||
};
|
||||
|
||||
#else /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
#define FT_DEFINE_SERVICE_CFFLOADREC( class_, \
|
||||
get_standard_encoding_, \
|
||||
load_private_dict_, \
|
||||
fd_select_get_, \
|
||||
blend_check_vector_, \
|
||||
blend_build_vector_ ) \
|
||||
void \
|
||||
FT_Init_Class_ ## class_( FT_Service_CFFLoadRec* clazz ) \
|
||||
{ \
|
||||
clazz->get_standard_encoding = get_standard_encoding_; \
|
||||
clazz->load_private_dict = load_private_dict_; \
|
||||
clazz->fd_select_get = fd_select_get_; \
|
||||
clazz->blend_check_vector = blend_check_vector_; \
|
||||
clazz->blend_build_vector = blend_build_vector_; \
|
||||
}
|
||||
|
||||
#endif /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
|
||||
FT_END_HEADER
|
||||
|
||||
|
|
|
|||
|
|
@ -48,6 +48,8 @@ FT_BEGIN_HEADER
|
|||
};
|
||||
|
||||
|
||||
#ifndef FT_CONFIG_OPTION_PIC
|
||||
|
||||
#define FT_DEFINE_SERVICE_CIDREC( class_, \
|
||||
get_ros_, \
|
||||
get_is_cid_, \
|
||||
|
|
@ -57,6 +59,25 @@ FT_BEGIN_HEADER
|
|||
get_ros_, get_is_cid_, get_cid_from_glyph_index_ \
|
||||
};
|
||||
|
||||
#else /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
#define FT_DEFINE_SERVICE_CIDREC( class_, \
|
||||
get_ros_, \
|
||||
get_is_cid_, \
|
||||
get_cid_from_glyph_index_ ) \
|
||||
void \
|
||||
FT_Init_Class_ ## class_( FT_Library library, \
|
||||
FT_Service_CIDRec* clazz ) \
|
||||
{ \
|
||||
FT_UNUSED( library ); \
|
||||
\
|
||||
clazz->get_ros = get_ros_; \
|
||||
clazz->get_is_cid = get_is_cid_; \
|
||||
clazz->get_cid_from_glyph_index = get_cid_from_glyph_index_; \
|
||||
}
|
||||
|
||||
#endif /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
/* */
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -52,6 +52,8 @@ FT_BEGIN_HEADER
|
|||
};
|
||||
|
||||
|
||||
#ifndef FT_CONFIG_OPTION_PIC
|
||||
|
||||
#define FT_DEFINE_SERVICE_GLYPHDICTREC( class_, \
|
||||
get_name_, \
|
||||
name_index_ ) \
|
||||
|
|
@ -60,6 +62,23 @@ FT_BEGIN_HEADER
|
|||
get_name_, name_index_ \
|
||||
};
|
||||
|
||||
#else /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
#define FT_DEFINE_SERVICE_GLYPHDICTREC( class_, \
|
||||
get_name_, \
|
||||
name_index_ ) \
|
||||
void \
|
||||
FT_Init_Class_ ## class_( FT_Library library, \
|
||||
FT_Service_GlyphDictRec* clazz ) \
|
||||
{ \
|
||||
FT_UNUSED( library ); \
|
||||
\
|
||||
clazz->get_name = get_name_; \
|
||||
clazz->name_index = name_index_; \
|
||||
}
|
||||
|
||||
#endif /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
/* */
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -93,6 +93,8 @@ FT_BEGIN_HEADER
|
|||
};
|
||||
|
||||
|
||||
#ifndef FT_CONFIG_OPTION_PIC
|
||||
|
||||
#define FT_DEFINE_SERVICE_METRICSVARIATIONSREC( class_, \
|
||||
hadvance_adjust_, \
|
||||
lsb_adjust_, \
|
||||
|
|
@ -114,6 +116,32 @@ FT_BEGIN_HEADER
|
|||
metrics_adjust_ \
|
||||
};
|
||||
|
||||
#else /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
#define FT_DEFINE_SERVICE_METRICSVARIATIONSREC( class_, \
|
||||
hadvance_adjust_, \
|
||||
lsb_adjust_, \
|
||||
rsb_adjust_, \
|
||||
vadvance_adjust_, \
|
||||
tsb_adjust_, \
|
||||
bsb_adjust_, \
|
||||
vorg_adjust_, \
|
||||
metrics_adjust_ ) \
|
||||
void \
|
||||
FT_Init_Class_ ## class_( FT_Service_MetricsVariationsRec* clazz ) \
|
||||
{ \
|
||||
clazz->hadvance_adjust = hadvance_adjust_; \
|
||||
clazz->lsb_adjust = lsb_adjust_; \
|
||||
clazz->rsb_adjust = rsb_adjust_; \
|
||||
clazz->vadvance_adjust = vadvance_adjust_; \
|
||||
clazz->tsb_adjust = tsb_adjust_; \
|
||||
clazz->bsb_adjust = bsb_adjust_; \
|
||||
clazz->vorg_adjust = vorg_adjust_; \
|
||||
clazz->metrics_adjust = metrics_adjust_; \
|
||||
}
|
||||
|
||||
#endif /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
/* */
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -104,6 +104,8 @@ FT_BEGIN_HEADER
|
|||
};
|
||||
|
||||
|
||||
#ifndef FT_CONFIG_OPTION_PIC
|
||||
|
||||
#define FT_DEFINE_SERVICE_MULTIMASTERSREC( class_, \
|
||||
get_mm_, \
|
||||
set_mm_design_, \
|
||||
|
|
@ -129,6 +131,36 @@ FT_BEGIN_HEADER
|
|||
done_blend_ \
|
||||
};
|
||||
|
||||
#else /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
#define FT_DEFINE_SERVICE_MULTIMASTERSREC( class_, \
|
||||
get_mm_, \
|
||||
set_mm_design_, \
|
||||
set_mm_blend_, \
|
||||
get_mm_blend_, \
|
||||
get_mm_var_, \
|
||||
set_var_design_, \
|
||||
get_var_design_, \
|
||||
set_instance_, \
|
||||
get_var_blend_, \
|
||||
done_blend_ ) \
|
||||
void \
|
||||
FT_Init_Class_ ## class_( FT_Service_MultiMastersRec* clazz ) \
|
||||
{ \
|
||||
clazz->get_mm = get_mm_; \
|
||||
clazz->set_mm_design = set_mm_design_; \
|
||||
clazz->set_mm_blend = set_mm_blend_; \
|
||||
clazz->get_mm_blend = get_mm_blend_; \
|
||||
clazz->get_mm_var = get_mm_var_; \
|
||||
clazz->set_var_design = set_var_design_; \
|
||||
clazz->get_var_design = get_var_design_; \
|
||||
clazz->set_instance = set_instance_; \
|
||||
clazz->get_var_blend = get_var_blend_; \
|
||||
clazz->done_blend = done_blend_; \
|
||||
}
|
||||
|
||||
#endif /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
/* */
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -47,12 +47,28 @@ FT_BEGIN_HEADER
|
|||
};
|
||||
|
||||
|
||||
#ifndef FT_CONFIG_OPTION_PIC
|
||||
|
||||
#define FT_DEFINE_SERVICE_PSFONTNAMEREC( class_, get_ps_font_name_ ) \
|
||||
static const FT_Service_PsFontNameRec class_ = \
|
||||
{ \
|
||||
get_ps_font_name_ \
|
||||
};
|
||||
|
||||
#else /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
#define FT_DEFINE_SERVICE_PSFONTNAMEREC( class_, get_ps_font_name_ ) \
|
||||
void \
|
||||
FT_Init_Class_ ## class_( FT_Library library, \
|
||||
FT_Service_PsFontNameRec* clazz ) \
|
||||
{ \
|
||||
FT_UNUSED( library ); \
|
||||
\
|
||||
clazz->get_ps_font_name = get_ps_font_name_; \
|
||||
}
|
||||
|
||||
#endif /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
/* */
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -45,6 +45,8 @@ FT_BEGIN_HEADER
|
|||
};
|
||||
|
||||
|
||||
#ifndef FT_CONFIG_OPTION_PIC
|
||||
|
||||
#define FT_DEFINE_SERVICE_PROPERTIESREC( class_, \
|
||||
set_property_, \
|
||||
get_property_ ) \
|
||||
|
|
@ -54,6 +56,20 @@ FT_BEGIN_HEADER
|
|||
get_property_ \
|
||||
};
|
||||
|
||||
#else /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
#define FT_DEFINE_SERVICE_PROPERTIESREC( class_, \
|
||||
set_property_, \
|
||||
get_property_ ) \
|
||||
void \
|
||||
FT_Init_Class_ ## class_( FT_Service_PropertiesRec* clazz ) \
|
||||
{ \
|
||||
clazz->set_property = set_property_; \
|
||||
clazz->get_property = get_property_; \
|
||||
}
|
||||
|
||||
#endif /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
/* */
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -118,6 +118,8 @@ FT_BEGIN_HEADER
|
|||
};
|
||||
|
||||
|
||||
#ifndef FT_CONFIG_OPTION_PIC
|
||||
|
||||
#define FT_DEFINE_SERVICE_PSCMAPSREC( class_, \
|
||||
unicode_value_, \
|
||||
unicodes_init_, \
|
||||
|
|
@ -134,6 +136,35 @@ FT_BEGIN_HEADER
|
|||
adobe_std_strings_, adobe_std_encoding_, adobe_expert_encoding_ \
|
||||
};
|
||||
|
||||
#else /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
#define FT_DEFINE_SERVICE_PSCMAPSREC( class_, \
|
||||
unicode_value_, \
|
||||
unicodes_init_, \
|
||||
unicodes_char_index_, \
|
||||
unicodes_char_next_, \
|
||||
macintosh_name_, \
|
||||
adobe_std_strings_, \
|
||||
adobe_std_encoding_, \
|
||||
adobe_expert_encoding_ ) \
|
||||
void \
|
||||
FT_Init_Class_ ## class_( FT_Library library, \
|
||||
FT_Service_PsCMapsRec* clazz ) \
|
||||
{ \
|
||||
FT_UNUSED( library ); \
|
||||
\
|
||||
clazz->unicode_value = unicode_value_; \
|
||||
clazz->unicodes_init = unicodes_init_; \
|
||||
clazz->unicodes_char_index = unicodes_char_index_; \
|
||||
clazz->unicodes_char_next = unicodes_char_next_; \
|
||||
clazz->macintosh_name = macintosh_name_; \
|
||||
clazz->adobe_std_strings = adobe_std_strings_; \
|
||||
clazz->adobe_std_encoding = adobe_std_encoding_; \
|
||||
clazz->adobe_expert_encoding = adobe_expert_encoding_; \
|
||||
}
|
||||
|
||||
#endif /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
/* */
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -62,6 +62,8 @@ FT_BEGIN_HEADER
|
|||
};
|
||||
|
||||
|
||||
#ifndef FT_CONFIG_OPTION_PIC
|
||||
|
||||
#define FT_DEFINE_SERVICE_PSINFOREC( class_, \
|
||||
get_font_info_, \
|
||||
ps_get_font_extra_, \
|
||||
|
|
@ -74,6 +76,29 @@ FT_BEGIN_HEADER
|
|||
get_font_private_, get_font_value_ \
|
||||
};
|
||||
|
||||
#else /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
#define FT_DEFINE_SERVICE_PSINFOREC( class_, \
|
||||
get_font_info_, \
|
||||
ps_get_font_extra_, \
|
||||
has_glyph_names_, \
|
||||
get_font_private_, \
|
||||
get_font_value_ ) \
|
||||
void \
|
||||
FT_Init_Class_ ## class_( FT_Library library, \
|
||||
FT_Service_PsInfoRec* clazz ) \
|
||||
{ \
|
||||
FT_UNUSED( library ); \
|
||||
\
|
||||
clazz->ps_get_font_info = get_font_info_; \
|
||||
clazz->ps_get_font_extra = ps_get_font_extra_; \
|
||||
clazz->ps_has_glyph_names = has_glyph_names_; \
|
||||
clazz->ps_get_font_private = get_font_private_; \
|
||||
clazz->ps_get_font_value = get_font_value_; \
|
||||
}
|
||||
|
||||
#endif /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
/* */
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -70,12 +70,27 @@ FT_BEGIN_HEADER
|
|||
};
|
||||
|
||||
|
||||
#ifndef FT_CONFIG_OPTION_PIC
|
||||
|
||||
#define FT_DEFINE_SERVICE_SFNT_TABLEREC( class_, load_, get_, info_ ) \
|
||||
static const FT_Service_SFNT_TableRec class_ = \
|
||||
{ \
|
||||
load_, get_, info_ \
|
||||
};
|
||||
|
||||
#else /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
#define FT_DEFINE_SERVICE_SFNT_TABLEREC( class_, load_, get_, info_ ) \
|
||||
void \
|
||||
FT_Init_Class_ ## class_( FT_Service_SFNT_TableRec* clazz ) \
|
||||
{ \
|
||||
clazz->load_table = load_; \
|
||||
clazz->get_table = get_; \
|
||||
clazz->table_info = info_; \
|
||||
}
|
||||
|
||||
#endif /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
/* */
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -73,6 +73,7 @@ FT_BEGIN_HEADER
|
|||
TT_CMap_Info_GetFunc get_cmap_info;
|
||||
};
|
||||
|
||||
#ifndef FT_CONFIG_OPTION_PIC
|
||||
|
||||
#define FT_DEFINE_SERVICE_TTCMAPSREC( class_, get_cmap_info_ ) \
|
||||
static const FT_Service_TTCMapsRec class_ = \
|
||||
|
|
@ -80,6 +81,20 @@ FT_BEGIN_HEADER
|
|||
get_cmap_info_ \
|
||||
};
|
||||
|
||||
#else /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
#define FT_DEFINE_SERVICE_TTCMAPSREC( class_, get_cmap_info_ ) \
|
||||
void \
|
||||
FT_Init_Class_ ## class_( FT_Library library, \
|
||||
FT_Service_TTCMapsRec* clazz ) \
|
||||
{ \
|
||||
FT_UNUSED( library ); \
|
||||
\
|
||||
clazz->get_cmap_info = get_cmap_info_; \
|
||||
}
|
||||
|
||||
#endif /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
/* */
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -39,12 +39,25 @@ FT_BEGIN_HEADER
|
|||
};
|
||||
|
||||
|
||||
#ifndef FT_CONFIG_OPTION_PIC
|
||||
|
||||
#define FT_DEFINE_SERVICE_TTGLYFREC( class_, get_location_ ) \
|
||||
static const FT_Service_TTGlyfRec class_ = \
|
||||
{ \
|
||||
get_location_ \
|
||||
};
|
||||
|
||||
#else /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
#define FT_DEFINE_SERVICE_TTGLYFREC( class_, get_location_ ) \
|
||||
void \
|
||||
FT_Init_Class_ ## class_( FT_Service_TTGlyfRec* clazz ) \
|
||||
{ \
|
||||
clazz->get_location = get_location_; \
|
||||
}
|
||||
|
||||
#endif /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
/* */
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -627,6 +627,7 @@ FT_BEGIN_HEADER
|
|||
/* transitional */
|
||||
typedef SFNT_Interface* SFNT_Service;
|
||||
|
||||
#ifndef FT_CONFIG_OPTION_PIC
|
||||
|
||||
#define FT_DEFINE_SFNT_INTERFACE( \
|
||||
class_, \
|
||||
|
|
@ -696,6 +697,84 @@ FT_BEGIN_HEADER
|
|||
get_name_id_ \
|
||||
};
|
||||
|
||||
#else /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
#define FT_INTERNAL( a, a_ ) \
|
||||
clazz->a = a_;
|
||||
|
||||
#define FT_DEFINE_SFNT_INTERFACE( \
|
||||
class_, \
|
||||
goto_table_, \
|
||||
init_face_, \
|
||||
load_face_, \
|
||||
done_face_, \
|
||||
get_interface_, \
|
||||
load_any_, \
|
||||
load_head_, \
|
||||
load_hhea_, \
|
||||
load_cmap_, \
|
||||
load_maxp_, \
|
||||
load_os2_, \
|
||||
load_post_, \
|
||||
load_name_, \
|
||||
free_name_, \
|
||||
load_kern_, \
|
||||
load_gasp_, \
|
||||
load_pclt_, \
|
||||
load_bhed_, \
|
||||
load_sbit_image_, \
|
||||
get_psname_, \
|
||||
free_psnames_, \
|
||||
get_kerning_, \
|
||||
load_font_dir_, \
|
||||
load_hmtx_, \
|
||||
load_eblc_, \
|
||||
free_eblc_, \
|
||||
set_sbit_strike_, \
|
||||
load_strike_metrics_, \
|
||||
get_metrics_, \
|
||||
get_name_, \
|
||||
get_name_id_ ) \
|
||||
void \
|
||||
FT_Init_Class_ ## class_( FT_Library library, \
|
||||
SFNT_Interface* clazz ) \
|
||||
{ \
|
||||
FT_UNUSED( library ); \
|
||||
\
|
||||
clazz->goto_table = goto_table_; \
|
||||
clazz->init_face = init_face_; \
|
||||
clazz->load_face = load_face_; \
|
||||
clazz->done_face = done_face_; \
|
||||
clazz->get_interface = get_interface_; \
|
||||
clazz->load_any = load_any_; \
|
||||
clazz->load_head = load_head_; \
|
||||
clazz->load_hhea = load_hhea_; \
|
||||
clazz->load_cmap = load_cmap_; \
|
||||
clazz->load_maxp = load_maxp_; \
|
||||
clazz->load_os2 = load_os2_; \
|
||||
clazz->load_post = load_post_; \
|
||||
clazz->load_name = load_name_; \
|
||||
clazz->free_name = free_name_; \
|
||||
clazz->load_kern = load_kern_; \
|
||||
clazz->load_gasp = load_gasp_; \
|
||||
clazz->load_pclt = load_pclt_; \
|
||||
clazz->load_bhed = load_bhed_; \
|
||||
clazz->load_sbit_image = load_sbit_image_; \
|
||||
clazz->get_psname = get_psname_; \
|
||||
clazz->free_psnames = free_psnames_; \
|
||||
clazz->get_kerning = get_kerning_; \
|
||||
clazz->load_font_dir = load_font_dir_; \
|
||||
clazz->load_hmtx = load_hmtx_; \
|
||||
clazz->load_eblc = load_eblc_; \
|
||||
clazz->free_eblc = free_eblc_; \
|
||||
clazz->set_sbit_strike = set_sbit_strike_; \
|
||||
clazz->load_strike_metrics = load_strike_metrics_; \
|
||||
clazz->get_metrics = get_metrics_; \
|
||||
clazz->get_name = get_name_; \
|
||||
clazz->get_name_id = get_name_id_; \
|
||||
}
|
||||
|
||||
#endif /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
FT_END_HEADER
|
||||
|
||||
|
|
|
|||
285
vendor/FreeType2/src/autofit/afangles.c
vendored
Normal file
285
vendor/FreeType2/src/autofit/afangles.c
vendored
Normal file
|
|
@ -0,0 +1,285 @@
|
|||
/***************************************************************************/
|
||||
/* */
|
||||
/* afangles.c */
|
||||
/* */
|
||||
/* Routines used to compute vector angles with limited accuracy */
|
||||
/* and very high speed. It also contains sorting routines (body). */
|
||||
/* */
|
||||
/* Copyright 2003-2018 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 "aftypes.h"
|
||||
|
||||
|
||||
/*
|
||||
* We are not using `af_angle_atan' anymore, but we keep the source
|
||||
* code below just in case...
|
||||
*/
|
||||
|
||||
|
||||
#if 0
|
||||
|
||||
|
||||
/*
|
||||
* The trick here is to realize that we don't need a very accurate angle
|
||||
* approximation. We are going to use the result of `af_angle_atan' to
|
||||
* only compare the sign of angle differences, or check whether its
|
||||
* magnitude is very small.
|
||||
*
|
||||
* The approximation
|
||||
*
|
||||
* dy * PI / (|dx|+|dy|)
|
||||
*
|
||||
* should be enough, and much faster to compute.
|
||||
*/
|
||||
FT_LOCAL_DEF( AF_Angle )
|
||||
af_angle_atan( FT_Fixed dx,
|
||||
FT_Fixed dy )
|
||||
{
|
||||
AF_Angle angle;
|
||||
FT_Fixed ax = dx;
|
||||
FT_Fixed ay = dy;
|
||||
|
||||
|
||||
if ( ax < 0 )
|
||||
ax = -ax;
|
||||
if ( ay < 0 )
|
||||
ay = -ay;
|
||||
|
||||
ax += ay;
|
||||
|
||||
if ( ax == 0 )
|
||||
angle = 0;
|
||||
else
|
||||
{
|
||||
angle = ( AF_ANGLE_PI2 * dy ) / ( ax + ay );
|
||||
if ( dx < 0 )
|
||||
{
|
||||
if ( angle >= 0 )
|
||||
angle = AF_ANGLE_PI - angle;
|
||||
else
|
||||
angle = -AF_ANGLE_PI - angle;
|
||||
}
|
||||
}
|
||||
|
||||
return angle;
|
||||
}
|
||||
|
||||
|
||||
#elif 0
|
||||
|
||||
|
||||
/* the following table has been automatically generated with */
|
||||
/* the `mather.py' Python script */
|
||||
|
||||
#define AF_ATAN_BITS 8
|
||||
|
||||
static const FT_Byte af_arctan[1L << AF_ATAN_BITS] =
|
||||
{
|
||||
0, 0, 1, 1, 1, 2, 2, 2,
|
||||
3, 3, 3, 3, 4, 4, 4, 5,
|
||||
5, 5, 6, 6, 6, 7, 7, 7,
|
||||
8, 8, 8, 9, 9, 9, 10, 10,
|
||||
10, 10, 11, 11, 11, 12, 12, 12,
|
||||
13, 13, 13, 14, 14, 14, 14, 15,
|
||||
15, 15, 16, 16, 16, 17, 17, 17,
|
||||
18, 18, 18, 18, 19, 19, 19, 20,
|
||||
20, 20, 21, 21, 21, 21, 22, 22,
|
||||
22, 23, 23, 23, 24, 24, 24, 24,
|
||||
25, 25, 25, 26, 26, 26, 26, 27,
|
||||
27, 27, 28, 28, 28, 28, 29, 29,
|
||||
29, 30, 30, 30, 30, 31, 31, 31,
|
||||
31, 32, 32, 32, 33, 33, 33, 33,
|
||||
34, 34, 34, 34, 35, 35, 35, 35,
|
||||
36, 36, 36, 36, 37, 37, 37, 38,
|
||||
38, 38, 38, 39, 39, 39, 39, 40,
|
||||
40, 40, 40, 41, 41, 41, 41, 42,
|
||||
42, 42, 42, 42, 43, 43, 43, 43,
|
||||
44, 44, 44, 44, 45, 45, 45, 45,
|
||||
46, 46, 46, 46, 46, 47, 47, 47,
|
||||
47, 48, 48, 48, 48, 48, 49, 49,
|
||||
49, 49, 50, 50, 50, 50, 50, 51,
|
||||
51, 51, 51, 51, 52, 52, 52, 52,
|
||||
52, 53, 53, 53, 53, 53, 54, 54,
|
||||
54, 54, 54, 55, 55, 55, 55, 55,
|
||||
56, 56, 56, 56, 56, 57, 57, 57,
|
||||
57, 57, 57, 58, 58, 58, 58, 58,
|
||||
59, 59, 59, 59, 59, 59, 60, 60,
|
||||
60, 60, 60, 61, 61, 61, 61, 61,
|
||||
61, 62, 62, 62, 62, 62, 62, 63,
|
||||
63, 63, 63, 63, 63, 64, 64, 64
|
||||
};
|
||||
|
||||
|
||||
FT_LOCAL_DEF( AF_Angle )
|
||||
af_angle_atan( FT_Fixed dx,
|
||||
FT_Fixed dy )
|
||||
{
|
||||
AF_Angle angle;
|
||||
|
||||
|
||||
/* check trivial cases */
|
||||
if ( dy == 0 )
|
||||
{
|
||||
angle = 0;
|
||||
if ( dx < 0 )
|
||||
angle = AF_ANGLE_PI;
|
||||
return angle;
|
||||
}
|
||||
else if ( dx == 0 )
|
||||
{
|
||||
angle = AF_ANGLE_PI2;
|
||||
if ( dy < 0 )
|
||||
angle = -AF_ANGLE_PI2;
|
||||
return angle;
|
||||
}
|
||||
|
||||
angle = 0;
|
||||
if ( dx < 0 )
|
||||
{
|
||||
dx = -dx;
|
||||
dy = -dy;
|
||||
angle = AF_ANGLE_PI;
|
||||
}
|
||||
|
||||
if ( dy < 0 )
|
||||
{
|
||||
FT_Pos tmp;
|
||||
|
||||
|
||||
tmp = dx;
|
||||
dx = -dy;
|
||||
dy = tmp;
|
||||
angle -= AF_ANGLE_PI2;
|
||||
}
|
||||
|
||||
if ( dx == 0 && dy == 0 )
|
||||
return 0;
|
||||
|
||||
if ( dx == dy )
|
||||
angle += AF_ANGLE_PI4;
|
||||
else if ( dx > dy )
|
||||
angle += af_arctan[FT_DivFix( dy, dx ) >> ( 16 - AF_ATAN_BITS )];
|
||||
else
|
||||
angle += AF_ANGLE_PI2 -
|
||||
af_arctan[FT_DivFix( dx, dy ) >> ( 16 - AF_ATAN_BITS )];
|
||||
|
||||
if ( angle > AF_ANGLE_PI )
|
||||
angle -= AF_ANGLE_2PI;
|
||||
|
||||
return angle;
|
||||
}
|
||||
|
||||
|
||||
#endif /* 0 */
|
||||
|
||||
|
||||
FT_LOCAL_DEF( void )
|
||||
af_sort_pos( FT_UInt count,
|
||||
FT_Pos* table )
|
||||
{
|
||||
FT_UInt i, j;
|
||||
FT_Pos swap;
|
||||
|
||||
|
||||
for ( i = 1; i < count; i++ )
|
||||
{
|
||||
for ( j = i; j > 0; j-- )
|
||||
{
|
||||
if ( table[j] >= table[j - 1] )
|
||||
break;
|
||||
|
||||
swap = table[j];
|
||||
table[j] = table[j - 1];
|
||||
table[j - 1] = swap;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FT_LOCAL_DEF( void )
|
||||
af_sort_and_quantize_widths( FT_UInt* count,
|
||||
AF_Width table,
|
||||
FT_Pos threshold )
|
||||
{
|
||||
FT_UInt i, j;
|
||||
FT_UInt cur_idx;
|
||||
FT_Pos cur_val;
|
||||
FT_Pos sum;
|
||||
AF_WidthRec swap;
|
||||
|
||||
|
||||
if ( *count == 1 )
|
||||
return;
|
||||
|
||||
/* sort */
|
||||
for ( i = 1; i < *count; i++ )
|
||||
{
|
||||
for ( j = i; j > 0; j-- )
|
||||
{
|
||||
if ( table[j].org >= table[j - 1].org )
|
||||
break;
|
||||
|
||||
swap = table[j];
|
||||
table[j] = table[j - 1];
|
||||
table[j - 1] = swap;
|
||||
}
|
||||
}
|
||||
|
||||
cur_idx = 0;
|
||||
cur_val = table[cur_idx].org;
|
||||
|
||||
/* compute and use mean values for clusters not larger than */
|
||||
/* `threshold'; this is very primitive and might not yield */
|
||||
/* the best result, but normally, using reference character */
|
||||
/* `o', `*count' is 2, so the code below is fully sufficient */
|
||||
for ( i = 1; i < *count; i++ )
|
||||
{
|
||||
if ( table[i].org - cur_val > threshold ||
|
||||
i == *count - 1 )
|
||||
{
|
||||
sum = 0;
|
||||
|
||||
/* fix loop for end of array */
|
||||
if ( table[i].org - cur_val <= threshold &&
|
||||
i == *count - 1 )
|
||||
i++;
|
||||
|
||||
for ( j = cur_idx; j < i; j++ )
|
||||
{
|
||||
sum += table[j].org;
|
||||
table[j].org = 0;
|
||||
}
|
||||
table[cur_idx].org = sum / (FT_Pos)j;
|
||||
|
||||
if ( i < *count - 1 )
|
||||
{
|
||||
cur_idx = i + 1;
|
||||
cur_val = table[cur_idx].org;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cur_idx = 1;
|
||||
|
||||
/* compress array to remove zero values */
|
||||
for ( i = 1; i < *count; i++ )
|
||||
{
|
||||
if ( table[i].org )
|
||||
table[cur_idx++] = table[i];
|
||||
}
|
||||
|
||||
*count = cur_idx;
|
||||
}
|
||||
|
||||
|
||||
/* END */
|
||||
7
vendor/FreeType2/src/autofit/afangles.h
vendored
Normal file
7
vendor/FreeType2/src/autofit/afangles.h
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
/*
|
||||
* afangles.h
|
||||
*
|
||||
* This is a dummy file, used to please the build system. It is never
|
||||
* included by the auto-fitter sources.
|
||||
*
|
||||
*/
|
||||
739
vendor/FreeType2/src/autofit/afblue.c
vendored
Normal file
739
vendor/FreeType2/src/autofit/afblue.c
vendored
Normal file
|
|
@ -0,0 +1,739 @@
|
|||
/* This file has been generated by the Perl script `afblue.pl', */
|
||||
/* using data from file `afblue.dat'. */
|
||||
|
||||
/***************************************************************************/
|
||||
/* */
|
||||
/* afblue.c */
|
||||
/* */
|
||||
/* Auto-fitter data for blue strings (body). */
|
||||
/* */
|
||||
/* Copyright 2013-2018 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 "aftypes.h"
|
||||
|
||||
|
||||
FT_LOCAL_ARRAY_DEF( char )
|
||||
af_blue_strings[] =
|
||||
{
|
||||
/* */
|
||||
'\xF0', '\x9E', '\xA4', '\x8C', ' ', '\xF0', '\x9E', '\xA4', '\x85', ' ', '\xF0', '\x9E', '\xA4', '\x88', ' ', '\xF0', '\x9E', '\xA4', '\x8F', ' ', '\xF0', '\x9E', '\xA4', '\x94', ' ', '\xF0', '\x9E', '\xA4', '\x9A', /* 𞤌 𞤅 𞤈 𞤏 𞤔 𞤚 */
|
||||
'\0',
|
||||
'\xF0', '\x9E', '\xA4', '\x82', ' ', '\xF0', '\x9E', '\xA4', '\x96', /* 𞤂 𞤖 */
|
||||
'\0',
|
||||
'\xF0', '\x9E', '\xA4', '\xAC', ' ', '\xF0', '\x9E', '\xA4', '\xAE', ' ', '\xF0', '\x9E', '\xA4', '\xBB', ' ', '\xF0', '\x9E', '\xA4', '\xBC', ' ', '\xF0', '\x9E', '\xA4', '\xBE', /* 𞤬 𞤮 𞤻 𞤼 𞤾 */
|
||||
'\0',
|
||||
'\xF0', '\x9E', '\xA4', '\xA4', ' ', '\xF0', '\x9E', '\xA4', '\xA8', ' ', '\xF0', '\x9E', '\xA4', '\xA9', ' ', '\xF0', '\x9E', '\xA4', '\xAD', ' ', '\xF0', '\x9E', '\xA4', '\xB4', ' ', '\xF0', '\x9E', '\xA4', '\xB8', ' ', '\xF0', '\x9E', '\xA4', '\xBA', ' ', '\xF0', '\x9E', '\xA5', '\x80', /* 𞤤 𞤨 𞤩 𞤭 𞤴 𞤸 𞤺 𞥀 */
|
||||
'\0',
|
||||
'\xD8', '\xA7', ' ', '\xD8', '\xA5', ' ', '\xD9', '\x84', ' ', '\xD9', '\x83', ' ', '\xD8', '\xB7', ' ', '\xD8', '\xB8', /* ا إ ل ك ط ظ */
|
||||
'\0',
|
||||
'\xD8', '\xAA', ' ', '\xD8', '\xAB', ' ', '\xD8', '\xB7', ' ', '\xD8', '\xB8', ' ', '\xD9', '\x83', /* ت ث ط ظ ك */
|
||||
'\0',
|
||||
'\xD9', '\x80', /* ـ */
|
||||
'\0',
|
||||
'\xD4', '\xB1', ' ', '\xD5', '\x84', ' ', '\xD5', '\x92', ' ', '\xD5', '\x8D', ' ', '\xD4', '\xB2', ' ', '\xD4', '\xB3', ' ', '\xD4', '\xB4', ' ', '\xD5', '\x95', /* Ա Մ Ւ Ս Բ Գ Դ Օ */
|
||||
'\0',
|
||||
'\xD5', '\x92', ' ', '\xD5', '\x88', ' ', '\xD4', '\xB4', ' ', '\xD5', '\x83', ' ', '\xD5', '\x87', ' ', '\xD5', '\x8D', ' ', '\xD5', '\x8F', ' ', '\xD5', '\x95', /* Ւ Ո Դ Ճ Շ Ս Տ Օ */
|
||||
'\0',
|
||||
'\xD5', '\xA5', ' ', '\xD5', '\xA7', ' ', '\xD5', '\xAB', ' ', '\xD5', '\xB4', ' ', '\xD5', '\xBE', ' ', '\xD6', '\x86', ' ', '\xD5', '\xB3', /* ե է ի մ վ ֆ ճ */
|
||||
'\0',
|
||||
'\xD5', '\xA1', ' ', '\xD5', '\xB5', ' ', '\xD6', '\x82', ' ', '\xD5', '\xBD', ' ', '\xD5', '\xA3', ' ', '\xD5', '\xB7', ' ', '\xD6', '\x80', ' ', '\xD6', '\x85', /* ա յ ւ ս գ շ ր օ */
|
||||
'\0',
|
||||
'\xD5', '\xB0', ' ', '\xD5', '\xB8', ' ', '\xD5', '\xB3', ' ', '\xD5', '\xA1', ' ', '\xD5', '\xA5', ' ', '\xD5', '\xAE', ' ', '\xD5', '\xBD', ' ', '\xD6', '\x85', /* հ ո ճ ա ե ծ ս օ */
|
||||
'\0',
|
||||
'\xD5', '\xA2', ' ', '\xD5', '\xA8', ' ', '\xD5', '\xAB', ' ', '\xD5', '\xAC', ' ', '\xD5', '\xB2', ' ', '\xD5', '\xBA', ' ', '\xD6', '\x83', ' ', '\xD6', '\x81', /* բ ը ի լ ղ պ փ ց */
|
||||
'\0',
|
||||
'\xF0', '\x90', '\xAC', '\x80', ' ', '\xF0', '\x90', '\xAC', '\x81', ' ', '\xF0', '\x90', '\xAC', '\x90', ' ', '\xF0', '\x90', '\xAC', '\x9B', /* 𐬀 𐬁 𐬐 𐬛 */
|
||||
'\0',
|
||||
'\xF0', '\x90', '\xAC', '\x80', ' ', '\xF0', '\x90', '\xAC', '\x81', /* 𐬀 𐬁 */
|
||||
'\0',
|
||||
'\xEA', '\x9A', '\xA7', ' ', '\xEA', '\x9A', '\xA8', ' ', '\xEA', '\x9B', '\x9B', ' ', '\xEA', '\x9B', '\x89', ' ', '\xEA', '\x9B', '\x81', ' ', '\xEA', '\x9B', '\x88', ' ', '\xEA', '\x9B', '\xAB', ' ', '\xEA', '\x9B', '\xAF', /* ꚧ ꚨ ꛛ ꛉ ꛁ ꛈ ꛫ ꛯ */
|
||||
'\0',
|
||||
'\xEA', '\x9A', '\xAD', ' ', '\xEA', '\x9A', '\xB3', ' ', '\xEA', '\x9A', '\xB6', ' ', '\xEA', '\x9B', '\xAC', ' ', '\xEA', '\x9A', '\xA2', ' ', '\xEA', '\x9A', '\xBD', ' ', '\xEA', '\x9B', '\xAF', ' ', '\xEA', '\x9B', '\xB2', /* ꚭ ꚳ ꚶ ꛬ ꚢ ꚽ ꛯ ꛲ */
|
||||
'\0',
|
||||
'\xE0', '\xA6', '\x85', ' ', '\xE0', '\xA6', '\xA1', ' ', '\xE0', '\xA6', '\xA4', ' ', '\xE0', '\xA6', '\xA8', ' ', '\xE0', '\xA6', '\xAC', ' ', '\xE0', '\xA6', '\xAD', ' ', '\xE0', '\xA6', '\xB2', ' ', '\xE0', '\xA6', '\x95', /* অ ড ত ন ব ভ ল ক */
|
||||
'\0',
|
||||
'\xE0', '\xA6', '\x87', ' ', '\xE0', '\xA6', '\x9F', ' ', '\xE0', '\xA6', '\xA0', ' ', '\xE0', '\xA6', '\xBF', ' ', '\xE0', '\xA7', '\x80', ' ', '\xE0', '\xA7', '\x88', ' ', '\xE0', '\xA7', '\x97', /* ই ট ঠ ি ী ৈ ৗ */
|
||||
'\0',
|
||||
'\xE0', '\xA6', '\x93', ' ', '\xE0', '\xA6', '\x8F', ' ', '\xE0', '\xA6', '\xA1', ' ', '\xE0', '\xA6', '\xA4', ' ', '\xE0', '\xA6', '\xA8', ' ', '\xE0', '\xA6', '\xAC', ' ', '\xE0', '\xA6', '\xB2', ' ', '\xE0', '\xA6', '\x95', /* ও এ ড ত ন ব ল ক */
|
||||
'\0',
|
||||
'\xE1', '\x9D', '\x90', ' ', '\xE1', '\x9D', '\x88', /* ᝐ ᝈ */
|
||||
'\0',
|
||||
'\xE1', '\x9D', '\x85', ' ', '\xE1', '\x9D', '\x8A', ' ', '\xE1', '\x9D', '\x8E', /* ᝅ ᝊ ᝎ */
|
||||
'\0',
|
||||
'\xE1', '\x9D', '\x82', ' ', '\xE1', '\x9D', '\x83', ' ', '\xE1', '\x9D', '\x89', ' ', '\xE1', '\x9D', '\x8C', /* ᝂ ᝃ ᝉ ᝌ */
|
||||
'\0',
|
||||
'\xE1', '\x9D', '\x80', ' ', '\xE1', '\x9D', '\x83', ' ', '\xE1', '\x9D', '\x86', ' ', '\xE1', '\x9D', '\x89', ' ', '\xE1', '\x9D', '\x8B', ' ', '\xE1', '\x9D', '\x8F', ' ', '\xE1', '\x9D', '\x91', /* ᝀ ᝃ ᝆ ᝉ ᝋ ᝏ ᝑ */
|
||||
'\0',
|
||||
'\xE1', '\x97', '\x9C', ' ', '\xE1', '\x96', '\xB4', ' ', '\xE1', '\x90', '\x81', ' ', '\xE1', '\x92', '\xA3', ' ', '\xE1', '\x91', '\xAB', ' ', '\xE1', '\x91', '\x8E', ' ', '\xE1', '\x94', '\x91', ' ', '\xE1', '\x97', '\xB0', /* ᗜ ᖴ ᐁ ᒣ ᑫ ᑎ ᔑ ᗰ */
|
||||
'\0',
|
||||
'\xE1', '\x97', '\xB6', ' ', '\xE1', '\x96', '\xB5', ' ', '\xE1', '\x92', '\xA7', ' ', '\xE1', '\x90', '\x83', ' ', '\xE1', '\x91', '\x8C', ' ', '\xE1', '\x92', '\x8D', ' ', '\xE1', '\x94', '\x91', ' ', '\xE1', '\x97', '\xA2', /* ᗶ ᖵ ᒧ ᐃ ᑌ ᒍ ᔑ ᗢ */
|
||||
'\0',
|
||||
'\xE1', '\x93', '\x93', ' ', '\xE1', '\x93', '\x95', ' ', '\xE1', '\x93', '\x80', ' ', '\xE1', '\x93', '\x82', ' ', '\xE1', '\x93', '\x84', ' ', '\xE1', '\x95', '\x84', ' ', '\xE1', '\x95', '\x86', ' ', '\xE1', '\x98', '\xA3', /* ᓓ ᓕ ᓀ ᓂ ᓄ ᕄ ᕆ ᘣ */
|
||||
'\0',
|
||||
'\xE1', '\x95', '\x83', ' ', '\xE1', '\x93', '\x82', ' ', '\xE1', '\x93', '\x80', ' ', '\xE1', '\x95', '\x82', ' ', '\xE1', '\x93', '\x97', ' ', '\xE1', '\x93', '\x9A', ' ', '\xE1', '\x95', '\x86', ' ', '\xE1', '\x98', '\xA3', /* ᕃ ᓂ ᓀ ᕂ ᓗ ᓚ ᕆ ᘣ */
|
||||
'\0',
|
||||
'\xE1', '\x90', '\xAA', ' ', '\xE1', '\x99', '\x86', ' ', '\xE1', '\xA3', '\x98', ' ', '\xE1', '\x90', '\xA2', ' ', '\xE1', '\x92', '\xBE', ' ', '\xE1', '\xA3', '\x97', ' ', '\xE1', '\x94', '\x86', /* ᐪ ᙆ ᣘ ᐢ ᒾ ᣗ ᔆ */
|
||||
'\0',
|
||||
'\xE1', '\x99', '\x86', ' ', '\xE1', '\x97', '\xAE', ' ', '\xE1', '\x92', '\xBB', ' ', '\xE1', '\x90', '\x9E', ' ', '\xE1', '\x94', '\x86', ' ', '\xE1', '\x92', '\xA1', ' ', '\xE1', '\x92', '\xA2', ' ', '\xE1', '\x93', '\x91', /* ᙆ ᗮ ᒻ ᐞ ᔆ ᒡ ᒢ ᓑ */
|
||||
'\0',
|
||||
'\xF0', '\x90', '\x8A', '\xA7', ' ', '\xF0', '\x90', '\x8A', '\xAB', ' ', '\xF0', '\x90', '\x8A', '\xAC', ' ', '\xF0', '\x90', '\x8A', '\xAD', ' ', '\xF0', '\x90', '\x8A', '\xB1', ' ', '\xF0', '\x90', '\x8A', '\xBA', ' ', '\xF0', '\x90', '\x8A', '\xBC', ' ', '\xF0', '\x90', '\x8A', '\xBF', /* 𐊧 𐊫 𐊬 𐊭 𐊱 𐊺 𐊼 𐊿 */
|
||||
'\0',
|
||||
'\xF0', '\x90', '\x8A', '\xA3', ' ', '\xF0', '\x90', '\x8A', '\xA7', ' ', '\xF0', '\x90', '\x8A', '\xB7', ' ', '\xF0', '\x90', '\x8B', '\x80', ' ', '\xF0', '\x90', '\x8A', '\xAB', ' ', '\xF0', '\x90', '\x8A', '\xB8', ' ', '\xF0', '\x90', '\x8B', '\x89', /* 𐊣 𐊧 𐊷 𐋀 𐊫 𐊸 𐋉 */
|
||||
'\0',
|
||||
'\xF0', '\x91', '\x84', '\x83', ' ', '\xF0', '\x91', '\x84', '\x85', ' ', '\xF0', '\x91', '\x84', '\x89', ' ', '\xF0', '\x91', '\x84', '\x99', ' ', '\xF0', '\x91', '\x84', '\x97', /* 𑄃 𑄅 𑄉 𑄙 𑄗 */
|
||||
'\0',
|
||||
'\xF0', '\x91', '\x84', '\x85', ' ', '\xF0', '\x91', '\x84', '\x9B', ' ', '\xF0', '\x91', '\x84', '\x9D', ' ', '\xF0', '\x91', '\x84', '\x97', ' ', '\xF0', '\x91', '\x84', '\x93', /* 𑄅 𑄛 𑄝 𑄗 𑄓 */
|
||||
'\0',
|
||||
'\xF0', '\x91', '\x84', '\x96', '\xF0', '\x91', '\x84', '\xB3', '\xF0', '\x91', '\x84', '\xA2', ' ', '\xF0', '\x91', '\x84', '\x98', '\xF0', '\x91', '\x84', '\xB3', '\xF0', '\x91', '\x84', '\xA2', ' ', '\xF0', '\x91', '\x84', '\x99', '\xF0', '\x91', '\x84', '\xB3', '\xF0', '\x91', '\x84', '\xA2', ' ', '\xF0', '\x91', '\x84', '\xA4', '\xF0', '\x91', '\x84', '\xB3', '\xF0', '\x91', '\x84', '\xA2', ' ', '\xF0', '\x91', '\x84', '\xA5', '\xF0', '\x91', '\x84', '\xB3', '\xF0', '\x91', '\x84', '\xA2', /* 𑄖𑄳𑄢 𑄘𑄳𑄢 𑄙𑄳𑄢 𑄤𑄳𑄢 𑄥𑄳𑄢 */
|
||||
'\0',
|
||||
'\xE1', '\x8F', '\x86', ' ', '\xE1', '\x8E', '\xBB', ' ', '\xE1', '\x8E', '\xAC', ' ', '\xE1', '\x8F', '\x83', ' ', '\xE1', '\x8E', '\xA4', ' ', '\xE1', '\x8F', '\xA3', ' ', '\xE1', '\x8E', '\xA6', ' ', '\xE1', '\x8F', '\x95', /* Ꮖ Ꮋ Ꭼ Ꮓ Ꭴ Ꮳ Ꭶ Ꮥ */
|
||||
'\0',
|
||||
'\xEA', '\xAE', '\x92', ' ', '\xEA', '\xAE', '\xA4', ' ', '\xEA', '\xAE', '\xB6', ' ', '\xEA', '\xAD', '\xB4', ' ', '\xEA', '\xAD', '\xBE', ' ', '\xEA', '\xAE', '\x97', ' ', '\xEA', '\xAE', '\x9D', ' ', '\xEA', '\xAE', '\xBF', /* ꮒ ꮤ ꮶ ꭴ ꭾ ꮗ ꮝ ꮿ */
|
||||
'\0',
|
||||
'\xEA', '\xAE', '\x96', ' ', '\xEA', '\xAD', '\xBC', ' ', '\xEA', '\xAE', '\x93', ' ', '\xEA', '\xAE', '\xA0', ' ', '\xEA', '\xAE', '\xB3', ' ', '\xEA', '\xAD', '\xB6', ' ', '\xEA', '\xAE', '\xA5', ' ', '\xEA', '\xAE', '\xBB', /* ꮖ ꭼ ꮓ ꮠ ꮳ ꭶ ꮥ ꮻ */
|
||||
'\0',
|
||||
'\xE1', '\x8F', '\xB8', ' ', '\xEA', '\xAE', '\x90', ' ', '\xEA', '\xAD', '\xB9', ' ', '\xEA', '\xAD', '\xBB', /* ᏸ ꮐ ꭹ ꭻ */
|
||||
'\0',
|
||||
'\xE2', '\xB2', '\x8C', ' ', '\xE2', '\xB2', '\x8E', ' ', '\xE2', '\xB2', '\xA0', ' ', '\xE2', '\xB3', '\x9E', ' ', '\xE2', '\xB2', '\x9E', ' ', '\xE2', '\xB2', '\x90', ' ', '\xE2', '\xB2', '\xA4', ' ', '\xE2', '\xB3', '\x8A', /* Ⲍ Ⲏ Ⲡ Ⳟ Ⲟ Ⲑ Ⲥ Ⳋ */
|
||||
'\0',
|
||||
'\xE2', '\xB3', '\x90', ' ', '\xE2', '\xB3', '\x98', ' ', '\xE2', '\xB3', '\x9E', ' ', '\xE2', '\xB2', '\x8E', ' ', '\xE2', '\xB2', '\x9E', ' ', '\xE2', '\xB2', '\x90', ' ', '\xE2', '\xB3', '\x9C', ' ', '\xE2', '\xB2', '\xB0', /* Ⳑ Ⳙ Ⳟ Ⲏ Ⲟ Ⲑ Ⳝ Ⲱ */
|
||||
'\0',
|
||||
'\xE2', '\xB2', '\x8D', ' ', '\xE2', '\xB2', '\x8F', ' ', '\xE2', '\xB2', '\xA1', ' ', '\xE2', '\xB3', '\x9F', ' ', '\xE2', '\xB2', '\x9F', ' ', '\xE2', '\xB2', '\x91', ' ', '\xE2', '\xB2', '\xA5', ' ', '\xE2', '\xB3', '\x8B', /* ⲍ ⲏ ⲡ ⳟ ⲟ ⲑ ⲥ ⳋ */
|
||||
'\0',
|
||||
'\xE2', '\xB3', '\x91', ' ', '\xE2', '\xB3', '\x99', ' ', '\xE2', '\xB3', '\x9F', ' ', '\xE2', '\xB2', '\x8F', ' ', '\xE2', '\xB2', '\x9F', ' ', '\xE2', '\xB2', '\x91', ' ', '\xE2', '\xB3', '\x9D', ' ', '\xE2', '\xB3', '\x92', /* ⳑ ⳙ ⳟ ⲏ ⲟ ⲑ ⳝ Ⳓ */
|
||||
'\0',
|
||||
'\xF0', '\x90', '\xA0', '\x8D', ' ', '\xF0', '\x90', '\xA0', '\x99', ' ', '\xF0', '\x90', '\xA0', '\xB3', ' ', '\xF0', '\x90', '\xA0', '\xB1', ' ', '\xF0', '\x90', '\xA0', '\x85', ' ', '\xF0', '\x90', '\xA0', '\x93', ' ', '\xF0', '\x90', '\xA0', '\xA3', ' ', '\xF0', '\x90', '\xA0', '\xA6', /* 𐠍 𐠙 𐠳 𐠱 𐠅 𐠓 𐠣 𐠦 */
|
||||
'\0',
|
||||
'\xF0', '\x90', '\xA0', '\x83', ' ', '\xF0', '\x90', '\xA0', '\x8A', ' ', '\xF0', '\x90', '\xA0', '\x9B', ' ', '\xF0', '\x90', '\xA0', '\xA3', ' ', '\xF0', '\x90', '\xA0', '\xB3', ' ', '\xF0', '\x90', '\xA0', '\xB5', ' ', '\xF0', '\x90', '\xA0', '\x90', /* 𐠃 𐠊 𐠛 𐠣 𐠳 𐠵 𐠐 */
|
||||
'\0',
|
||||
'\xF0', '\x90', '\xA0', '\x88', ' ', '\xF0', '\x90', '\xA0', '\x8F', ' ', '\xF0', '\x90', '\xA0', '\x96', /* 𐠈 𐠏 𐠖 */
|
||||
'\0',
|
||||
'\xD0', '\x91', ' ', '\xD0', '\x92', ' ', '\xD0', '\x95', ' ', '\xD0', '\x9F', ' ', '\xD0', '\x97', ' ', '\xD0', '\x9E', ' ', '\xD0', '\xA1', ' ', '\xD0', '\xAD', /* Б В Е П З О С Э */
|
||||
'\0',
|
||||
'\xD0', '\x91', ' ', '\xD0', '\x92', ' ', '\xD0', '\x95', ' ', '\xD0', '\xA8', ' ', '\xD0', '\x97', ' ', '\xD0', '\x9E', ' ', '\xD0', '\xA1', ' ', '\xD0', '\xAD', /* Б В Е Ш З О С Э */
|
||||
'\0',
|
||||
'\xD1', '\x85', ' ', '\xD0', '\xBF', ' ', '\xD0', '\xBD', ' ', '\xD1', '\x88', ' ', '\xD0', '\xB5', ' ', '\xD0', '\xB7', ' ', '\xD0', '\xBE', ' ', '\xD1', '\x81', /* х п н ш е з о с */
|
||||
'\0',
|
||||
'\xD1', '\x80', ' ', '\xD1', '\x83', ' ', '\xD1', '\x84', /* р у ф */
|
||||
'\0',
|
||||
'\xF0', '\x90', '\x90', '\x82', ' ', '\xF0', '\x90', '\x90', '\x84', ' ', '\xF0', '\x90', '\x90', '\x8B', ' ', '\xF0', '\x90', '\x90', '\x97', ' ', '\xF0', '\x90', '\x90', '\x91', /* 𐐂 𐐄 𐐋 𐐗 𐐑 */
|
||||
'\0',
|
||||
'\xF0', '\x90', '\x90', '\x80', ' ', '\xF0', '\x90', '\x90', '\x82', ' ', '\xF0', '\x90', '\x90', '\x84', ' ', '\xF0', '\x90', '\x90', '\x97', ' ', '\xF0', '\x90', '\x90', '\x9B', /* 𐐀 𐐂 𐐄 𐐗 𐐛 */
|
||||
'\0',
|
||||
'\xF0', '\x90', '\x90', '\xAA', ' ', '\xF0', '\x90', '\x90', '\xAC', ' ', '\xF0', '\x90', '\x90', '\xB3', ' ', '\xF0', '\x90', '\x90', '\xBF', ' ', '\xF0', '\x90', '\x90', '\xB9', /* 𐐪 𐐬 𐐳 𐐿 𐐹 */
|
||||
'\0',
|
||||
'\xF0', '\x90', '\x90', '\xA8', ' ', '\xF0', '\x90', '\x90', '\xAA', ' ', '\xF0', '\x90', '\x90', '\xAC', ' ', '\xF0', '\x90', '\x90', '\xBF', ' ', '\xF0', '\x90', '\x91', '\x83', /* 𐐨 𐐪 𐐬 𐐿 𐑃 */
|
||||
'\0',
|
||||
'\xE0', '\xA4', '\x95', ' ', '\xE0', '\xA4', '\xAE', ' ', '\xE0', '\xA4', '\x85', ' ', '\xE0', '\xA4', '\x86', ' ', '\xE0', '\xA4', '\xA5', ' ', '\xE0', '\xA4', '\xA7', ' ', '\xE0', '\xA4', '\xAD', ' ', '\xE0', '\xA4', '\xB6', /* क म अ आ थ ध भ श */
|
||||
'\0',
|
||||
'\xE0', '\xA4', '\x88', ' ', '\xE0', '\xA4', '\x90', ' ', '\xE0', '\xA4', '\x93', ' ', '\xE0', '\xA4', '\x94', ' ', '\xE0', '\xA4', '\xBF', ' ', '\xE0', '\xA5', '\x80', ' ', '\xE0', '\xA5', '\x8B', ' ', '\xE0', '\xA5', '\x8C', /* ई ऐ ओ औ ि ी ो ौ */
|
||||
'\0',
|
||||
'\xE0', '\xA4', '\x95', ' ', '\xE0', '\xA4', '\xAE', ' ', '\xE0', '\xA4', '\x85', ' ', '\xE0', '\xA4', '\x86', ' ', '\xE0', '\xA4', '\xA5', ' ', '\xE0', '\xA4', '\xA7', ' ', '\xE0', '\xA4', '\xAD', ' ', '\xE0', '\xA4', '\xB6', /* क म अ आ थ ध भ श */
|
||||
'\0',
|
||||
'\xE0', '\xA5', '\x81', ' ', '\xE0', '\xA5', '\x83', /* ु ृ */
|
||||
'\0',
|
||||
'\xE1', '\x88', '\x80', ' ', '\xE1', '\x88', '\x83', ' ', '\xE1', '\x8B', '\x98', ' ', '\xE1', '\x8D', '\x90', ' ', '\xE1', '\x88', '\x9B', ' ', '\xE1', '\x89', '\xA0', ' ', '\xE1', '\x8B', '\x8B', ' ', '\xE1', '\x8B', '\x90', /* ሀ ሃ ዘ ፐ ማ በ ዋ ዐ */
|
||||
'\0',
|
||||
'\xE1', '\x88', '\x88', ' ', '\xE1', '\x88', '\x90', ' ', '\xE1', '\x89', '\xA0', ' ', '\xE1', '\x8B', '\x98', ' ', '\xE1', '\x88', '\x80', ' ', '\xE1', '\x88', '\xAA', ' ', '\xE1', '\x8B', '\x90', ' ', '\xE1', '\x8C', '\xA8', /* ለ ሐ በ ዘ ሀ ሪ ዐ ጨ */
|
||||
'\0',
|
||||
'\xE1', '\x83', '\x92', ' ', '\xE1', '\x83', '\x93', ' ', '\xE1', '\x83', '\x94', ' ', '\xE1', '\x83', '\x95', ' ', '\xE1', '\x83', '\x97', ' ', '\xE1', '\x83', '\x98', ' ', '\xE1', '\x83', '\x9D', ' ', '\xE1', '\x83', '\xA6', /* გ დ ე ვ თ ი ო ღ */
|
||||
'\0',
|
||||
'\xE1', '\x83', '\x90', ' ', '\xE1', '\x83', '\x96', ' ', '\xE1', '\x83', '\x9B', ' ', '\xE1', '\x83', '\xA1', ' ', '\xE1', '\x83', '\xA8', ' ', '\xE1', '\x83', '\xAB', ' ', '\xE1', '\x83', '\xAE', ' ', '\xE1', '\x83', '\x9E', /* ა ზ მ ს შ ძ ხ პ */
|
||||
'\0',
|
||||
'\xE1', '\x83', '\xA1', ' ', '\xE1', '\x83', '\xAE', ' ', '\xE1', '\x83', '\xA5', ' ', '\xE1', '\x83', '\x96', ' ', '\xE1', '\x83', '\x9B', ' ', '\xE1', '\x83', '\xA8', ' ', '\xE1', '\x83', '\xA9', ' ', '\xE1', '\x83', '\xAC', /* ს ხ ქ ზ მ შ ჩ წ */
|
||||
'\0',
|
||||
'\xE1', '\x83', '\x94', ' ', '\xE1', '\x83', '\x95', ' ', '\xE1', '\x83', '\x9F', ' ', '\xE1', '\x83', '\xA2', ' ', '\xE1', '\x83', '\xA3', ' ', '\xE1', '\x83', '\xA4', ' ', '\xE1', '\x83', '\xA5', ' ', '\xE1', '\x83', '\xA7', /* ე ვ ჟ ტ უ ფ ქ ყ */
|
||||
'\0',
|
||||
'\xE1', '\x82', '\xB1', ' ', '\xE1', '\x82', '\xA7', ' ', '\xE1', '\x82', '\xB9', ' ', '\xE1', '\x82', '\xBC', ' ', '\xE1', '\x82', '\xA4', ' ', '\xE1', '\x82', '\xA5', ' ', '\xE1', '\x82', '\xB3', ' ', '\xE1', '\x82', '\xBA', /* Ⴑ Ⴇ Ⴙ Ⴜ Ⴄ Ⴅ Ⴓ Ⴚ */
|
||||
'\0',
|
||||
'\xE1', '\x82', '\xA4', ' ', '\xE1', '\x82', '\xA5', ' ', '\xE1', '\x82', '\xA7', ' ', '\xE1', '\x82', '\xA8', ' ', '\xE1', '\x82', '\xA6', ' ', '\xE1', '\x82', '\xB1', ' ', '\xE1', '\x82', '\xAA', ' ', '\xE1', '\x82', '\xAB', /* Ⴄ Ⴅ Ⴇ Ⴈ Ⴆ Ⴑ Ⴊ Ⴋ */
|
||||
'\0',
|
||||
'\xE2', '\xB4', '\x81', ' ', '\xE2', '\xB4', '\x97', ' ', '\xE2', '\xB4', '\x82', ' ', '\xE2', '\xB4', '\x84', ' ', '\xE2', '\xB4', '\x85', ' ', '\xE2', '\xB4', '\x87', ' ', '\xE2', '\xB4', '\x94', ' ', '\xE2', '\xB4', '\x96', /* ⴁ ⴗ ⴂ ⴄ ⴅ ⴇ ⴔ ⴖ */
|
||||
'\0',
|
||||
'\xE2', '\xB4', '\x88', ' ', '\xE2', '\xB4', '\x8C', ' ', '\xE2', '\xB4', '\x96', ' ', '\xE2', '\xB4', '\x8E', ' ', '\xE2', '\xB4', '\x83', ' ', '\xE2', '\xB4', '\x86', ' ', '\xE2', '\xB4', '\x8B', ' ', '\xE2', '\xB4', '\xA2', /* ⴈ ⴌ ⴖ ⴎ ⴃ ⴆ ⴋ ⴢ */
|
||||
'\0',
|
||||
'\xE2', '\xB4', '\x90', ' ', '\xE2', '\xB4', '\x91', ' ', '\xE2', '\xB4', '\x93', ' ', '\xE2', '\xB4', '\x95', ' ', '\xE2', '\xB4', '\x99', ' ', '\xE2', '\xB4', '\x9B', ' ', '\xE2', '\xB4', '\xA1', ' ', '\xE2', '\xB4', '\xA3', /* ⴐ ⴑ ⴓ ⴕ ⴙ ⴛ ⴡ ⴣ */
|
||||
'\0',
|
||||
'\xE2', '\xB4', '\x84', ' ', '\xE2', '\xB4', '\x85', ' ', '\xE2', '\xB4', '\x94', ' ', '\xE2', '\xB4', '\x95', ' ', '\xE2', '\xB4', '\x81', ' ', '\xE2', '\xB4', '\x82', ' ', '\xE2', '\xB4', '\x98', ' ', '\xE2', '\xB4', '\x9D', /* ⴄ ⴅ ⴔ ⴕ ⴁ ⴂ ⴘ ⴝ */
|
||||
'\0',
|
||||
'\xE1', '\xB2', '\x9C', ' ', '\xE1', '\xB2', '\x9F', ' ', '\xE1', '\xB2', '\xB3', ' ', '\xE1', '\xB2', '\xB8', ' ', '\xE1', '\xB2', '\x92', ' ', '\xE1', '\xB2', '\x94', ' ', '\xE1', '\xB2', '\x9D', ' ', '\xE1', '\xB2', '\xB4', /* Ნ Ჟ Ჳ Ჸ Გ Ე Ო Ჴ */
|
||||
'\0',
|
||||
'\xE1', '\xB2', '\x98', ' ', '\xE1', '\xB2', '\xB2', ' ', '\xE1', '\xB2', '\x9D', ' ', '\xE1', '\xB2', '\xA9', ' ', '\xE1', '\xB2', '\x9B', ' ', '\xE1', '\xB2', '\xA8', ' ', '\xE1', '\xB2', '\xAF', ' ', '\xE1', '\xB2', '\xBD', /* Ი Ჲ Ო Ჩ Მ Შ Ჯ Ჽ */
|
||||
'\0',
|
||||
'\xE2', '\xB0', '\x85', ' ', '\xE2', '\xB0', '\x94', ' ', '\xE2', '\xB0', '\xAA', ' ', '\xE2', '\xB0', '\x84', ' ', '\xE2', '\xB0', '\x82', ' ', '\xE2', '\xB0', '\x8A', ' ', '\xE2', '\xB0', '\xAB', ' ', '\xE2', '\xB0', '\x8B', /* Ⰵ Ⱄ Ⱚ Ⰴ Ⰲ Ⰺ Ⱛ Ⰻ */
|
||||
'\0',
|
||||
'\xE2', '\xB0', '\x85', ' ', '\xE2', '\xB0', '\x84', ' ', '\xE2', '\xB0', '\x82', ' ', '\xE2', '\xB0', '\xAA', ' ', '\xE2', '\xB0', '\x9E', ' ', '\xE2', '\xB0', '\xA1', ' ', '\xE2', '\xB0', '\x8A', ' ', '\xE2', '\xB0', '\x94', /* Ⰵ Ⰴ Ⰲ Ⱚ Ⱎ Ⱑ Ⰺ Ⱄ */
|
||||
'\0',
|
||||
'\xE2', '\xB0', '\xB5', ' ', '\xE2', '\xB1', '\x84', ' ', '\xE2', '\xB1', '\x9A', ' ', '\xE2', '\xB0', '\xB4', ' ', '\xE2', '\xB0', '\xB2', ' ', '\xE2', '\xB0', '\xBA', ' ', '\xE2', '\xB1', '\x9B', ' ', '\xE2', '\xB0', '\xBB', /* ⰵ ⱄ ⱚ ⰴ ⰲ ⰺ ⱛ ⰻ */
|
||||
'\0',
|
||||
'\xE2', '\xB0', '\xB5', ' ', '\xE2', '\xB0', '\xB4', ' ', '\xE2', '\xB0', '\xB2', ' ', '\xE2', '\xB1', '\x9A', ' ', '\xE2', '\xB1', '\x8E', ' ', '\xE2', '\xB1', '\x91', ' ', '\xE2', '\xB0', '\xBA', ' ', '\xE2', '\xB1', '\x84', /* ⰵ ⰴ ⰲ ⱚ ⱎ ⱑ ⰺ ⱄ */
|
||||
'\0',
|
||||
'\xF0', '\x90', '\x8C', '\xB2', ' ', '\xF0', '\x90', '\x8C', '\xB6', ' ', '\xF0', '\x90', '\x8D', '\x80', ' ', '\xF0', '\x90', '\x8D', '\x84', ' ', '\xF0', '\x90', '\x8C', '\xB4', ' ', '\xF0', '\x90', '\x8D', '\x83', ' ', '\xF0', '\x90', '\x8D', '\x88', ' ', '\xF0', '\x90', '\x8C', '\xBE', /* 𐌲 𐌶 𐍀 𐍄 𐌴 𐍃 𐍈 𐌾 */
|
||||
'\0',
|
||||
'\xF0', '\x90', '\x8C', '\xB6', ' ', '\xF0', '\x90', '\x8C', '\xB4', ' ', '\xF0', '\x90', '\x8D', '\x83', ' ', '\xF0', '\x90', '\x8D', '\x88', /* 𐌶 𐌴 𐍃 𐍈 */
|
||||
'\0',
|
||||
'\xCE', '\x93', ' ', '\xCE', '\x92', ' ', '\xCE', '\x95', ' ', '\xCE', '\x96', ' ', '\xCE', '\x98', ' ', '\xCE', '\x9F', ' ', '\xCE', '\xA9', /* Γ Β Ε Ζ Θ Ο Ω */
|
||||
'\0',
|
||||
'\xCE', '\x92', ' ', '\xCE', '\x94', ' ', '\xCE', '\x96', ' ', '\xCE', '\x9E', ' ', '\xCE', '\x98', ' ', '\xCE', '\x9F', /* Β Δ Ζ Ξ Θ Ο */
|
||||
'\0',
|
||||
'\xCE', '\xB2', ' ', '\xCE', '\xB8', ' ', '\xCE', '\xB4', ' ', '\xCE', '\xB6', ' ', '\xCE', '\xBB', ' ', '\xCE', '\xBE', /* β θ δ ζ λ ξ */
|
||||
'\0',
|
||||
'\xCE', '\xB1', ' ', '\xCE', '\xB5', ' ', '\xCE', '\xB9', ' ', '\xCE', '\xBF', ' ', '\xCF', '\x80', ' ', '\xCF', '\x83', ' ', '\xCF', '\x84', ' ', '\xCF', '\x89', /* α ε ι ο π σ τ ω */
|
||||
'\0',
|
||||
'\xCE', '\xB2', ' ', '\xCE', '\xB3', ' ', '\xCE', '\xB7', ' ', '\xCE', '\xBC', ' ', '\xCF', '\x81', ' ', '\xCF', '\x86', ' ', '\xCF', '\x87', ' ', '\xCF', '\x88', /* β γ η μ ρ φ χ ψ */
|
||||
'\0',
|
||||
'\xE0', '\xAA', '\xA4', ' ', '\xE0', '\xAA', '\xA8', ' ', '\xE0', '\xAA', '\x8B', ' ', '\xE0', '\xAA', '\x8C', ' ', '\xE0', '\xAA', '\x9B', ' ', '\xE0', '\xAA', '\x9F', ' ', '\xE0', '\xAA', '\xB0', ' ', '\xE0', '\xAB', '\xA6', /* ત ન ઋ ઌ છ ટ ર ૦ */
|
||||
'\0',
|
||||
'\xE0', '\xAA', '\x96', ' ', '\xE0', '\xAA', '\x97', ' ', '\xE0', '\xAA', '\x98', ' ', '\xE0', '\xAA', '\x9E', ' ', '\xE0', '\xAA', '\x87', ' ', '\xE0', '\xAA', '\x88', ' ', '\xE0', '\xAA', '\xA0', ' ', '\xE0', '\xAA', '\x9C', /* ખ ગ ઘ ઞ ઇ ઈ ઠ જ */
|
||||
'\0',
|
||||
'\xE0', '\xAA', '\x88', ' ', '\xE0', '\xAA', '\x8A', ' ', '\xE0', '\xAA', '\xBF', ' ', '\xE0', '\xAB', '\x80', ' ', '\xE0', '\xAA', '\xB2', '\xE0', '\xAB', '\x80', ' ', '\xE0', '\xAA', '\xB6', '\xE0', '\xAB', '\x8D', '\xE0', '\xAA', '\x9A', '\xE0', '\xAA', '\xBF', ' ', '\xE0', '\xAA', '\x9C', '\xE0', '\xAA', '\xBF', ' ', '\xE0', '\xAA', '\xB8', '\xE0', '\xAB', '\x80', /* ઈ ઊ િ ી લી શ્ચિ જિ સી */
|
||||
'\0',
|
||||
'\xE0', '\xAB', '\x81', ' ', '\xE0', '\xAB', '\x83', ' ', '\xE0', '\xAB', '\x84', ' ', '\xE0', '\xAA', '\x96', '\xE0', '\xAB', '\x81', ' ', '\xE0', '\xAA', '\x9B', '\xE0', '\xAB', '\x83', ' ', '\xE0', '\xAA', '\x9B', '\xE0', '\xAB', '\x84', /* ુ ૃ ૄ ખુ છૃ છૄ */
|
||||
'\0',
|
||||
'\xE0', '\xAB', '\xA6', ' ', '\xE0', '\xAB', '\xA7', ' ', '\xE0', '\xAB', '\xA8', ' ', '\xE0', '\xAB', '\xA9', ' ', '\xE0', '\xAB', '\xAD', /* ૦ ૧ ૨ ૩ ૭ */
|
||||
'\0',
|
||||
'\xE0', '\xA8', '\x95', ' ', '\xE0', '\xA8', '\x97', ' ', '\xE0', '\xA8', '\x99', ' ', '\xE0', '\xA8', '\x9A', ' ', '\xE0', '\xA8', '\x9C', ' ', '\xE0', '\xA8', '\xA4', ' ', '\xE0', '\xA8', '\xA7', ' ', '\xE0', '\xA8', '\xB8', /* ਕ ਗ ਙ ਚ ਜ ਤ ਧ ਸ */
|
||||
'\0',
|
||||
'\xE0', '\xA8', '\x95', ' ', '\xE0', '\xA8', '\x97', ' ', '\xE0', '\xA8', '\x99', ' ', '\xE0', '\xA8', '\x9A', ' ', '\xE0', '\xA8', '\x9C', ' ', '\xE0', '\xA8', '\xA4', ' ', '\xE0', '\xA8', '\xA7', ' ', '\xE0', '\xA8', '\xB8', /* ਕ ਗ ਙ ਚ ਜ ਤ ਧ ਸ */
|
||||
'\0',
|
||||
'\xE0', '\xA8', '\x87', ' ', '\xE0', '\xA8', '\x88', ' ', '\xE0', '\xA8', '\x89', ' ', '\xE0', '\xA8', '\x8F', ' ', '\xE0', '\xA8', '\x93', ' ', '\xE0', '\xA9', '\xB3', ' ', '\xE0', '\xA8', '\xBF', ' ', '\xE0', '\xA9', '\x80', /* ਇ ਈ ਉ ਏ ਓ ੳ ਿ ੀ */
|
||||
'\0',
|
||||
'\xE0', '\xA8', '\x85', ' ', '\xE0', '\xA8', '\x8F', ' ', '\xE0', '\xA8', '\x93', ' ', '\xE0', '\xA8', '\x97', ' ', '\xE0', '\xA8', '\x9C', ' ', '\xE0', '\xA8', '\xA0', ' ', '\xE0', '\xA8', '\xB0', ' ', '\xE0', '\xA8', '\xB8', /* ਅ ਏ ਓ ਗ ਜ ਠ ਰ ਸ */
|
||||
'\0',
|
||||
'\xE0', '\xA9', '\xA6', ' ', '\xE0', '\xA9', '\xA7', ' ', '\xE0', '\xA9', '\xA8', ' ', '\xE0', '\xA9', '\xA9', ' ', '\xE0', '\xA9', '\xAD', /* ੦ ੧ ੨ ੩ ੭ */
|
||||
'\0',
|
||||
'\xD7', '\x91', ' ', '\xD7', '\x93', ' ', '\xD7', '\x94', ' ', '\xD7', '\x97', ' ', '\xD7', '\x9A', ' ', '\xD7', '\x9B', ' ', '\xD7', '\x9D', ' ', '\xD7', '\xA1', /* ב ד ה ח ך כ ם ס */
|
||||
'\0',
|
||||
'\xD7', '\x91', ' ', '\xD7', '\x98', ' ', '\xD7', '\x9B', ' ', '\xD7', '\x9D', ' ', '\xD7', '\xA1', ' ', '\xD7', '\xA6', /* ב ט כ ם ס צ */
|
||||
'\0',
|
||||
'\xD7', '\xA7', ' ', '\xD7', '\x9A', ' ', '\xD7', '\x9F', ' ', '\xD7', '\xA3', ' ', '\xD7', '\xA5', /* ק ך ן ף ץ */
|
||||
'\0',
|
||||
'\xE0', '\xB2', '\x87', ' ', '\xE0', '\xB2', '\x8A', ' ', '\xE0', '\xB2', '\x90', ' ', '\xE0', '\xB2', '\xA3', ' ', '\xE0', '\xB2', '\xB8', '\xE0', '\xB2', '\xBE', ' ', '\xE0', '\xB2', '\xA8', '\xE0', '\xB2', '\xBE', ' ', '\xE0', '\xB2', '\xA6', '\xE0', '\xB2', '\xBE', ' ', '\xE0', '\xB2', '\xB0', '\xE0', '\xB2', '\xBE', /* ಇ ಊ ಐ ಣ ಸಾ ನಾ ದಾ ರಾ */
|
||||
'\0',
|
||||
'\xE0', '\xB2', '\x85', ' ', '\xE0', '\xB2', '\x89', ' ', '\xE0', '\xB2', '\x8E', ' ', '\xE0', '\xB2', '\xB2', ' ', '\xE0', '\xB3', '\xA6', ' ', '\xE0', '\xB3', '\xA8', ' ', '\xE0', '\xB3', '\xAC', ' ', '\xE0', '\xB3', '\xAD', /* ಅ ಉ ಎ ಲ ೦ ೨ ೬ ೭ */
|
||||
'\0',
|
||||
'\xEA', '\xA4', '\x85', ' ', '\xEA', '\xA4', '\x8F', ' ', '\xEA', '\xA4', '\x81', ' ', '\xEA', '\xA4', '\x8B', ' ', '\xEA', '\xA4', '\x80', ' ', '\xEA', '\xA4', '\x8D', /* ꤅ ꤏ ꤁ ꤋ ꤀ ꤍ */
|
||||
'\0',
|
||||
'\xEA', '\xA4', '\x88', ' ', '\xEA', '\xA4', '\x98', ' ', '\xEA', '\xA4', '\x80', ' ', '\xEA', '\xA4', '\x8D', ' ', '\xEA', '\xA4', '\xA2', /* ꤈ ꤘ ꤀ ꤍ ꤢ */
|
||||
'\0',
|
||||
'\xEA', '\xA4', '\x96', ' ', '\xEA', '\xA4', '\xA1', /* ꤖ ꤡ */
|
||||
'\0',
|
||||
'\xEA', '\xA4', '\x91', ' ', '\xEA', '\xA4', '\x9C', ' ', '\xEA', '\xA4', '\x9E', /* ꤑ ꤜ ꤞ */
|
||||
'\0',
|
||||
'\xEA', '\xA4', '\x91', '\xEA', '\xA4', '\xAC', ' ', '\xEA', '\xA4', '\x9C', '\xEA', '\xA4', '\xAD', ' ', '\xEA', '\xA4', '\x94', '\xEA', '\xA4', '\xAC', /* ꤑ꤬ ꤜ꤭ ꤔ꤬ */
|
||||
'\0',
|
||||
'\xE1', '\x9E', '\x81', ' ', '\xE1', '\x9E', '\x91', ' ', '\xE1', '\x9E', '\x93', ' ', '\xE1', '\x9E', '\xA7', ' ', '\xE1', '\x9E', '\xA9', ' ', '\xE1', '\x9E', '\xB6', /* ខ ទ ន ឧ ឩ ា */
|
||||
'\0',
|
||||
'\xE1', '\x9E', '\x80', '\xE1', '\x9F', '\x92', '\xE1', '\x9E', '\x80', ' ', '\xE1', '\x9E', '\x80', '\xE1', '\x9F', '\x92', '\xE1', '\x9E', '\x81', ' ', '\xE1', '\x9E', '\x80', '\xE1', '\x9F', '\x92', '\xE1', '\x9E', '\x82', ' ', '\xE1', '\x9E', '\x80', '\xE1', '\x9F', '\x92', '\xE1', '\x9E', '\x90', /* ក្ក ក្ខ ក្គ ក្ថ */
|
||||
'\0',
|
||||
'\xE1', '\x9E', '\x81', ' ', '\xE1', '\x9E', '\x83', ' ', '\xE1', '\x9E', '\x85', ' ', '\xE1', '\x9E', '\x8B', ' ', '\xE1', '\x9E', '\x94', ' ', '\xE1', '\x9E', '\x98', ' ', '\xE1', '\x9E', '\x99', ' ', '\xE1', '\x9E', '\xB2', /* ខ ឃ ច ឋ ប ម យ ឲ */
|
||||
'\0',
|
||||
'\xE1', '\x9E', '\x8F', '\xE1', '\x9F', '\x92', '\xE1', '\x9E', '\x9A', ' ', '\xE1', '\x9E', '\x9A', '\xE1', '\x9F', '\x80', ' ', '\xE1', '\x9E', '\xB2', '\xE1', '\x9F', '\x92', '\xE1', '\x9E', '\x99', ' ', '\xE1', '\x9E', '\xA2', '\xE1', '\x9E', '\xBF', /* ត្រ រៀ ឲ្យ អឿ */
|
||||
'\0',
|
||||
'\xE1', '\x9E', '\x93', '\xE1', '\x9F', '\x92', '\xE1', '\x9E', '\x8F', '\xE1', '\x9F', '\x92', '\xE1', '\x9E', '\x9A', '\xE1', '\x9F', '\x83', ' ', '\xE1', '\x9E', '\x84', '\xE1', '\x9F', '\x92', '\xE1', '\x9E', '\x81', '\xE1', '\x9F', '\x92', '\xE1', '\x9E', '\x99', ' ', '\xE1', '\x9E', '\x80', '\xE1', '\x9F', '\x92', '\xE1', '\x9E', '\x94', '\xE1', '\x9F', '\x80', ' ', '\xE1', '\x9E', '\x85', '\xE1', '\x9F', '\x92', '\xE1', '\x9E', '\x9A', '\xE1', '\x9F', '\x80', ' ', '\xE1', '\x9E', '\x93', '\xE1', '\x9F', '\x92', '\xE1', '\x9E', '\x8F', '\xE1', '\x9E', '\xBF', ' ', '\xE1', '\x9E', '\x9B', '\xE1', '\x9F', '\x92', '\xE1', '\x9E', '\x94', '\xE1', '\x9E', '\xBF', /* ន្ត្រៃ ង្ខ្យ ក្បៀ ច្រៀ ន្តឿ ល្បឿ */
|
||||
'\0',
|
||||
'\xE1', '\xA7', '\xA0', ' ', '\xE1', '\xA7', '\xA1', /* ᧠ ᧡ */
|
||||
'\0',
|
||||
'\xE1', '\xA7', '\xB6', ' ', '\xE1', '\xA7', '\xB9', /* ᧶ ᧹ */
|
||||
'\0',
|
||||
'\xE0', '\xBA', '\xB2', ' ', '\xE0', '\xBA', '\x94', ' ', '\xE0', '\xBA', '\xAD', ' ', '\xE0', '\xBA', '\xA1', ' ', '\xE0', '\xBA', '\xA5', ' ', '\xE0', '\xBA', '\xA7', ' ', '\xE0', '\xBA', '\xA3', ' ', '\xE0', '\xBA', '\x87', /* າ ດ ອ ມ ລ ວ ຣ ງ */
|
||||
'\0',
|
||||
'\xE0', '\xBA', '\xB2', ' ', '\xE0', '\xBA', '\xAD', ' ', '\xE0', '\xBA', '\x9A', ' ', '\xE0', '\xBA', '\x8D', ' ', '\xE0', '\xBA', '\xA3', ' ', '\xE0', '\xBA', '\xAE', ' ', '\xE0', '\xBA', '\xA7', ' ', '\xE0', '\xBA', '\xA2', /* າ ອ ບ ຍ ຣ ຮ ວ ຢ */
|
||||
'\0',
|
||||
'\xE0', '\xBA', '\x9B', ' ', '\xE0', '\xBA', '\xA2', ' ', '\xE0', '\xBA', '\x9F', ' ', '\xE0', '\xBA', '\x9D', /* ປ ຢ ຟ ຝ */
|
||||
'\0',
|
||||
'\xE0', '\xBB', '\x82', ' ', '\xE0', '\xBB', '\x84', ' ', '\xE0', '\xBB', '\x83', /* ໂ ໄ ໃ */
|
||||
'\0',
|
||||
'\xE0', '\xBA', '\x87', ' ', '\xE0', '\xBA', '\x8A', ' ', '\xE0', '\xBA', '\x96', ' ', '\xE0', '\xBA', '\xBD', ' ', '\xE0', '\xBB', '\x86', ' ', '\xE0', '\xBA', '\xAF', /* ງ ຊ ຖ ຽ ໆ ຯ */
|
||||
'\0',
|
||||
'T', ' ', 'H', ' ', 'E', ' ', 'Z', ' ', 'O', ' ', 'C', ' ', 'Q', ' ', 'S', /* T H E Z O C Q S */
|
||||
'\0',
|
||||
'H', ' ', 'E', ' ', 'Z', ' ', 'L', ' ', 'O', ' ', 'C', ' ', 'U', ' ', 'S', /* H E Z L O C U S */
|
||||
'\0',
|
||||
'f', ' ', 'i', ' ', 'j', ' ', 'k', ' ', 'd', ' ', 'b', ' ', 'h', /* f i j k d b h */
|
||||
'\0',
|
||||
'u', ' ', 'v', ' ', 'x', ' ', 'z', ' ', 'o', ' ', 'e', ' ', 's', ' ', 'c', /* u v x z o e s c */
|
||||
'\0',
|
||||
'n', ' ', 'r', ' ', 'x', ' ', 'z', ' ', 'o', ' ', 'e', ' ', 's', ' ', 'c', /* n r x z o e s c */
|
||||
'\0',
|
||||
'p', ' ', 'q', ' ', 'g', ' ', 'j', ' ', 'y', /* p q g j y */
|
||||
'\0',
|
||||
'\xE2', '\x82', '\x80', ' ', '\xE2', '\x82', '\x83', ' ', '\xE2', '\x82', '\x85', ' ', '\xE2', '\x82', '\x87', ' ', '\xE2', '\x82', '\x88', /* ₀ ₃ ₅ ₇ ₈ */
|
||||
'\0',
|
||||
'\xE2', '\x82', '\x80', ' ', '\xE2', '\x82', '\x81', ' ', '\xE2', '\x82', '\x82', ' ', '\xE2', '\x82', '\x83', ' ', '\xE2', '\x82', '\x88', /* ₀ ₁ ₂ ₃ ₈ */
|
||||
'\0',
|
||||
'\xE1', '\xB5', '\xA2', ' ', '\xE2', '\xB1', '\xBC', ' ', '\xE2', '\x82', '\x95', ' ', '\xE2', '\x82', '\x96', ' ', '\xE2', '\x82', '\x97', /* ᵢ ⱼ ₕ ₖ ₗ */
|
||||
'\0',
|
||||
'\xE2', '\x82', '\x90', ' ', '\xE2', '\x82', '\x91', ' ', '\xE2', '\x82', '\x92', ' ', '\xE2', '\x82', '\x93', ' ', '\xE2', '\x82', '\x99', ' ', '\xE2', '\x82', '\x9B', ' ', '\xE1', '\xB5', '\xA5', ' ', '\xE1', '\xB5', '\xA4', ' ', '\xE1', '\xB5', '\xA3', /* ₐ ₑ ₒ ₓ ₙ ₛ ᵥ ᵤ ᵣ */
|
||||
'\0',
|
||||
'\xE1', '\xB5', '\xA6', ' ', '\xE1', '\xB5', '\xA7', ' ', '\xE1', '\xB5', '\xA8', ' ', '\xE1', '\xB5', '\xA9', ' ', '\xE2', '\x82', '\x9A', /* ᵦ ᵧ ᵨ ᵩ ₚ */
|
||||
'\0',
|
||||
'\xE2', '\x81', '\xB0', ' ', '\xC2', '\xB3', ' ', '\xE2', '\x81', '\xB5', ' ', '\xE2', '\x81', '\xB7', ' ', '\xE1', '\xB5', '\x80', ' ', '\xE1', '\xB4', '\xB4', ' ', '\xE1', '\xB4', '\xB1', ' ', '\xE1', '\xB4', '\xBC', /* ⁰ ³ ⁵ ⁷ ᵀ ᴴ ᴱ ᴼ */
|
||||
'\0',
|
||||
'\xE2', '\x81', '\xB0', ' ', '\xC2', '\xB9', ' ', '\xC2', '\xB2', ' ', '\xC2', '\xB3', ' ', '\xE1', '\xB4', '\xB1', ' ', '\xE1', '\xB4', '\xB8', ' ', '\xE1', '\xB4', '\xBC', ' ', '\xE1', '\xB5', '\x81', /* ⁰ ¹ ² ³ ᴱ ᴸ ᴼ ᵁ */
|
||||
'\0',
|
||||
'\xE1', '\xB5', '\x87', ' ', '\xE1', '\xB5', '\x88', ' ', '\xE1', '\xB5', '\x8F', ' ', '\xCA', '\xB0', ' ', '\xCA', '\xB2', ' ', '\xE1', '\xB6', '\xA0', ' ', '\xE2', '\x81', '\xB1', /* ᵇ ᵈ ᵏ ʰ ʲ ᶠ ⁱ */
|
||||
'\0',
|
||||
'\xE1', '\xB5', '\x89', ' ', '\xE1', '\xB5', '\x92', ' ', '\xCA', '\xB3', ' ', '\xCB', '\xA2', ' ', '\xCB', '\xA3', ' ', '\xE1', '\xB6', '\x9C', ' ', '\xE1', '\xB6', '\xBB', /* ᵉ ᵒ ʳ ˢ ˣ ᶜ ᶻ */
|
||||
'\0',
|
||||
'\xE1', '\xB5', '\x96', ' ', '\xCA', '\xB8', ' ', '\xE1', '\xB5', '\x8D', /* ᵖ ʸ ᵍ */
|
||||
'\0',
|
||||
'\xEA', '\x93', '\xA1', ' ', '\xEA', '\x93', '\xA7', ' ', '\xEA', '\x93', '\xB1', ' ', '\xEA', '\x93', '\xB6', ' ', '\xEA', '\x93', '\xA9', ' ', '\xEA', '\x93', '\x9A', ' ', '\xEA', '\x93', '\xB5', ' ', '\xEA', '\x93', '\xB3', /* ꓡ ꓧ ꓱ ꓶ ꓩ ꓚ ꓵ ꓳ */
|
||||
'\0',
|
||||
'\xEA', '\x93', '\x95', ' ', '\xEA', '\x93', '\x9C', ' ', '\xEA', '\x93', '\x9E', ' ', '\xEA', '\x93', '\xA1', ' ', '\xEA', '\x93', '\x9B', ' ', '\xEA', '\x93', '\xA2', ' ', '\xEA', '\x93', '\xB3', ' ', '\xEA', '\x93', '\xB4', /* ꓕ ꓜ ꓞ ꓡ ꓛ ꓢ ꓳ ꓴ */
|
||||
'\0',
|
||||
'\xE0', '\xB4', '\x92', ' ', '\xE0', '\xB4', '\x9F', ' ', '\xE0', '\xB4', '\xA0', ' ', '\xE0', '\xB4', '\xB1', ' ', '\xE0', '\xB4', '\x9A', ' ', '\xE0', '\xB4', '\xAA', ' ', '\xE0', '\xB4', '\x9A', '\xE0', '\xB5', '\x8D', '\xE0', '\xB4', '\x9A', ' ', '\xE0', '\xB4', '\xAA', '\xE0', '\xB5', '\x8D', '\xE0', '\xB4', '\xAA', /* ഒ ട ഠ റ ച പ ച്ച പ്പ */
|
||||
'\0',
|
||||
'\xE0', '\xB4', '\x9F', ' ', '\xE0', '\xB4', '\xA0', ' ', '\xE0', '\xB4', '\xA7', ' ', '\xE0', '\xB4', '\xB6', ' ', '\xE0', '\xB4', '\x98', ' ', '\xE0', '\xB4', '\x9A', ' ', '\xE0', '\xB4', '\xA5', ' ', '\xE0', '\xB4', '\xB2', /* ട ഠ ധ ശ ഘ ച ഥ ല */
|
||||
'\0',
|
||||
'\xE1', '\x80', '\x81', ' ', '\xE1', '\x80', '\x82', ' ', '\xE1', '\x80', '\x84', ' ', '\xE1', '\x80', '\x92', ' ', '\xE1', '\x80', '\x9D', ' ', '\xE1', '\x81', '\xA5', ' ', '\xE1', '\x81', '\x8A', ' ', '\xE1', '\x81', '\x8B', /* ခ ဂ င ဒ ဝ ၥ ၊ ။ */
|
||||
'\0',
|
||||
'\xE1', '\x80', '\x84', ' ', '\xE1', '\x80', '\x8E', ' ', '\xE1', '\x80', '\x92', ' ', '\xE1', '\x80', '\x95', ' ', '\xE1', '\x80', '\x97', ' ', '\xE1', '\x80', '\x9D', ' ', '\xE1', '\x81', '\x8A', ' ', '\xE1', '\x81', '\x8B', /* င ဎ ဒ ပ ဗ ဝ ၊ ။ */
|
||||
'\0',
|
||||
'\xE1', '\x80', '\xA9', ' ', '\xE1', '\x80', '\xBC', ' ', '\xE1', '\x81', '\x8D', ' ', '\xE1', '\x81', '\x8F', ' ', '\xE1', '\x81', '\x86', ' ', '\xE1', '\x80', '\xAB', ' ', '\xE1', '\x80', '\xAD', /* ဩ ြ ၍ ၏ ၆ ါ ိ */
|
||||
'\0',
|
||||
'\xE1', '\x80', '\x89', ' ', '\xE1', '\x80', '\x8A', ' ', '\xE1', '\x80', '\xA5', ' ', '\xE1', '\x80', '\xA9', ' ', '\xE1', '\x80', '\xA8', ' ', '\xE1', '\x81', '\x82', ' ', '\xE1', '\x81', '\x85', ' ', '\xE1', '\x81', '\x89', /* ဉ ည ဥ ဩ ဨ ၂ ၅ ၉ */
|
||||
'\0',
|
||||
'\xDF', '\x90', ' ', '\xDF', '\x89', ' ', '\xDF', '\x92', ' ', '\xDF', '\x9F', ' ', '\xDF', '\x96', ' ', '\xDF', '\x9C', ' ', '\xDF', '\xA0', ' ', '\xDF', '\xA5', /* ߐ ߉ ߒ ߟ ߖ ߜ ߠ ߥ */
|
||||
'\0',
|
||||
'\xDF', '\x80', ' ', '\xDF', '\x98', ' ', '\xDF', '\xA1', ' ', '\xDF', '\xA0', ' ', '\xDF', '\xA5', /* ߀ ߘ ߡ ߠ ߥ */
|
||||
'\0',
|
||||
'\xDF', '\x8F', ' ', '\xDF', '\x9B', ' ', '\xDF', '\x8B', /* ߏ ߛ ߋ */
|
||||
'\0',
|
||||
'\xDF', '\x8E', ' ', '\xDF', '\x8F', ' ', '\xDF', '\x9B', ' ', '\xDF', '\x8B', /* ߎ ߏ ߛ ߋ */
|
||||
'\0',
|
||||
'\xE1', '\xB1', '\x9B', ' ', '\xE1', '\xB1', '\x9C', ' ', '\xE1', '\xB1', '\x9D', ' ', '\xE1', '\xB1', '\xA1', ' ', '\xE1', '\xB1', '\xA2', ' ', '\xE1', '\xB1', '\xA5', /* ᱛ ᱜ ᱝ ᱡ ᱢ ᱥ */
|
||||
'\0',
|
||||
'\xF0', '\x90', '\xB0', '\x97', ' ', '\xF0', '\x90', '\xB0', '\x98', ' ', '\xF0', '\x90', '\xB0', '\xA7', /* 𐰗 𐰘 𐰧 */
|
||||
'\0',
|
||||
'\xF0', '\x90', '\xB0', '\x89', ' ', '\xF0', '\x90', '\xB0', '\x97', ' ', '\xF0', '\x90', '\xB0', '\xA6', ' ', '\xF0', '\x90', '\xB0', '\xA7', /* 𐰉 𐰗 𐰦 𐰧 */
|
||||
'\0',
|
||||
'\xF0', '\x90', '\x92', '\xBE', ' ', '\xF0', '\x90', '\x93', '\x8D', ' ', '\xF0', '\x90', '\x93', '\x92', ' ', '\xF0', '\x90', '\x93', '\x93', ' ', '\xF0', '\x90', '\x92', '\xBB', ' ', '\xF0', '\x90', '\x93', '\x82', ' ', '\xF0', '\x90', '\x92', '\xB5', ' ', '\xF0', '\x90', '\x93', '\x86', /* 𐒾 𐓍 𐓒 𐓓 𐒻 𐓂 𐒵 𐓆 */
|
||||
'\0',
|
||||
'\xF0', '\x90', '\x92', '\xB0', ' ', '\xF0', '\x90', '\x93', '\x8D', ' ', '\xF0', '\x90', '\x93', '\x82', ' ', '\xF0', '\x90', '\x92', '\xBF', ' ', '\xF0', '\x90', '\x93', '\x8E', ' ', '\xF0', '\x90', '\x92', '\xB9', /* 𐒰 𐓍 𐓂 𐒿 𐓎 𐒹 */
|
||||
'\0',
|
||||
'\xF0', '\x90', '\x92', '\xBC', ' ', '\xF0', '\x90', '\x92', '\xBD', ' ', '\xF0', '\x90', '\x92', '\xBE', /* 𐒼 𐒽 𐒾 */
|
||||
'\0',
|
||||
'\xF0', '\x90', '\x93', '\xB5', ' ', '\xF0', '\x90', '\x93', '\xB6', ' ', '\xF0', '\x90', '\x93', '\xBA', ' ', '\xF0', '\x90', '\x93', '\xBB', ' ', '\xF0', '\x90', '\x93', '\x9D', ' ', '\xF0', '\x90', '\x93', '\xA3', ' ', '\xF0', '\x90', '\x93', '\xAA', ' ', '\xF0', '\x90', '\x93', '\xAE', /* 𐓵 𐓶 𐓺 𐓻 𐓝 𐓣 𐓪 𐓮 */
|
||||
'\0',
|
||||
'\xF0', '\x90', '\x93', '\x98', ' ', '\xF0', '\x90', '\x93', '\x9A', ' ', '\xF0', '\x90', '\x93', '\xA3', ' ', '\xF0', '\x90', '\x93', '\xB5', ' ', '\xF0', '\x90', '\x93', '\xA1', ' ', '\xF0', '\x90', '\x93', '\xA7', ' ', '\xF0', '\x90', '\x93', '\xAA', ' ', '\xF0', '\x90', '\x93', '\xB6', /* 𐓘 𐓚 𐓣 𐓵 𐓡 𐓧 𐓪 𐓶 */
|
||||
'\0',
|
||||
'\xF0', '\x90', '\x93', '\xA4', ' ', '\xF0', '\x90', '\x93', '\xA6', ' ', '\xF0', '\x90', '\x93', '\xB8', ' ', '\xF0', '\x90', '\x93', '\xB9', ' ', '\xF0', '\x90', '\x93', '\x9B', /* 𐓤 𐓦 𐓸 𐓹 𐓛 */
|
||||
'\0',
|
||||
'\xF0', '\x90', '\x93', '\xA4', ' ', '\xF0', '\x90', '\x93', '\xA5', ' ', '\xF0', '\x90', '\x93', '\xA6', /* 𐓤 𐓥 𐓦 */
|
||||
'\0',
|
||||
'\xF0', '\x90', '\x92', '\x86', ' ', '\xF0', '\x90', '\x92', '\x89', ' ', '\xF0', '\x90', '\x92', '\x90', ' ', '\xF0', '\x90', '\x92', '\x92', ' ', '\xF0', '\x90', '\x92', '\x98', ' ', '\xF0', '\x90', '\x92', '\x9B', ' ', '\xF0', '\x90', '\x92', '\xA0', ' ', '\xF0', '\x90', '\x92', '\xA3', /* 𐒆 𐒉 𐒐 𐒒 𐒘 𐒛 𐒠 𐒣 */
|
||||
'\0',
|
||||
'\xF0', '\x90', '\x92', '\x80', ' ', '\xF0', '\x90', '\x92', '\x82', ' ', '\xF0', '\x90', '\x92', '\x86', ' ', '\xF0', '\x90', '\x92', '\x88', ' ', '\xF0', '\x90', '\x92', '\x8A', ' ', '\xF0', '\x90', '\x92', '\x92', ' ', '\xF0', '\x90', '\x92', '\xA0', ' ', '\xF0', '\x90', '\x92', '\xA9', /* 𐒀 𐒂 𐒆 𐒈 𐒊 𐒒 𐒠 𐒩 */
|
||||
'\0',
|
||||
'\xEA', '\xA2', '\x9C', ' ', '\xEA', '\xA2', '\x9E', ' ', '\xEA', '\xA2', '\xB3', ' ', '\xEA', '\xA2', '\x82', ' ', '\xEA', '\xA2', '\x96', ' ', '\xEA', '\xA2', '\x92', ' ', '\xEA', '\xA2', '\x9D', ' ', '\xEA', '\xA2', '\x9B', /* ꢜ ꢞ ꢳ ꢂ ꢖ ꢒ ꢝ ꢛ */
|
||||
'\0',
|
||||
'\xEA', '\xA2', '\x82', ' ', '\xEA', '\xA2', '\xA8', ' ', '\xEA', '\xA2', '\xBA', ' ', '\xEA', '\xA2', '\xA4', ' ', '\xEA', '\xA2', '\x8E', /* ꢂ ꢨ ꢺ ꢤ ꢎ */
|
||||
'\0',
|
||||
'\xF0', '\x90', '\x91', '\x95', ' ', '\xF0', '\x90', '\x91', '\x99', /* 𐑕 𐑙 */
|
||||
'\0',
|
||||
'\xF0', '\x90', '\x91', '\x94', ' ', '\xF0', '\x90', '\x91', '\x96', ' ', '\xF0', '\x90', '\x91', '\x97', ' ', '\xF0', '\x90', '\x91', '\xB9', ' ', '\xF0', '\x90', '\x91', '\xBB', /* 𐑔 𐑖 𐑗 𐑹 𐑻 */
|
||||
'\0',
|
||||
'\xF0', '\x90', '\x91', '\x9F', ' ', '\xF0', '\x90', '\x91', '\xA3', /* 𐑟 𐑣 */
|
||||
'\0',
|
||||
'\xF0', '\x90', '\x91', '\xB1', ' ', '\xF0', '\x90', '\x91', '\xB2', ' ', '\xF0', '\x90', '\x91', '\xB3', ' ', '\xF0', '\x90', '\x91', '\xB4', ' ', '\xF0', '\x90', '\x91', '\xB8', ' ', '\xF0', '\x90', '\x91', '\xBA', ' ', '\xF0', '\x90', '\x91', '\xBC', /* 𐑱 𐑲 𐑳 𐑴 𐑸 𐑺 𐑼 */
|
||||
'\0',
|
||||
'\xF0', '\x90', '\x91', '\xB4', ' ', '\xF0', '\x90', '\x91', '\xBB', ' ', '\xF0', '\x90', '\x91', '\xB9', /* 𐑴 𐑻 𐑹 */
|
||||
'\0',
|
||||
'\xE0', '\xB6', '\x89', ' ', '\xE0', '\xB6', '\x9A', ' ', '\xE0', '\xB6', '\x9D', ' ', '\xE0', '\xB6', '\xB3', ' ', '\xE0', '\xB6', '\xB4', ' ', '\xE0', '\xB6', '\xBA', ' ', '\xE0', '\xB6', '\xBD', ' ', '\xE0', '\xB7', '\x86', /* ඉ ක ඝ ඳ ප ය ල ෆ */
|
||||
'\0',
|
||||
'\xE0', '\xB6', '\x91', ' ', '\xE0', '\xB6', '\x94', ' ', '\xE0', '\xB6', '\x9D', ' ', '\xE0', '\xB6', '\xA2', ' ', '\xE0', '\xB6', '\xA7', ' ', '\xE0', '\xB6', '\xAE', ' ', '\xE0', '\xB6', '\xB0', ' ', '\xE0', '\xB6', '\xBB', /* එ ඔ ඝ ජ ට ථ ධ ර */
|
||||
'\0',
|
||||
'\xE0', '\xB6', '\xAF', ' ', '\xE0', '\xB6', '\xB3', ' ', '\xE0', '\xB6', '\x8B', ' ', '\xE0', '\xB6', '\xBD', ' ', '\xE0', '\xB6', '\xAD', '\xE0', '\xB7', '\x96', ' ', '\xE0', '\xB6', '\xAD', '\xE0', '\xB7', '\x94', ' ', '\xE0', '\xB6', '\xB6', '\xE0', '\xB7', '\x94', ' ', '\xE0', '\xB6', '\xAF', '\xE0', '\xB7', '\x94', /* ද ඳ උ ල තූ තු බු දු */
|
||||
'\0',
|
||||
'\xE1', '\xAE', '\x8B', ' ', '\xE1', '\xAE', '\x9E', ' ', '\xE1', '\xAE', '\xAE', ' ', '\xE1', '\xAE', '\xBD', ' ', '\xE1', '\xAE', '\xB0', ' ', '\xE1', '\xAE', '\x88', /* ᮋ ᮞ ᮮ ᮽ ᮰ ᮈ */
|
||||
'\0',
|
||||
'\xE1', '\xAE', '\x84', ' ', '\xE1', '\xAE', '\x94', ' ', '\xE1', '\xAE', '\x95', ' ', '\xE1', '\xAE', '\x97', ' ', '\xE1', '\xAE', '\xB0', ' ', '\xE1', '\xAE', '\x86', ' ', '\xE1', '\xAE', '\x88', ' ', '\xE1', '\xAE', '\x89', /* ᮄ ᮔ ᮕ ᮗ ᮰ ᮆ ᮈ ᮉ */
|
||||
'\0',
|
||||
'\xE1', '\xAE', '\xBC', ' ', '\xE1', '\xB3', '\x84', /* ᮼ ᳄ */
|
||||
'\0',
|
||||
'\xEA', '\xAA', '\x86', ' ', '\xEA', '\xAA', '\x94', ' ', '\xEA', '\xAA', '\x92', ' ', '\xEA', '\xAA', '\x96', ' ', '\xEA', '\xAA', '\xAB', /* ꪆ ꪔ ꪒ ꪖ ꪫ */
|
||||
'\0',
|
||||
'\xEA', '\xAA', '\x89', ' ', '\xEA', '\xAA', '\xAB', ' ', '\xEA', '\xAA', '\xAE', /* ꪉ ꪫ ꪮ */
|
||||
'\0',
|
||||
'\xE0', '\xAE', '\x89', ' ', '\xE0', '\xAE', '\x92', ' ', '\xE0', '\xAE', '\x93', ' ', '\xE0', '\xAE', '\xB1', ' ', '\xE0', '\xAE', '\x88', ' ', '\xE0', '\xAE', '\x95', ' ', '\xE0', '\xAE', '\x99', ' ', '\xE0', '\xAE', '\x9A', /* உ ஒ ஓ ற ஈ க ங ச */
|
||||
'\0',
|
||||
'\xE0', '\xAE', '\x95', ' ', '\xE0', '\xAE', '\x9A', ' ', '\xE0', '\xAE', '\xB2', ' ', '\xE0', '\xAE', '\xB6', ' ', '\xE0', '\xAE', '\x89', ' ', '\xE0', '\xAE', '\x99', ' ', '\xE0', '\xAE', '\x9F', ' ', '\xE0', '\xAE', '\xAA', /* க ச ல ஶ உ ங ட ப */
|
||||
'\0',
|
||||
'\xE0', '\xB0', '\x87', ' ', '\xE0', '\xB0', '\x8C', ' ', '\xE0', '\xB0', '\x99', ' ', '\xE0', '\xB0', '\x9E', ' ', '\xE0', '\xB0', '\xA3', ' ', '\xE0', '\xB0', '\xB1', ' ', '\xE0', '\xB1', '\xAF', /* ఇ ఌ ఙ ఞ ణ ఱ ౯ */
|
||||
'\0',
|
||||
'\xE0', '\xB0', '\x85', ' ', '\xE0', '\xB0', '\x95', ' ', '\xE0', '\xB0', '\x9A', ' ', '\xE0', '\xB0', '\xB0', ' ', '\xE0', '\xB0', '\xBD', ' ', '\xE0', '\xB1', '\xA8', ' ', '\xE0', '\xB1', '\xAC', /* అ క చ ర ఽ ౨ ౬ */
|
||||
'\0',
|
||||
'\xE0', '\xB8', '\x9A', ' ', '\xE0', '\xB9', '\x80', ' ', '\xE0', '\xB9', '\x81', ' ', '\xE0', '\xB8', '\xAD', ' ', '\xE0', '\xB8', '\x81', ' ', '\xE0', '\xB8', '\xB2', /* บ เ แ อ ก า */
|
||||
'\0',
|
||||
'\xE0', '\xB8', '\x9A', ' ', '\xE0', '\xB8', '\x9B', ' ', '\xE0', '\xB8', '\xA9', ' ', '\xE0', '\xB8', '\xAF', ' ', '\xE0', '\xB8', '\xAD', ' ', '\xE0', '\xB8', '\xA2', ' ', '\xE0', '\xB8', '\xAE', /* บ ป ษ ฯ อ ย ฮ */
|
||||
'\0',
|
||||
'\xE0', '\xB8', '\x9B', ' ', '\xE0', '\xB8', '\x9D', ' ', '\xE0', '\xB8', '\x9F', /* ป ฝ ฟ */
|
||||
'\0',
|
||||
'\xE0', '\xB9', '\x82', ' ', '\xE0', '\xB9', '\x83', ' ', '\xE0', '\xB9', '\x84', /* โ ใ ไ */
|
||||
'\0',
|
||||
'\xE0', '\xB8', '\x8E', ' ', '\xE0', '\xB8', '\x8F', ' ', '\xE0', '\xB8', '\xA4', ' ', '\xE0', '\xB8', '\xA6', /* ฎ ฏ ฤ ฦ */
|
||||
'\0',
|
||||
'\xE0', '\xB8', '\x8D', ' ', '\xE0', '\xB8', '\x90', /* ญ ฐ */
|
||||
'\0',
|
||||
'\xE0', '\xB9', '\x90', ' ', '\xE0', '\xB9', '\x91', ' ', '\xE0', '\xB9', '\x93', /* ๐ ๑ ๓ */
|
||||
'\0',
|
||||
'\xE2', '\xB5', '\x94', ' ', '\xE2', '\xB5', '\x99', ' ', '\xE2', '\xB5', '\x9B', ' ', '\xE2', '\xB5', '\x9E', ' ', '\xE2', '\xB4', '\xB5', ' ', '\xE2', '\xB4', '\xBC', ' ', '\xE2', '\xB4', '\xB9', ' ', '\xE2', '\xB5', '\x8E', /* ⵔ ⵙ ⵛ ⵞ ⴵ ⴼ ⴹ ⵎ */
|
||||
'\0',
|
||||
'\xEA', '\x97', '\x8D', ' ', '\xEA', '\x98', '\x96', ' ', '\xEA', '\x98', '\x99', ' ', '\xEA', '\x98', '\x9C', ' ', '\xEA', '\x96', '\x9C', ' ', '\xEA', '\x96', '\x9D', ' ', '\xEA', '\x94', '\x85', ' ', '\xEA', '\x95', '\xA2', /* ꗍ ꘖ ꘙ ꘜ ꖜ ꖝ ꔅ ꕢ */
|
||||
'\0',
|
||||
'\xEA', '\x97', '\x8D', ' ', '\xEA', '\x98', '\x96', ' ', '\xEA', '\x98', '\x99', ' ', '\xEA', '\x97', '\x9E', ' ', '\xEA', '\x94', '\x85', ' ', '\xEA', '\x95', '\xA2', ' ', '\xEA', '\x96', '\x9C', ' ', '\xEA', '\x94', '\x86', /* ꗍ ꘖ ꘙ ꗞ ꔅ ꕢ ꖜ ꔆ */
|
||||
#ifdef AF_CONFIG_OPTION_CJK
|
||||
'\0',
|
||||
'\xE4', '\xBB', '\x96', ' ', '\xE4', '\xBB', '\xAC', ' ', '\xE4', '\xBD', '\xA0', ' ', '\xE4', '\xBE', '\x86', ' ', '\xE5', '\x80', '\x91', ' ', '\xE5', '\x88', '\xB0', ' ', '\xE5', '\x92', '\x8C', ' ', '\xE5', '\x9C', '\xB0', /* 他 们 你 來 們 到 和 地 */
|
||||
' ', '\xE5', '\xAF', '\xB9', ' ', '\xE5', '\xB0', '\x8D', ' ', '\xE5', '\xB0', '\xB1', ' ', '\xE5', '\xB8', '\xAD', ' ', '\xE6', '\x88', '\x91', ' ', '\xE6', '\x97', '\xB6', ' ', '\xE6', '\x99', '\x82', ' ', '\xE6', '\x9C', '\x83', /* 对 對 就 席 我 时 時 會 */
|
||||
' ', '\xE6', '\x9D', '\xA5', ' ', '\xE7', '\x82', '\xBA', ' ', '\xE8', '\x83', '\xBD', ' ', '\xE8', '\x88', '\xB0', ' ', '\xE8', '\xAA', '\xAA', ' ', '\xE8', '\xAF', '\xB4', ' ', '\xE8', '\xBF', '\x99', ' ', '\xE9', '\x80', '\x99', /* 来 為 能 舰 說 说 这 這 */
|
||||
' ', '\xE9', '\xBD', '\x8A', ' ', '|', /* 齊 | */
|
||||
' ', '\xE5', '\x86', '\x9B', ' ', '\xE5', '\x90', '\x8C', ' ', '\xE5', '\xB7', '\xB2', ' ', '\xE6', '\x84', '\xBF', ' ', '\xE6', '\x97', '\xA2', ' ', '\xE6', '\x98', '\x9F', ' ', '\xE6', '\x98', '\xAF', ' ', '\xE6', '\x99', '\xAF', /* 军 同 已 愿 既 星 是 景 */
|
||||
' ', '\xE6', '\xB0', '\x91', ' ', '\xE7', '\x85', '\xA7', ' ', '\xE7', '\x8E', '\xB0', ' ', '\xE7', '\x8F', '\xBE', ' ', '\xE7', '\x90', '\x86', ' ', '\xE7', '\x94', '\xA8', ' ', '\xE7', '\xBD', '\xAE', ' ', '\xE8', '\xA6', '\x81', /* 民 照 现 現 理 用 置 要 */
|
||||
' ', '\xE8', '\xBB', '\x8D', ' ', '\xE9', '\x82', '\xA3', ' ', '\xE9', '\x85', '\x8D', ' ', '\xE9', '\x87', '\x8C', ' ', '\xE9', '\x96', '\x8B', ' ', '\xE9', '\x9B', '\xB7', ' ', '\xE9', '\x9C', '\xB2', ' ', '\xE9', '\x9D', '\xA2', /* 軍 那 配 里 開 雷 露 面 */
|
||||
' ', '\xE9', '\xA1', '\xBE', /* 顾 */
|
||||
'\0',
|
||||
'\xE4', '\xB8', '\xAA', ' ', '\xE4', '\xB8', '\xBA', ' ', '\xE4', '\xBA', '\xBA', ' ', '\xE4', '\xBB', '\x96', ' ', '\xE4', '\xBB', '\xA5', ' ', '\xE4', '\xBB', '\xAC', ' ', '\xE4', '\xBD', '\xA0', ' ', '\xE4', '\xBE', '\x86', /* 个 为 人 他 以 们 你 來 */
|
||||
' ', '\xE5', '\x80', '\x8B', ' ', '\xE5', '\x80', '\x91', ' ', '\xE5', '\x88', '\xB0', ' ', '\xE5', '\x92', '\x8C', ' ', '\xE5', '\xA4', '\xA7', ' ', '\xE5', '\xAF', '\xB9', ' ', '\xE5', '\xB0', '\x8D', ' ', '\xE5', '\xB0', '\xB1', /* 個 們 到 和 大 对 對 就 */
|
||||
' ', '\xE6', '\x88', '\x91', ' ', '\xE6', '\x97', '\xB6', ' ', '\xE6', '\x99', '\x82', ' ', '\xE6', '\x9C', '\x89', ' ', '\xE6', '\x9D', '\xA5', ' ', '\xE7', '\x82', '\xBA', ' ', '\xE8', '\xA6', '\x81', ' ', '\xE8', '\xAA', '\xAA', /* 我 时 時 有 来 為 要 說 */
|
||||
' ', '\xE8', '\xAF', '\xB4', ' ', '|', /* 说 | */
|
||||
' ', '\xE4', '\xB8', '\xBB', ' ', '\xE4', '\xBA', '\x9B', ' ', '\xE5', '\x9B', '\xA0', ' ', '\xE5', '\xAE', '\x83', ' ', '\xE6', '\x83', '\xB3', ' ', '\xE6', '\x84', '\x8F', ' ', '\xE7', '\x90', '\x86', ' ', '\xE7', '\x94', '\x9F', /* 主 些 因 它 想 意 理 生 */
|
||||
' ', '\xE7', '\x95', '\xB6', ' ', '\xE7', '\x9C', '\x8B', ' ', '\xE7', '\x9D', '\x80', ' ', '\xE7', '\xBD', '\xAE', ' ', '\xE8', '\x80', '\x85', ' ', '\xE8', '\x87', '\xAA', ' ', '\xE8', '\x91', '\x97', ' ', '\xE8', '\xA3', '\xA1', /* 當 看 着 置 者 自 著 裡 */
|
||||
' ', '\xE8', '\xBF', '\x87', ' ', '\xE8', '\xBF', '\x98', ' ', '\xE8', '\xBF', '\x9B', ' ', '\xE9', '\x80', '\xB2', ' ', '\xE9', '\x81', '\x8E', ' ', '\xE9', '\x81', '\x93', ' ', '\xE9', '\x82', '\x84', ' ', '\xE9', '\x87', '\x8C', /* 过 还 进 進 過 道 還 里 */
|
||||
' ', '\xE9', '\x9D', '\xA2', /* 面 */
|
||||
#ifdef AF_CONFIG_OPTION_CJK_BLUE_HANI_VERT
|
||||
'\0',
|
||||
' ', '\xE4', '\xBA', '\x9B', ' ', '\xE4', '\xBB', '\xAC', ' ', '\xE4', '\xBD', '\xA0', ' ', '\xE4', '\xBE', '\x86', ' ', '\xE5', '\x80', '\x91', ' ', '\xE5', '\x88', '\xB0', ' ', '\xE5', '\x92', '\x8C', ' ', '\xE5', '\x9C', '\xB0', /* 些 们 你 來 們 到 和 地 */
|
||||
' ', '\xE5', '\xA5', '\xB9', ' ', '\xE5', '\xB0', '\x86', ' ', '\xE5', '\xB0', '\x87', ' ', '\xE5', '\xB0', '\xB1', ' ', '\xE5', '\xB9', '\xB4', ' ', '\xE5', '\xBE', '\x97', ' ', '\xE6', '\x83', '\x85', ' ', '\xE6', '\x9C', '\x80', /* 她 将 將 就 年 得 情 最 */
|
||||
' ', '\xE6', '\xA0', '\xB7', ' ', '\xE6', '\xA8', '\xA3', ' ', '\xE7', '\x90', '\x86', ' ', '\xE8', '\x83', '\xBD', ' ', '\xE8', '\xAA', '\xAA', ' ', '\xE8', '\xAF', '\xB4', ' ', '\xE8', '\xBF', '\x99', ' ', '\xE9', '\x80', '\x99', /* 样 樣 理 能 說 说 这 這 */
|
||||
' ', '\xE9', '\x80', '\x9A', ' ', '|', /* 通 | */
|
||||
' ', '\xE5', '\x8D', '\xB3', ' ', '\xE5', '\x90', '\x97', ' ', '\xE5', '\x90', '\xA7', ' ', '\xE5', '\x90', '\xAC', ' ', '\xE5', '\x91', '\xA2', ' ', '\xE5', '\x93', '\x81', ' ', '\xE5', '\x93', '\x8D', ' ', '\xE5', '\x97', '\x8E', /* 即 吗 吧 听 呢 品 响 嗎 */
|
||||
' ', '\xE5', '\xB8', '\x88', ' ', '\xE5', '\xB8', '\xAB', ' ', '\xE6', '\x94', '\xB6', ' ', '\xE6', '\x96', '\xAD', ' ', '\xE6', '\x96', '\xB7', ' ', '\xE6', '\x98', '\x8E', ' ', '\xE7', '\x9C', '\xBC', ' ', '\xE9', '\x96', '\x93', /* 师 師 收 断 斷 明 眼 間 */
|
||||
' ', '\xE9', '\x97', '\xB4', ' ', '\xE9', '\x99', '\x85', ' ', '\xE9', '\x99', '\x88', ' ', '\xE9', '\x99', '\x90', ' ', '\xE9', '\x99', '\xA4', ' ', '\xE9', '\x99', '\xB3', ' ', '\xE9', '\x9A', '\x8F', ' ', '\xE9', '\x9A', '\x9B', /* 间 际 陈 限 除 陳 随 際 */
|
||||
' ', '\xE9', '\x9A', '\xA8', /* 隨 */
|
||||
'\0',
|
||||
'\xE4', '\xBA', '\x8B', ' ', '\xE5', '\x89', '\x8D', ' ', '\xE5', '\xAD', '\xB8', ' ', '\xE5', '\xB0', '\x86', ' ', '\xE5', '\xB0', '\x87', ' ', '\xE6', '\x83', '\x85', ' ', '\xE6', '\x83', '\xB3', ' ', '\xE6', '\x88', '\x96', /* 事 前 學 将 將 情 想 或 */
|
||||
' ', '\xE6', '\x94', '\xBF', ' ', '\xE6', '\x96', '\xAF', ' ', '\xE6', '\x96', '\xB0', ' ', '\xE6', '\xA0', '\xB7', ' ', '\xE6', '\xA8', '\xA3', ' ', '\xE6', '\xB0', '\x91', ' ', '\xE6', '\xB2', '\x92', ' ', '\xE6', '\xB2', '\xA1', /* 政 斯 新 样 樣 民 沒 没 */
|
||||
' ', '\xE7', '\x84', '\xB6', ' ', '\xE7', '\x89', '\xB9', ' ', '\xE7', '\x8E', '\xB0', ' ', '\xE7', '\x8F', '\xBE', ' ', '\xE7', '\x90', '\x83', ' ', '\xE7', '\xAC', '\xAC', ' ', '\xE7', '\xB6', '\x93', ' ', '\xE8', '\xB0', '\x81', /* 然 特 现 現 球 第 經 谁 */
|
||||
' ', '\xE8', '\xB5', '\xB7', ' ', '|', /* 起 | */
|
||||
' ', '\xE4', '\xBE', '\x8B', ' ', '\xE5', '\x88', '\xA5', ' ', '\xE5', '\x88', '\xAB', ' ', '\xE5', '\x88', '\xB6', ' ', '\xE5', '\x8A', '\xA8', ' ', '\xE5', '\x8B', '\x95', ' ', '\xE5', '\x90', '\x97', ' ', '\xE5', '\x97', '\x8E', /* 例 別 别 制 动 動 吗 嗎 */
|
||||
' ', '\xE5', '\xA2', '\x9E', ' ', '\xE6', '\x8C', '\x87', ' ', '\xE6', '\x98', '\x8E', ' ', '\xE6', '\x9C', '\x9D', ' ', '\xE6', '\x9C', '\x9F', ' ', '\xE6', '\x9E', '\x84', ' ', '\xE7', '\x89', '\xA9', ' ', '\xE7', '\xA1', '\xAE', /* 增 指 明 朝 期 构 物 确 */
|
||||
' ', '\xE7', '\xA7', '\x8D', ' ', '\xE8', '\xAA', '\xBF', ' ', '\xE8', '\xB0', '\x83', ' ', '\xE8', '\xB2', '\xBB', ' ', '\xE8', '\xB4', '\xB9', ' ', '\xE9', '\x82', '\xA3', ' ', '\xE9', '\x83', '\xBD', ' ', '\xE9', '\x96', '\x93', /* 种 調 调 費 费 那 都 間 */
|
||||
' ', '\xE9', '\x97', '\xB4', /* 间 */
|
||||
#endif /* AF_CONFIG_OPTION_CJK_BLUE_HANI_VERT */
|
||||
#endif /* AF_CONFIG_OPTION_CJK */
|
||||
'\0',
|
||||
|
||||
};
|
||||
|
||||
|
||||
/* stringsets are specific to styles */
|
||||
FT_LOCAL_ARRAY_DEF( AF_Blue_StringRec )
|
||||
af_blue_stringsets[] =
|
||||
{
|
||||
/* */
|
||||
{ AF_BLUE_STRING_ADLAM_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
|
||||
{ AF_BLUE_STRING_ADLAM_CAPITAL_BOTTOM, 0 },
|
||||
{ AF_BLUE_STRING_ADLAM_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP |
|
||||
AF_BLUE_PROPERTY_LATIN_X_HEIGHT },
|
||||
{ AF_BLUE_STRING_ADLAM_SMALL_BOTTOM, 0 },
|
||||
{ AF_BLUE_STRING_MAX, 0 },
|
||||
{ AF_BLUE_STRING_ARABIC_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
|
||||
{ AF_BLUE_STRING_ARABIC_BOTTOM, 0 },
|
||||
{ AF_BLUE_STRING_ARABIC_JOIN, AF_BLUE_PROPERTY_LATIN_NEUTRAL },
|
||||
{ AF_BLUE_STRING_MAX, 0 },
|
||||
{ AF_BLUE_STRING_ARMENIAN_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
|
||||
{ AF_BLUE_STRING_ARMENIAN_CAPITAL_BOTTOM, 0 },
|
||||
{ AF_BLUE_STRING_ARMENIAN_SMALL_ASCENDER, AF_BLUE_PROPERTY_LATIN_TOP },
|
||||
{ AF_BLUE_STRING_ARMENIAN_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP |
|
||||
AF_BLUE_PROPERTY_LATIN_X_HEIGHT },
|
||||
{ AF_BLUE_STRING_ARMENIAN_SMALL_BOTTOM, 0 },
|
||||
{ AF_BLUE_STRING_ARMENIAN_SMALL_DESCENDER, 0 },
|
||||
{ AF_BLUE_STRING_MAX, 0 },
|
||||
{ AF_BLUE_STRING_AVESTAN_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
|
||||
{ AF_BLUE_STRING_AVESTAN_BOTTOM, 0 },
|
||||
{ AF_BLUE_STRING_MAX, 0 },
|
||||
{ AF_BLUE_STRING_BAMUM_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
|
||||
{ AF_BLUE_STRING_BAMUM_BOTTOM, 0 },
|
||||
{ AF_BLUE_STRING_MAX, 0 },
|
||||
{ AF_BLUE_STRING_BENGALI_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
|
||||
{ AF_BLUE_STRING_BENGALI_HEAD, AF_BLUE_PROPERTY_LATIN_TOP },
|
||||
{ AF_BLUE_STRING_BENGALI_BASE, AF_BLUE_PROPERTY_LATIN_TOP |
|
||||
AF_BLUE_PROPERTY_LATIN_NEUTRAL |
|
||||
AF_BLUE_PROPERTY_LATIN_X_HEIGHT },
|
||||
{ AF_BLUE_STRING_BENGALI_BASE, 0 },
|
||||
{ AF_BLUE_STRING_MAX, 0 },
|
||||
{ AF_BLUE_STRING_BUHID_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
|
||||
{ AF_BLUE_STRING_BUHID_LARGE, AF_BLUE_PROPERTY_LATIN_TOP },
|
||||
{ AF_BLUE_STRING_BUHID_SMALL, AF_BLUE_PROPERTY_LATIN_TOP |
|
||||
AF_BLUE_PROPERTY_LATIN_X_HEIGHT },
|
||||
{ AF_BLUE_STRING_BUHID_BOTTOM, 0 },
|
||||
{ AF_BLUE_STRING_MAX, 0 },
|
||||
{ AF_BLUE_STRING_CHAKMA_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
|
||||
{ AF_BLUE_STRING_CHAKMA_BOTTOM, 0 },
|
||||
{ AF_BLUE_STRING_CHAKMA_DESCENDER, 0 },
|
||||
{ AF_BLUE_STRING_MAX, 0 },
|
||||
{ AF_BLUE_STRING_CANADIAN_SYLLABICS_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
|
||||
{ AF_BLUE_STRING_CANADIAN_SYLLABICS_BOTTOM, 0 },
|
||||
{ AF_BLUE_STRING_CANADIAN_SYLLABICS_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP |
|
||||
AF_BLUE_PROPERTY_LATIN_X_HEIGHT },
|
||||
{ AF_BLUE_STRING_CANADIAN_SYLLABICS_SMALL_BOTTOM, 0 },
|
||||
{ AF_BLUE_STRING_CANADIAN_SYLLABICS_SUPS_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
|
||||
{ AF_BLUE_STRING_CANADIAN_SYLLABICS_SUPS_BOTTOM, 0 },
|
||||
{ AF_BLUE_STRING_MAX, 0 },
|
||||
{ AF_BLUE_STRING_CARIAN_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
|
||||
{ AF_BLUE_STRING_CARIAN_BOTTOM, 0 },
|
||||
{ AF_BLUE_STRING_MAX, 0 },
|
||||
{ AF_BLUE_STRING_CHEROKEE_CAPITAL, AF_BLUE_PROPERTY_LATIN_TOP },
|
||||
{ AF_BLUE_STRING_CHEROKEE_CAPITAL, 0 },
|
||||
{ AF_BLUE_STRING_CHEROKEE_SMALL_ASCENDER, AF_BLUE_PROPERTY_LATIN_TOP },
|
||||
{ AF_BLUE_STRING_CHEROKEE_SMALL, AF_BLUE_PROPERTY_LATIN_TOP |
|
||||
AF_BLUE_PROPERTY_LATIN_X_HEIGHT },
|
||||
{ AF_BLUE_STRING_CHEROKEE_SMALL, 0 },
|
||||
{ AF_BLUE_STRING_CHEROKEE_SMALL_DESCENDER, 0 },
|
||||
{ AF_BLUE_STRING_MAX, 0 },
|
||||
{ AF_BLUE_STRING_COPTIC_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
|
||||
{ AF_BLUE_STRING_COPTIC_CAPITAL_BOTTOM, 0 },
|
||||
{ AF_BLUE_STRING_COPTIC_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP |
|
||||
AF_BLUE_PROPERTY_LATIN_X_HEIGHT },
|
||||
{ AF_BLUE_STRING_COPTIC_SMALL_BOTTOM, 0 },
|
||||
{ AF_BLUE_STRING_MAX, 0 },
|
||||
{ AF_BLUE_STRING_CYPRIOT_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
|
||||
{ AF_BLUE_STRING_CYPRIOT_BOTTOM, 0 },
|
||||
{ AF_BLUE_STRING_CYPRIOT_SMALL, AF_BLUE_PROPERTY_LATIN_TOP },
|
||||
{ AF_BLUE_STRING_CYPRIOT_SMALL, 0 },
|
||||
{ AF_BLUE_STRING_MAX, 0 },
|
||||
{ AF_BLUE_STRING_CYRILLIC_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
|
||||
{ AF_BLUE_STRING_CYRILLIC_CAPITAL_BOTTOM, 0 },
|
||||
{ AF_BLUE_STRING_CYRILLIC_SMALL, AF_BLUE_PROPERTY_LATIN_TOP |
|
||||
AF_BLUE_PROPERTY_LATIN_X_HEIGHT },
|
||||
{ AF_BLUE_STRING_CYRILLIC_SMALL, 0 },
|
||||
{ AF_BLUE_STRING_CYRILLIC_SMALL_DESCENDER, 0 },
|
||||
{ AF_BLUE_STRING_MAX, 0 },
|
||||
{ AF_BLUE_STRING_DEVANAGARI_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
|
||||
{ AF_BLUE_STRING_DEVANAGARI_HEAD, AF_BLUE_PROPERTY_LATIN_TOP },
|
||||
{ AF_BLUE_STRING_DEVANAGARI_BASE, AF_BLUE_PROPERTY_LATIN_TOP |
|
||||
AF_BLUE_PROPERTY_LATIN_NEUTRAL |
|
||||
AF_BLUE_PROPERTY_LATIN_X_HEIGHT },
|
||||
{ AF_BLUE_STRING_DEVANAGARI_BASE, 0 },
|
||||
{ AF_BLUE_STRING_DEVANAGARI_BOTTOM, 0 },
|
||||
{ AF_BLUE_STRING_MAX, 0 },
|
||||
{ AF_BLUE_STRING_DESERET_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
|
||||
{ AF_BLUE_STRING_DESERET_CAPITAL_BOTTOM, 0 },
|
||||
{ AF_BLUE_STRING_DESERET_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP |
|
||||
AF_BLUE_PROPERTY_LATIN_X_HEIGHT },
|
||||
{ AF_BLUE_STRING_DESERET_SMALL_BOTTOM, 0 },
|
||||
{ AF_BLUE_STRING_MAX, 0 },
|
||||
{ AF_BLUE_STRING_ETHIOPIC_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
|
||||
{ AF_BLUE_STRING_ETHIOPIC_BOTTOM, 0 },
|
||||
{ AF_BLUE_STRING_MAX, 0 },
|
||||
{ AF_BLUE_STRING_GEORGIAN_MKHEDRULI_TOP, AF_BLUE_PROPERTY_LATIN_TOP |
|
||||
AF_BLUE_PROPERTY_LATIN_X_HEIGHT },
|
||||
{ AF_BLUE_STRING_GEORGIAN_MKHEDRULI_BOTTOM, 0 },
|
||||
{ AF_BLUE_STRING_GEORGIAN_MKHEDRULI_ASCENDER, AF_BLUE_PROPERTY_LATIN_TOP },
|
||||
{ AF_BLUE_STRING_GEORGIAN_MKHEDRULI_DESCENDER, 0 },
|
||||
{ AF_BLUE_STRING_GEORGIAN_MTAVRULI_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
|
||||
{ AF_BLUE_STRING_GEORGIAN_MTAVRULI_BOTTOM, 0 },
|
||||
{ AF_BLUE_STRING_MAX, 0 },
|
||||
{ AF_BLUE_STRING_GEORGIAN_ASOMTAVRULI_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
|
||||
{ AF_BLUE_STRING_GEORGIAN_ASOMTAVRULI_BOTTOM, 0 },
|
||||
{ AF_BLUE_STRING_GEORGIAN_NUSKHURI_TOP, AF_BLUE_PROPERTY_LATIN_TOP |
|
||||
AF_BLUE_PROPERTY_LATIN_X_HEIGHT },
|
||||
{ AF_BLUE_STRING_GEORGIAN_NUSKHURI_BOTTOM, 0 },
|
||||
{ AF_BLUE_STRING_GEORGIAN_NUSKHURI_ASCENDER, AF_BLUE_PROPERTY_LATIN_TOP },
|
||||
{ AF_BLUE_STRING_GEORGIAN_NUSKHURI_DESCENDER, 0 },
|
||||
{ AF_BLUE_STRING_MAX, 0 },
|
||||
{ AF_BLUE_STRING_GLAGOLITIC_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
|
||||
{ AF_BLUE_STRING_GLAGOLITIC_CAPITAL_BOTTOM, 0 },
|
||||
{ AF_BLUE_STRING_GLAGOLITIC_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP |
|
||||
AF_BLUE_PROPERTY_LATIN_X_HEIGHT },
|
||||
{ AF_BLUE_STRING_GLAGOLITIC_SMALL_BOTTOM, 0 },
|
||||
{ AF_BLUE_STRING_MAX, 0 },
|
||||
{ AF_BLUE_STRING_GOTHIC_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
|
||||
{ AF_BLUE_STRING_GOTHIC_BOTTOM, 0 },
|
||||
{ AF_BLUE_STRING_MAX, 0 },
|
||||
{ AF_BLUE_STRING_GREEK_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
|
||||
{ AF_BLUE_STRING_GREEK_CAPITAL_BOTTOM, 0 },
|
||||
{ AF_BLUE_STRING_GREEK_SMALL_BETA_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
|
||||
{ AF_BLUE_STRING_GREEK_SMALL, AF_BLUE_PROPERTY_LATIN_TOP |
|
||||
AF_BLUE_PROPERTY_LATIN_X_HEIGHT },
|
||||
{ AF_BLUE_STRING_GREEK_SMALL, 0 },
|
||||
{ AF_BLUE_STRING_GREEK_SMALL_DESCENDER, 0 },
|
||||
{ AF_BLUE_STRING_MAX, 0 },
|
||||
{ AF_BLUE_STRING_GUJARATI_TOP, AF_BLUE_PROPERTY_LATIN_TOP |
|
||||
AF_BLUE_PROPERTY_LATIN_X_HEIGHT },
|
||||
{ AF_BLUE_STRING_GUJARATI_BOTTOM, 0 },
|
||||
{ AF_BLUE_STRING_GUJARATI_ASCENDER, AF_BLUE_PROPERTY_LATIN_TOP },
|
||||
{ AF_BLUE_STRING_GUJARATI_DESCENDER, 0 },
|
||||
{ AF_BLUE_STRING_GUJARATI_DIGIT_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
|
||||
{ AF_BLUE_STRING_MAX, 0 },
|
||||
{ AF_BLUE_STRING_GURMUKHI_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
|
||||
{ AF_BLUE_STRING_GURMUKHI_HEAD, AF_BLUE_PROPERTY_LATIN_TOP },
|
||||
{ AF_BLUE_STRING_GURMUKHI_BASE, AF_BLUE_PROPERTY_LATIN_TOP |
|
||||
AF_BLUE_PROPERTY_LATIN_NEUTRAL |
|
||||
AF_BLUE_PROPERTY_LATIN_X_HEIGHT },
|
||||
{ AF_BLUE_STRING_GURMUKHI_BOTTOM, 0 },
|
||||
{ AF_BLUE_STRING_GURMUKHI_DIGIT_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
|
||||
{ AF_BLUE_STRING_MAX, 0 },
|
||||
{ AF_BLUE_STRING_HEBREW_TOP, AF_BLUE_PROPERTY_LATIN_TOP |
|
||||
AF_BLUE_PROPERTY_LATIN_LONG },
|
||||
{ AF_BLUE_STRING_HEBREW_BOTTOM, 0 },
|
||||
{ AF_BLUE_STRING_HEBREW_DESCENDER, 0 },
|
||||
{ AF_BLUE_STRING_MAX, 0 },
|
||||
{ AF_BLUE_STRING_KAYAH_LI_TOP, AF_BLUE_PROPERTY_LATIN_TOP |
|
||||
AF_BLUE_PROPERTY_LATIN_X_HEIGHT },
|
||||
{ AF_BLUE_STRING_KAYAH_LI_BOTTOM, 0 },
|
||||
{ AF_BLUE_STRING_KAYAH_LI_ASCENDER, AF_BLUE_PROPERTY_LATIN_TOP },
|
||||
{ AF_BLUE_STRING_KAYAH_LI_DESCENDER, 0 },
|
||||
{ AF_BLUE_STRING_KAYAH_LI_LARGE_DESCENDER, 0 },
|
||||
{ AF_BLUE_STRING_MAX, 0 },
|
||||
{ AF_BLUE_STRING_KHMER_TOP, AF_BLUE_PROPERTY_LATIN_TOP |
|
||||
AF_BLUE_PROPERTY_LATIN_X_HEIGHT },
|
||||
{ AF_BLUE_STRING_KHMER_SUBSCRIPT_TOP, AF_BLUE_PROPERTY_LATIN_SUB_TOP },
|
||||
{ AF_BLUE_STRING_KHMER_BOTTOM, 0 },
|
||||
{ AF_BLUE_STRING_KHMER_DESCENDER, 0 },
|
||||
{ AF_BLUE_STRING_KHMER_LARGE_DESCENDER, 0 },
|
||||
{ AF_BLUE_STRING_MAX, 0 },
|
||||
{ AF_BLUE_STRING_KHMER_SYMBOLS_WAXING_TOP, AF_BLUE_PROPERTY_LATIN_TOP |
|
||||
AF_BLUE_PROPERTY_LATIN_X_HEIGHT },
|
||||
{ AF_BLUE_STRING_KHMER_SYMBOLS_WANING_BOTTOM, 0 },
|
||||
{ AF_BLUE_STRING_MAX, 0 },
|
||||
{ AF_BLUE_STRING_KANNADA_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
|
||||
{ AF_BLUE_STRING_KANNADA_BOTTOM, 0 },
|
||||
{ AF_BLUE_STRING_MAX, 0 },
|
||||
{ AF_BLUE_STRING_LAO_TOP, AF_BLUE_PROPERTY_LATIN_TOP |
|
||||
AF_BLUE_PROPERTY_LATIN_X_HEIGHT },
|
||||
{ AF_BLUE_STRING_LAO_BOTTOM, 0 },
|
||||
{ AF_BLUE_STRING_LAO_ASCENDER, AF_BLUE_PROPERTY_LATIN_TOP },
|
||||
{ AF_BLUE_STRING_LAO_LARGE_ASCENDER, AF_BLUE_PROPERTY_LATIN_TOP },
|
||||
{ AF_BLUE_STRING_LAO_DESCENDER, 0 },
|
||||
{ AF_BLUE_STRING_MAX, 0 },
|
||||
{ AF_BLUE_STRING_LATIN_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
|
||||
{ AF_BLUE_STRING_LATIN_CAPITAL_BOTTOM, 0 },
|
||||
{ AF_BLUE_STRING_LATIN_SMALL_F_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
|
||||
{ AF_BLUE_STRING_LATIN_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP |
|
||||
AF_BLUE_PROPERTY_LATIN_X_HEIGHT },
|
||||
{ AF_BLUE_STRING_LATIN_SMALL_BOTTOM, 0 },
|
||||
{ AF_BLUE_STRING_LATIN_SMALL_DESCENDER, 0 },
|
||||
{ AF_BLUE_STRING_MAX, 0 },
|
||||
{ AF_BLUE_STRING_LATIN_SUBS_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
|
||||
{ AF_BLUE_STRING_LATIN_SUBS_CAPITAL_BOTTOM, 0 },
|
||||
{ AF_BLUE_STRING_LATIN_SUBS_SMALL_F_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
|
||||
{ AF_BLUE_STRING_LATIN_SUBS_SMALL, AF_BLUE_PROPERTY_LATIN_TOP |
|
||||
AF_BLUE_PROPERTY_LATIN_X_HEIGHT },
|
||||
{ AF_BLUE_STRING_LATIN_SUBS_SMALL, 0 },
|
||||
{ AF_BLUE_STRING_LATIN_SUBS_SMALL_DESCENDER, 0 },
|
||||
{ AF_BLUE_STRING_MAX, 0 },
|
||||
{ AF_BLUE_STRING_LATIN_SUPS_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
|
||||
{ AF_BLUE_STRING_LATIN_SUPS_CAPITAL_BOTTOM, 0 },
|
||||
{ AF_BLUE_STRING_LATIN_SUPS_SMALL_F_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
|
||||
{ AF_BLUE_STRING_LATIN_SUPS_SMALL, AF_BLUE_PROPERTY_LATIN_TOP |
|
||||
AF_BLUE_PROPERTY_LATIN_X_HEIGHT },
|
||||
{ AF_BLUE_STRING_LATIN_SUPS_SMALL, 0 },
|
||||
{ AF_BLUE_STRING_LATIN_SUPS_SMALL_DESCENDER, 0 },
|
||||
{ AF_BLUE_STRING_MAX, 0 },
|
||||
{ AF_BLUE_STRING_LISU_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
|
||||
{ AF_BLUE_STRING_LISU_BOTTOM, 0 },
|
||||
{ AF_BLUE_STRING_MAX, 0 },
|
||||
{ AF_BLUE_STRING_MALAYALAM_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
|
||||
{ AF_BLUE_STRING_MALAYALAM_BOTTOM, 0 },
|
||||
{ AF_BLUE_STRING_MAX, 0 },
|
||||
{ AF_BLUE_STRING_MYANMAR_TOP, AF_BLUE_PROPERTY_LATIN_TOP |
|
||||
AF_BLUE_PROPERTY_LATIN_X_HEIGHT },
|
||||
{ AF_BLUE_STRING_MYANMAR_BOTTOM, 0 },
|
||||
{ AF_BLUE_STRING_MYANMAR_ASCENDER, AF_BLUE_PROPERTY_LATIN_TOP },
|
||||
{ AF_BLUE_STRING_MYANMAR_DESCENDER, 0 },
|
||||
{ AF_BLUE_STRING_MAX, 0 },
|
||||
{ AF_BLUE_STRING_NKO_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
|
||||
{ AF_BLUE_STRING_NKO_BOTTOM, 0 },
|
||||
{ AF_BLUE_STRING_NKO_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP |
|
||||
AF_BLUE_PROPERTY_LATIN_X_HEIGHT },
|
||||
{ AF_BLUE_STRING_NKO_SMALL_BOTTOM, 0 },
|
||||
{ AF_BLUE_STRING_MAX, 0 },
|
||||
{ AF_BLUE_STRING_MAX, 0 },
|
||||
{ AF_BLUE_STRING_OL_CHIKI, AF_BLUE_PROPERTY_LATIN_TOP },
|
||||
{ AF_BLUE_STRING_OL_CHIKI, 0 },
|
||||
{ AF_BLUE_STRING_MAX, 0 },
|
||||
{ AF_BLUE_STRING_OLD_TURKIC_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
|
||||
{ AF_BLUE_STRING_OLD_TURKIC_BOTTOM, 0 },
|
||||
{ AF_BLUE_STRING_MAX, 0 },
|
||||
{ AF_BLUE_STRING_OSAGE_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
|
||||
{ AF_BLUE_STRING_OSAGE_CAPITAL_BOTTOM, 0 },
|
||||
{ AF_BLUE_STRING_OSAGE_CAPITAL_DESCENDER, 0 },
|
||||
{ AF_BLUE_STRING_OSAGE_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP |
|
||||
AF_BLUE_PROPERTY_LATIN_X_HEIGHT },
|
||||
{ AF_BLUE_STRING_OSAGE_SMALL_BOTTOM, 0 },
|
||||
{ AF_BLUE_STRING_OSAGE_SMALL_ASCENDER, AF_BLUE_PROPERTY_LATIN_TOP },
|
||||
{ AF_BLUE_STRING_OSAGE_SMALL_DESCENDER, 0 },
|
||||
{ AF_BLUE_STRING_MAX, 0 },
|
||||
{ AF_BLUE_STRING_OSMANYA_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
|
||||
{ AF_BLUE_STRING_OSMANYA_BOTTOM, 0 },
|
||||
{ AF_BLUE_STRING_MAX, 0 },
|
||||
{ AF_BLUE_STRING_SAURASHTRA_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
|
||||
{ AF_BLUE_STRING_SAURASHTRA_BOTTOM, 0 },
|
||||
{ AF_BLUE_STRING_MAX, 0 },
|
||||
{ AF_BLUE_STRING_SHAVIAN_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
|
||||
{ AF_BLUE_STRING_SHAVIAN_BOTTOM, 0 },
|
||||
{ AF_BLUE_STRING_SHAVIAN_DESCENDER, 0 },
|
||||
{ AF_BLUE_STRING_SHAVIAN_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP |
|
||||
AF_BLUE_PROPERTY_LATIN_X_HEIGHT },
|
||||
{ AF_BLUE_STRING_SHAVIAN_SMALL_BOTTOM, 0 },
|
||||
{ AF_BLUE_STRING_MAX, 0 },
|
||||
{ AF_BLUE_STRING_SINHALA_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
|
||||
{ AF_BLUE_STRING_SINHALA_BOTTOM, 0 },
|
||||
{ AF_BLUE_STRING_SINHALA_DESCENDER, 0 },
|
||||
{ AF_BLUE_STRING_MAX, 0 },
|
||||
{ AF_BLUE_STRING_SUNDANESE_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
|
||||
{ AF_BLUE_STRING_SUNDANESE_BOTTOM, 0 },
|
||||
{ AF_BLUE_STRING_SUNDANESE_DESCENDER, 0 },
|
||||
{ AF_BLUE_STRING_MAX, 0 },
|
||||
{ AF_BLUE_STRING_TAMIL_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
|
||||
{ AF_BLUE_STRING_TAMIL_BOTTOM, 0 },
|
||||
{ AF_BLUE_STRING_MAX, 0 },
|
||||
{ AF_BLUE_STRING_TAI_VIET_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
|
||||
{ AF_BLUE_STRING_TAI_VIET_BOTTOM, 0 },
|
||||
{ AF_BLUE_STRING_MAX, 0 },
|
||||
{ AF_BLUE_STRING_TELUGU_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
|
||||
{ AF_BLUE_STRING_TELUGU_BOTTOM, 0 },
|
||||
{ AF_BLUE_STRING_MAX, 0 },
|
||||
{ AF_BLUE_STRING_TIFINAGH, AF_BLUE_PROPERTY_LATIN_TOP },
|
||||
{ AF_BLUE_STRING_TIFINAGH, 0 },
|
||||
{ AF_BLUE_STRING_MAX, 0 },
|
||||
{ AF_BLUE_STRING_THAI_TOP, AF_BLUE_PROPERTY_LATIN_TOP |
|
||||
AF_BLUE_PROPERTY_LATIN_X_HEIGHT },
|
||||
{ AF_BLUE_STRING_THAI_BOTTOM, 0 },
|
||||
{ AF_BLUE_STRING_THAI_ASCENDER, AF_BLUE_PROPERTY_LATIN_TOP },
|
||||
{ AF_BLUE_STRING_THAI_LARGE_ASCENDER, AF_BLUE_PROPERTY_LATIN_TOP },
|
||||
{ AF_BLUE_STRING_THAI_DESCENDER, 0 },
|
||||
{ AF_BLUE_STRING_THAI_LARGE_DESCENDER, 0 },
|
||||
{ AF_BLUE_STRING_THAI_DIGIT_TOP, 0 },
|
||||
{ AF_BLUE_STRING_MAX, 0 },
|
||||
{ AF_BLUE_STRING_VAI_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
|
||||
{ AF_BLUE_STRING_VAI_BOTTOM, 0 },
|
||||
{ AF_BLUE_STRING_MAX, 0 },
|
||||
#ifdef AF_CONFIG_OPTION_CJK
|
||||
{ AF_BLUE_STRING_CJK_TOP, AF_BLUE_PROPERTY_CJK_TOP },
|
||||
{ AF_BLUE_STRING_CJK_BOTTOM, 0 },
|
||||
#ifdef AF_CONFIG_OPTION_CJK_BLUE_HANI_VERT
|
||||
{ AF_BLUE_STRING_CJK_LEFT, AF_BLUE_PROPERTY_CJK_HORIZ },
|
||||
{ AF_BLUE_STRING_CJK_RIGHT, AF_BLUE_PROPERTY_CJK_HORIZ |
|
||||
AF_BLUE_PROPERTY_CJK_RIGHT },
|
||||
#endif /* AF_CONFIG_OPTION_CJK_BLUE_HANI_VERT */
|
||||
{ AF_BLUE_STRING_MAX, 0 },
|
||||
#endif /* AF_CONFIG_OPTION_CJK */
|
||||
|
||||
};
|
||||
|
||||
|
||||
/* END */
|
||||
39
vendor/FreeType2/src/autofit/afblue.cin
vendored
Normal file
39
vendor/FreeType2/src/autofit/afblue.cin
vendored
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
/***************************************************************************/
|
||||
/* */
|
||||
/* afblue.c */
|
||||
/* */
|
||||
/* Auto-fitter data for blue strings (body). */
|
||||
/* */
|
||||
/* Copyright 2013-2018 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 "aftypes.h"
|
||||
|
||||
|
||||
FT_LOCAL_ARRAY_DEF( char )
|
||||
af_blue_strings[] =
|
||||
{
|
||||
/* */
|
||||
@AF_BLUE_STRINGS_ARRAY@
|
||||
};
|
||||
|
||||
|
||||
/* stringsets are specific to styles */
|
||||
FT_LOCAL_ARRAY_DEF( AF_Blue_StringRec )
|
||||
af_blue_stringsets[] =
|
||||
{
|
||||
/* */
|
||||
@AF_BLUE_STRINGSETS_ARRAY@
|
||||
};
|
||||
|
||||
|
||||
/* END */
|
||||
1072
vendor/FreeType2/src/autofit/afblue.dat
vendored
Normal file
1072
vendor/FreeType2/src/autofit/afblue.dat
vendored
Normal file
File diff suppressed because it is too large
Load diff
414
vendor/FreeType2/src/autofit/afblue.h
vendored
Normal file
414
vendor/FreeType2/src/autofit/afblue.h
vendored
Normal file
|
|
@ -0,0 +1,414 @@
|
|||
/* This file has been generated by the Perl script `afblue.pl', */
|
||||
/* using data from file `afblue.dat'. */
|
||||
|
||||
/***************************************************************************/
|
||||
/* */
|
||||
/* afblue.h */
|
||||
/* */
|
||||
/* Auto-fitter data for blue strings (specification). */
|
||||
/* */
|
||||
/* Copyright 2013-2018 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. */
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
|
||||
#ifndef AFBLUE_H_
|
||||
#define AFBLUE_H_
|
||||
|
||||
|
||||
FT_BEGIN_HEADER
|
||||
|
||||
|
||||
/* an auxiliary macro to decode a UTF-8 character -- since we only use */
|
||||
/* hard-coded, self-converted data, no error checking is performed */
|
||||
#define GET_UTF8_CHAR( ch, p ) \
|
||||
do \
|
||||
{ \
|
||||
ch = (unsigned char)*p++; \
|
||||
if ( ch >= 0x80 ) \
|
||||
{ \
|
||||
FT_UInt len_; \
|
||||
\
|
||||
\
|
||||
if ( ch < 0xE0 ) \
|
||||
{ \
|
||||
len_ = 1; \
|
||||
ch &= 0x1F; \
|
||||
} \
|
||||
else if ( ch < 0xF0 ) \
|
||||
{ \
|
||||
len_ = 2; \
|
||||
ch &= 0x0F; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
len_ = 3; \
|
||||
ch &= 0x07; \
|
||||
} \
|
||||
\
|
||||
for ( ; len_ > 0; len_-- ) \
|
||||
ch = ( ch << 6 ) | ( *p++ & 0x3F ); \
|
||||
} \
|
||||
} while ( 0 )
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/***** *****/
|
||||
/***** B L U E S T R I N G S *****/
|
||||
/***** *****/
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
|
||||
/* At the bottommost level, we define strings for finding blue zones. */
|
||||
|
||||
|
||||
#define AF_BLUE_STRING_MAX_LEN 51
|
||||
|
||||
/* The AF_Blue_String enumeration values are offsets into the */
|
||||
/* `af_blue_strings' array. */
|
||||
|
||||
typedef enum AF_Blue_String_
|
||||
{
|
||||
AF_BLUE_STRING_ADLAM_CAPITAL_TOP = 0,
|
||||
AF_BLUE_STRING_ADLAM_CAPITAL_BOTTOM = 30,
|
||||
AF_BLUE_STRING_ADLAM_SMALL_TOP = 40,
|
||||
AF_BLUE_STRING_ADLAM_SMALL_BOTTOM = 65,
|
||||
AF_BLUE_STRING_ARABIC_TOP = 105,
|
||||
AF_BLUE_STRING_ARABIC_BOTTOM = 123,
|
||||
AF_BLUE_STRING_ARABIC_JOIN = 138,
|
||||
AF_BLUE_STRING_ARMENIAN_CAPITAL_TOP = 141,
|
||||
AF_BLUE_STRING_ARMENIAN_CAPITAL_BOTTOM = 165,
|
||||
AF_BLUE_STRING_ARMENIAN_SMALL_ASCENDER = 189,
|
||||
AF_BLUE_STRING_ARMENIAN_SMALL_TOP = 210,
|
||||
AF_BLUE_STRING_ARMENIAN_SMALL_BOTTOM = 234,
|
||||
AF_BLUE_STRING_ARMENIAN_SMALL_DESCENDER = 258,
|
||||
AF_BLUE_STRING_AVESTAN_TOP = 282,
|
||||
AF_BLUE_STRING_AVESTAN_BOTTOM = 302,
|
||||
AF_BLUE_STRING_BAMUM_TOP = 312,
|
||||
AF_BLUE_STRING_BAMUM_BOTTOM = 344,
|
||||
AF_BLUE_STRING_BENGALI_BASE = 376,
|
||||
AF_BLUE_STRING_BENGALI_TOP = 408,
|
||||
AF_BLUE_STRING_BENGALI_HEAD = 436,
|
||||
AF_BLUE_STRING_BUHID_TOP = 468,
|
||||
AF_BLUE_STRING_BUHID_LARGE = 476,
|
||||
AF_BLUE_STRING_BUHID_SMALL = 488,
|
||||
AF_BLUE_STRING_BUHID_BOTTOM = 504,
|
||||
AF_BLUE_STRING_CANADIAN_SYLLABICS_TOP = 532,
|
||||
AF_BLUE_STRING_CANADIAN_SYLLABICS_BOTTOM = 564,
|
||||
AF_BLUE_STRING_CANADIAN_SYLLABICS_SMALL_TOP = 596,
|
||||
AF_BLUE_STRING_CANADIAN_SYLLABICS_SMALL_BOTTOM = 628,
|
||||
AF_BLUE_STRING_CANADIAN_SYLLABICS_SUPS_TOP = 660,
|
||||
AF_BLUE_STRING_CANADIAN_SYLLABICS_SUPS_BOTTOM = 688,
|
||||
AF_BLUE_STRING_CARIAN_TOP = 720,
|
||||
AF_BLUE_STRING_CARIAN_BOTTOM = 760,
|
||||
AF_BLUE_STRING_CHAKMA_TOP = 795,
|
||||
AF_BLUE_STRING_CHAKMA_BOTTOM = 820,
|
||||
AF_BLUE_STRING_CHAKMA_DESCENDER = 845,
|
||||
AF_BLUE_STRING_CHEROKEE_CAPITAL = 910,
|
||||
AF_BLUE_STRING_CHEROKEE_SMALL_ASCENDER = 942,
|
||||
AF_BLUE_STRING_CHEROKEE_SMALL = 974,
|
||||
AF_BLUE_STRING_CHEROKEE_SMALL_DESCENDER = 1006,
|
||||
AF_BLUE_STRING_COPTIC_CAPITAL_TOP = 1022,
|
||||
AF_BLUE_STRING_COPTIC_CAPITAL_BOTTOM = 1054,
|
||||
AF_BLUE_STRING_COPTIC_SMALL_TOP = 1086,
|
||||
AF_BLUE_STRING_COPTIC_SMALL_BOTTOM = 1118,
|
||||
AF_BLUE_STRING_CYPRIOT_TOP = 1150,
|
||||
AF_BLUE_STRING_CYPRIOT_BOTTOM = 1190,
|
||||
AF_BLUE_STRING_CYPRIOT_SMALL = 1225,
|
||||
AF_BLUE_STRING_CYRILLIC_CAPITAL_TOP = 1240,
|
||||
AF_BLUE_STRING_CYRILLIC_CAPITAL_BOTTOM = 1264,
|
||||
AF_BLUE_STRING_CYRILLIC_SMALL = 1288,
|
||||
AF_BLUE_STRING_CYRILLIC_SMALL_DESCENDER = 1312,
|
||||
AF_BLUE_STRING_DESERET_CAPITAL_TOP = 1321,
|
||||
AF_BLUE_STRING_DESERET_CAPITAL_BOTTOM = 1346,
|
||||
AF_BLUE_STRING_DESERET_SMALL_TOP = 1371,
|
||||
AF_BLUE_STRING_DESERET_SMALL_BOTTOM = 1396,
|
||||
AF_BLUE_STRING_DEVANAGARI_BASE = 1421,
|
||||
AF_BLUE_STRING_DEVANAGARI_TOP = 1453,
|
||||
AF_BLUE_STRING_DEVANAGARI_HEAD = 1485,
|
||||
AF_BLUE_STRING_DEVANAGARI_BOTTOM = 1517,
|
||||
AF_BLUE_STRING_ETHIOPIC_TOP = 1525,
|
||||
AF_BLUE_STRING_ETHIOPIC_BOTTOM = 1557,
|
||||
AF_BLUE_STRING_GEORGIAN_MKHEDRULI_TOP = 1589,
|
||||
AF_BLUE_STRING_GEORGIAN_MKHEDRULI_BOTTOM = 1621,
|
||||
AF_BLUE_STRING_GEORGIAN_MKHEDRULI_ASCENDER = 1653,
|
||||
AF_BLUE_STRING_GEORGIAN_MKHEDRULI_DESCENDER = 1685,
|
||||
AF_BLUE_STRING_GEORGIAN_ASOMTAVRULI_TOP = 1717,
|
||||
AF_BLUE_STRING_GEORGIAN_ASOMTAVRULI_BOTTOM = 1749,
|
||||
AF_BLUE_STRING_GEORGIAN_NUSKHURI_TOP = 1781,
|
||||
AF_BLUE_STRING_GEORGIAN_NUSKHURI_BOTTOM = 1813,
|
||||
AF_BLUE_STRING_GEORGIAN_NUSKHURI_ASCENDER = 1845,
|
||||
AF_BLUE_STRING_GEORGIAN_NUSKHURI_DESCENDER = 1877,
|
||||
AF_BLUE_STRING_GEORGIAN_MTAVRULI_TOP = 1909,
|
||||
AF_BLUE_STRING_GEORGIAN_MTAVRULI_BOTTOM = 1941,
|
||||
AF_BLUE_STRING_GLAGOLITIC_CAPITAL_TOP = 1973,
|
||||
AF_BLUE_STRING_GLAGOLITIC_CAPITAL_BOTTOM = 2005,
|
||||
AF_BLUE_STRING_GLAGOLITIC_SMALL_TOP = 2037,
|
||||
AF_BLUE_STRING_GLAGOLITIC_SMALL_BOTTOM = 2069,
|
||||
AF_BLUE_STRING_GOTHIC_TOP = 2101,
|
||||
AF_BLUE_STRING_GOTHIC_BOTTOM = 2141,
|
||||
AF_BLUE_STRING_GREEK_CAPITAL_TOP = 2161,
|
||||
AF_BLUE_STRING_GREEK_CAPITAL_BOTTOM = 2182,
|
||||
AF_BLUE_STRING_GREEK_SMALL_BETA_TOP = 2200,
|
||||
AF_BLUE_STRING_GREEK_SMALL = 2218,
|
||||
AF_BLUE_STRING_GREEK_SMALL_DESCENDER = 2242,
|
||||
AF_BLUE_STRING_GUJARATI_TOP = 2266,
|
||||
AF_BLUE_STRING_GUJARATI_BOTTOM = 2298,
|
||||
AF_BLUE_STRING_GUJARATI_ASCENDER = 2330,
|
||||
AF_BLUE_STRING_GUJARATI_DESCENDER = 2380,
|
||||
AF_BLUE_STRING_GUJARATI_DIGIT_TOP = 2413,
|
||||
AF_BLUE_STRING_GURMUKHI_BASE = 2433,
|
||||
AF_BLUE_STRING_GURMUKHI_HEAD = 2465,
|
||||
AF_BLUE_STRING_GURMUKHI_TOP = 2497,
|
||||
AF_BLUE_STRING_GURMUKHI_BOTTOM = 2529,
|
||||
AF_BLUE_STRING_GURMUKHI_DIGIT_TOP = 2561,
|
||||
AF_BLUE_STRING_HEBREW_TOP = 2581,
|
||||
AF_BLUE_STRING_HEBREW_BOTTOM = 2605,
|
||||
AF_BLUE_STRING_HEBREW_DESCENDER = 2623,
|
||||
AF_BLUE_STRING_KANNADA_TOP = 2638,
|
||||
AF_BLUE_STRING_KANNADA_BOTTOM = 2682,
|
||||
AF_BLUE_STRING_KAYAH_LI_TOP = 2714,
|
||||
AF_BLUE_STRING_KAYAH_LI_BOTTOM = 2738,
|
||||
AF_BLUE_STRING_KAYAH_LI_ASCENDER = 2758,
|
||||
AF_BLUE_STRING_KAYAH_LI_DESCENDER = 2766,
|
||||
AF_BLUE_STRING_KAYAH_LI_LARGE_DESCENDER = 2778,
|
||||
AF_BLUE_STRING_KHMER_TOP = 2799,
|
||||
AF_BLUE_STRING_KHMER_SUBSCRIPT_TOP = 2823,
|
||||
AF_BLUE_STRING_KHMER_BOTTOM = 2863,
|
||||
AF_BLUE_STRING_KHMER_DESCENDER = 2895,
|
||||
AF_BLUE_STRING_KHMER_LARGE_DESCENDER = 2929,
|
||||
AF_BLUE_STRING_KHMER_SYMBOLS_WAXING_TOP = 3016,
|
||||
AF_BLUE_STRING_KHMER_SYMBOLS_WANING_BOTTOM = 3024,
|
||||
AF_BLUE_STRING_LAO_TOP = 3032,
|
||||
AF_BLUE_STRING_LAO_BOTTOM = 3064,
|
||||
AF_BLUE_STRING_LAO_ASCENDER = 3096,
|
||||
AF_BLUE_STRING_LAO_LARGE_ASCENDER = 3112,
|
||||
AF_BLUE_STRING_LAO_DESCENDER = 3124,
|
||||
AF_BLUE_STRING_LATIN_CAPITAL_TOP = 3148,
|
||||
AF_BLUE_STRING_LATIN_CAPITAL_BOTTOM = 3164,
|
||||
AF_BLUE_STRING_LATIN_SMALL_F_TOP = 3180,
|
||||
AF_BLUE_STRING_LATIN_SMALL_TOP = 3194,
|
||||
AF_BLUE_STRING_LATIN_SMALL_BOTTOM = 3210,
|
||||
AF_BLUE_STRING_LATIN_SMALL_DESCENDER = 3226,
|
||||
AF_BLUE_STRING_LATIN_SUBS_CAPITAL_TOP = 3236,
|
||||
AF_BLUE_STRING_LATIN_SUBS_CAPITAL_BOTTOM = 3256,
|
||||
AF_BLUE_STRING_LATIN_SUBS_SMALL_F_TOP = 3276,
|
||||
AF_BLUE_STRING_LATIN_SUBS_SMALL = 3296,
|
||||
AF_BLUE_STRING_LATIN_SUBS_SMALL_DESCENDER = 3332,
|
||||
AF_BLUE_STRING_LATIN_SUPS_CAPITAL_TOP = 3352,
|
||||
AF_BLUE_STRING_LATIN_SUPS_CAPITAL_BOTTOM = 3383,
|
||||
AF_BLUE_STRING_LATIN_SUPS_SMALL_F_TOP = 3412,
|
||||
AF_BLUE_STRING_LATIN_SUPS_SMALL = 3438,
|
||||
AF_BLUE_STRING_LATIN_SUPS_SMALL_DESCENDER = 3463,
|
||||
AF_BLUE_STRING_LISU_TOP = 3474,
|
||||
AF_BLUE_STRING_LISU_BOTTOM = 3506,
|
||||
AF_BLUE_STRING_MALAYALAM_TOP = 3538,
|
||||
AF_BLUE_STRING_MALAYALAM_BOTTOM = 3582,
|
||||
AF_BLUE_STRING_MYANMAR_TOP = 3614,
|
||||
AF_BLUE_STRING_MYANMAR_BOTTOM = 3646,
|
||||
AF_BLUE_STRING_MYANMAR_ASCENDER = 3678,
|
||||
AF_BLUE_STRING_MYANMAR_DESCENDER = 3706,
|
||||
AF_BLUE_STRING_NKO_TOP = 3738,
|
||||
AF_BLUE_STRING_NKO_BOTTOM = 3762,
|
||||
AF_BLUE_STRING_NKO_SMALL_TOP = 3777,
|
||||
AF_BLUE_STRING_NKO_SMALL_BOTTOM = 3786,
|
||||
AF_BLUE_STRING_OL_CHIKI = 3798,
|
||||
AF_BLUE_STRING_OLD_TURKIC_TOP = 3822,
|
||||
AF_BLUE_STRING_OLD_TURKIC_BOTTOM = 3837,
|
||||
AF_BLUE_STRING_OSAGE_CAPITAL_TOP = 3857,
|
||||
AF_BLUE_STRING_OSAGE_CAPITAL_BOTTOM = 3897,
|
||||
AF_BLUE_STRING_OSAGE_CAPITAL_DESCENDER = 3927,
|
||||
AF_BLUE_STRING_OSAGE_SMALL_TOP = 3942,
|
||||
AF_BLUE_STRING_OSAGE_SMALL_BOTTOM = 3982,
|
||||
AF_BLUE_STRING_OSAGE_SMALL_ASCENDER = 4022,
|
||||
AF_BLUE_STRING_OSAGE_SMALL_DESCENDER = 4047,
|
||||
AF_BLUE_STRING_OSMANYA_TOP = 4062,
|
||||
AF_BLUE_STRING_OSMANYA_BOTTOM = 4102,
|
||||
AF_BLUE_STRING_SAURASHTRA_TOP = 4142,
|
||||
AF_BLUE_STRING_SAURASHTRA_BOTTOM = 4174,
|
||||
AF_BLUE_STRING_SHAVIAN_TOP = 4194,
|
||||
AF_BLUE_STRING_SHAVIAN_BOTTOM = 4204,
|
||||
AF_BLUE_STRING_SHAVIAN_DESCENDER = 4229,
|
||||
AF_BLUE_STRING_SHAVIAN_SMALL_TOP = 4239,
|
||||
AF_BLUE_STRING_SHAVIAN_SMALL_BOTTOM = 4274,
|
||||
AF_BLUE_STRING_SINHALA_TOP = 4289,
|
||||
AF_BLUE_STRING_SINHALA_BOTTOM = 4321,
|
||||
AF_BLUE_STRING_SINHALA_DESCENDER = 4353,
|
||||
AF_BLUE_STRING_SUNDANESE_TOP = 4397,
|
||||
AF_BLUE_STRING_SUNDANESE_BOTTOM = 4421,
|
||||
AF_BLUE_STRING_SUNDANESE_DESCENDER = 4453,
|
||||
AF_BLUE_STRING_TAI_VIET_TOP = 4461,
|
||||
AF_BLUE_STRING_TAI_VIET_BOTTOM = 4481,
|
||||
AF_BLUE_STRING_TAMIL_TOP = 4493,
|
||||
AF_BLUE_STRING_TAMIL_BOTTOM = 4525,
|
||||
AF_BLUE_STRING_TELUGU_TOP = 4557,
|
||||
AF_BLUE_STRING_TELUGU_BOTTOM = 4585,
|
||||
AF_BLUE_STRING_THAI_TOP = 4613,
|
||||
AF_BLUE_STRING_THAI_BOTTOM = 4637,
|
||||
AF_BLUE_STRING_THAI_ASCENDER = 4665,
|
||||
AF_BLUE_STRING_THAI_LARGE_ASCENDER = 4677,
|
||||
AF_BLUE_STRING_THAI_DESCENDER = 4689,
|
||||
AF_BLUE_STRING_THAI_LARGE_DESCENDER = 4705,
|
||||
AF_BLUE_STRING_THAI_DIGIT_TOP = 4713,
|
||||
AF_BLUE_STRING_TIFINAGH = 4725,
|
||||
AF_BLUE_STRING_VAI_TOP = 4757,
|
||||
AF_BLUE_STRING_VAI_BOTTOM = 4789,
|
||||
af_blue_1_1 = 4820,
|
||||
#ifdef AF_CONFIG_OPTION_CJK
|
||||
AF_BLUE_STRING_CJK_TOP = af_blue_1_1 + 1,
|
||||
AF_BLUE_STRING_CJK_BOTTOM = af_blue_1_1 + 203,
|
||||
af_blue_1_1_1 = af_blue_1_1 + 404,
|
||||
#ifdef AF_CONFIG_OPTION_CJK_BLUE_HANI_VERT
|
||||
AF_BLUE_STRING_CJK_LEFT = af_blue_1_1_1 + 1,
|
||||
AF_BLUE_STRING_CJK_RIGHT = af_blue_1_1_1 + 204,
|
||||
af_blue_1_1_2 = af_blue_1_1_1 + 405,
|
||||
#else
|
||||
af_blue_1_1_2 = af_blue_1_1_1 + 0,
|
||||
#endif /* AF_CONFIG_OPTION_CJK_BLUE_HANI_VERT */
|
||||
af_blue_1_2 = af_blue_1_1_2 + 0,
|
||||
#else
|
||||
af_blue_1_2 = af_blue_1_1 + 0,
|
||||
#endif /* AF_CONFIG_OPTION_CJK */
|
||||
|
||||
|
||||
AF_BLUE_STRING_MAX /* do not remove */
|
||||
|
||||
} AF_Blue_String;
|
||||
|
||||
|
||||
FT_LOCAL_ARRAY( char )
|
||||
af_blue_strings[];
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/***** *****/
|
||||
/***** B L U E S T R I N G S E T S *****/
|
||||
/***** *****/
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
|
||||
/* The next level is to group blue strings into style-specific sets. */
|
||||
|
||||
|
||||
/* Properties are specific to a writing system. We assume that a given */
|
||||
/* blue string can't be used in more than a single writing system, which */
|
||||
/* is a safe bet. */
|
||||
#define AF_BLUE_PROPERTY_LATIN_TOP ( 1U << 0 ) /* must have value 1 */
|
||||
#define AF_BLUE_PROPERTY_LATIN_SUB_TOP ( 1U << 1 )
|
||||
#define AF_BLUE_PROPERTY_LATIN_NEUTRAL ( 1U << 2 )
|
||||
#define AF_BLUE_PROPERTY_LATIN_X_HEIGHT ( 1U << 3 )
|
||||
#define AF_BLUE_PROPERTY_LATIN_LONG ( 1U << 4 )
|
||||
|
||||
#define AF_BLUE_PROPERTY_CJK_TOP ( 1U << 0 ) /* must have value 1 */
|
||||
#define AF_BLUE_PROPERTY_CJK_HORIZ ( 1U << 1 ) /* must have value 2 */
|
||||
#define AF_BLUE_PROPERTY_CJK_RIGHT AF_BLUE_PROPERTY_CJK_TOP
|
||||
|
||||
|
||||
#define AF_BLUE_STRINGSET_MAX_LEN 8
|
||||
|
||||
/* The AF_Blue_Stringset enumeration values are offsets into the */
|
||||
/* `af_blue_stringsets' array. */
|
||||
|
||||
typedef enum AF_Blue_Stringset_
|
||||
{
|
||||
AF_BLUE_STRINGSET_ADLM = 0,
|
||||
AF_BLUE_STRINGSET_ARAB = 5,
|
||||
AF_BLUE_STRINGSET_ARMN = 9,
|
||||
AF_BLUE_STRINGSET_AVST = 16,
|
||||
AF_BLUE_STRINGSET_BAMU = 19,
|
||||
AF_BLUE_STRINGSET_BENG = 22,
|
||||
AF_BLUE_STRINGSET_BUHD = 27,
|
||||
AF_BLUE_STRINGSET_CAKM = 32,
|
||||
AF_BLUE_STRINGSET_CANS = 36,
|
||||
AF_BLUE_STRINGSET_CARI = 43,
|
||||
AF_BLUE_STRINGSET_CHER = 46,
|
||||
AF_BLUE_STRINGSET_COPT = 53,
|
||||
AF_BLUE_STRINGSET_CPRT = 58,
|
||||
AF_BLUE_STRINGSET_CYRL = 63,
|
||||
AF_BLUE_STRINGSET_DEVA = 69,
|
||||
AF_BLUE_STRINGSET_DSRT = 75,
|
||||
AF_BLUE_STRINGSET_ETHI = 80,
|
||||
AF_BLUE_STRINGSET_GEOR = 83,
|
||||
AF_BLUE_STRINGSET_GEOK = 90,
|
||||
AF_BLUE_STRINGSET_GLAG = 97,
|
||||
AF_BLUE_STRINGSET_GOTH = 102,
|
||||
AF_BLUE_STRINGSET_GREK = 105,
|
||||
AF_BLUE_STRINGSET_GUJR = 112,
|
||||
AF_BLUE_STRINGSET_GURU = 118,
|
||||
AF_BLUE_STRINGSET_HEBR = 124,
|
||||
AF_BLUE_STRINGSET_KALI = 128,
|
||||
AF_BLUE_STRINGSET_KHMR = 134,
|
||||
AF_BLUE_STRINGSET_KHMS = 140,
|
||||
AF_BLUE_STRINGSET_KNDA = 143,
|
||||
AF_BLUE_STRINGSET_LAO = 146,
|
||||
AF_BLUE_STRINGSET_LATN = 152,
|
||||
AF_BLUE_STRINGSET_LATB = 159,
|
||||
AF_BLUE_STRINGSET_LATP = 166,
|
||||
AF_BLUE_STRINGSET_LISU = 173,
|
||||
AF_BLUE_STRINGSET_MLYM = 176,
|
||||
AF_BLUE_STRINGSET_MYMR = 179,
|
||||
AF_BLUE_STRINGSET_NKOO = 184,
|
||||
AF_BLUE_STRINGSET_NONE = 189,
|
||||
AF_BLUE_STRINGSET_OLCK = 190,
|
||||
AF_BLUE_STRINGSET_ORKH = 193,
|
||||
AF_BLUE_STRINGSET_OSGE = 196,
|
||||
AF_BLUE_STRINGSET_OSMA = 204,
|
||||
AF_BLUE_STRINGSET_SAUR = 207,
|
||||
AF_BLUE_STRINGSET_SHAW = 210,
|
||||
AF_BLUE_STRINGSET_SINH = 216,
|
||||
AF_BLUE_STRINGSET_SUND = 220,
|
||||
AF_BLUE_STRINGSET_TAML = 224,
|
||||
AF_BLUE_STRINGSET_TAVT = 227,
|
||||
AF_BLUE_STRINGSET_TELU = 230,
|
||||
AF_BLUE_STRINGSET_TFNG = 233,
|
||||
AF_BLUE_STRINGSET_THAI = 236,
|
||||
AF_BLUE_STRINGSET_VAII = 244,
|
||||
af_blue_2_1 = 247,
|
||||
#ifdef AF_CONFIG_OPTION_CJK
|
||||
AF_BLUE_STRINGSET_HANI = af_blue_2_1 + 0,
|
||||
af_blue_2_1_1 = af_blue_2_1 + 2,
|
||||
#ifdef AF_CONFIG_OPTION_CJK_BLUE_HANI_VERT
|
||||
af_blue_2_1_2 = af_blue_2_1_1 + 2,
|
||||
#else
|
||||
af_blue_2_1_2 = af_blue_2_1_1 + 0,
|
||||
#endif /* AF_CONFIG_OPTION_CJK_BLUE_HANI_VERT */
|
||||
af_blue_2_2 = af_blue_2_1_2 + 1,
|
||||
#else
|
||||
af_blue_2_2 = af_blue_2_1 + 0,
|
||||
#endif /* AF_CONFIG_OPTION_CJK */
|
||||
|
||||
|
||||
AF_BLUE_STRINGSET_MAX /* do not remove */
|
||||
|
||||
} AF_Blue_Stringset;
|
||||
|
||||
|
||||
typedef struct AF_Blue_StringRec_
|
||||
{
|
||||
AF_Blue_String string;
|
||||
FT_UShort properties;
|
||||
|
||||
} AF_Blue_StringRec;
|
||||
|
||||
|
||||
FT_LOCAL_ARRAY( AF_Blue_StringRec )
|
||||
af_blue_stringsets[];
|
||||
|
||||
/* */
|
||||
|
||||
FT_END_HEADER
|
||||
|
||||
|
||||
#endif /* AFBLUE_H_ */
|
||||
|
||||
|
||||
/* END */
|
||||
146
vendor/FreeType2/src/autofit/afblue.hin
vendored
Normal file
146
vendor/FreeType2/src/autofit/afblue.hin
vendored
Normal file
|
|
@ -0,0 +1,146 @@
|
|||
/***************************************************************************/
|
||||
/* */
|
||||
/* afblue.h */
|
||||
/* */
|
||||
/* Auto-fitter data for blue strings (specification). */
|
||||
/* */
|
||||
/* Copyright 2013-2018 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. */
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
|
||||
#ifndef AFBLUE_H_
|
||||
#define AFBLUE_H_
|
||||
|
||||
|
||||
FT_BEGIN_HEADER
|
||||
|
||||
|
||||
/* an auxiliary macro to decode a UTF-8 character -- since we only use */
|
||||
/* hard-coded, self-converted data, no error checking is performed */
|
||||
#define GET_UTF8_CHAR( ch, p ) \
|
||||
do \
|
||||
{ \
|
||||
ch = (unsigned char)*p++; \
|
||||
if ( ch >= 0x80 ) \
|
||||
{ \
|
||||
FT_UInt len_; \
|
||||
\
|
||||
\
|
||||
if ( ch < 0xE0 ) \
|
||||
{ \
|
||||
len_ = 1; \
|
||||
ch &= 0x1F; \
|
||||
} \
|
||||
else if ( ch < 0xF0 ) \
|
||||
{ \
|
||||
len_ = 2; \
|
||||
ch &= 0x0F; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
len_ = 3; \
|
||||
ch &= 0x07; \
|
||||
} \
|
||||
\
|
||||
for ( ; len_ > 0; len_-- ) \
|
||||
ch = ( ch << 6 ) | ( *p++ & 0x3F ); \
|
||||
} \
|
||||
} while ( 0 )
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/***** *****/
|
||||
/***** B L U E S T R I N G S *****/
|
||||
/***** *****/
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
|
||||
/* At the bottommost level, we define strings for finding blue zones. */
|
||||
|
||||
|
||||
#define AF_BLUE_STRING_MAX_LEN @AF_BLUE_STRING_MAX_LEN@
|
||||
|
||||
/* The AF_Blue_String enumeration values are offsets into the */
|
||||
/* `af_blue_strings' array. */
|
||||
|
||||
typedef enum AF_Blue_String_
|
||||
{
|
||||
@AF_BLUE_STRING_ENUM@
|
||||
|
||||
AF_BLUE_STRING_MAX /* do not remove */
|
||||
|
||||
} AF_Blue_String;
|
||||
|
||||
|
||||
FT_LOCAL_ARRAY( char )
|
||||
af_blue_strings[];
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/***** *****/
|
||||
/***** B L U E S T R I N G S E T S *****/
|
||||
/***** *****/
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
|
||||
/* The next level is to group blue strings into style-specific sets. */
|
||||
|
||||
|
||||
/* Properties are specific to a writing system. We assume that a given */
|
||||
/* blue string can't be used in more than a single writing system, which */
|
||||
/* is a safe bet. */
|
||||
#define AF_BLUE_PROPERTY_LATIN_TOP ( 1U << 0 ) /* must have value 1 */
|
||||
#define AF_BLUE_PROPERTY_LATIN_SUB_TOP ( 1U << 1 )
|
||||
#define AF_BLUE_PROPERTY_LATIN_NEUTRAL ( 1U << 2 )
|
||||
#define AF_BLUE_PROPERTY_LATIN_X_HEIGHT ( 1U << 3 )
|
||||
#define AF_BLUE_PROPERTY_LATIN_LONG ( 1U << 4 )
|
||||
|
||||
#define AF_BLUE_PROPERTY_CJK_TOP ( 1U << 0 ) /* must have value 1 */
|
||||
#define AF_BLUE_PROPERTY_CJK_HORIZ ( 1U << 1 ) /* must have value 2 */
|
||||
#define AF_BLUE_PROPERTY_CJK_RIGHT AF_BLUE_PROPERTY_CJK_TOP
|
||||
|
||||
|
||||
#define AF_BLUE_STRINGSET_MAX_LEN @AF_BLUE_STRINGSET_MAX_LEN@
|
||||
|
||||
/* The AF_Blue_Stringset enumeration values are offsets into the */
|
||||
/* `af_blue_stringsets' array. */
|
||||
|
||||
typedef enum AF_Blue_Stringset_
|
||||
{
|
||||
@AF_BLUE_STRINGSET_ENUM@
|
||||
|
||||
AF_BLUE_STRINGSET_MAX /* do not remove */
|
||||
|
||||
} AF_Blue_Stringset;
|
||||
|
||||
|
||||
typedef struct AF_Blue_StringRec_
|
||||
{
|
||||
AF_Blue_String string;
|
||||
FT_UShort properties;
|
||||
|
||||
} AF_Blue_StringRec;
|
||||
|
||||
|
||||
FT_LOCAL_ARRAY( AF_Blue_StringRec )
|
||||
af_blue_stringsets[];
|
||||
|
||||
/* */
|
||||
|
||||
FT_END_HEADER
|
||||
|
||||
|
||||
#endif /* AFBLUE_H_ */
|
||||
|
||||
|
||||
/* END */
|
||||
2381
vendor/FreeType2/src/autofit/afcjk.c
vendored
Normal file
2381
vendor/FreeType2/src/autofit/afcjk.c
vendored
Normal file
File diff suppressed because it is too large
Load diff
141
vendor/FreeType2/src/autofit/afcjk.h
vendored
Normal file
141
vendor/FreeType2/src/autofit/afcjk.h
vendored
Normal file
|
|
@ -0,0 +1,141 @@
|
|||
/***************************************************************************/
|
||||
/* */
|
||||
/* afcjk.h */
|
||||
/* */
|
||||
/* Auto-fitter hinting routines for CJK writing system (specification). */
|
||||
/* */
|
||||
/* Copyright 2006-2018 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. */
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
|
||||
#ifndef AFCJK_H_
|
||||
#define AFCJK_H_
|
||||
|
||||
#include "afhints.h"
|
||||
#include "aflatin.h"
|
||||
|
||||
|
||||
FT_BEGIN_HEADER
|
||||
|
||||
|
||||
/* the CJK-specific writing system */
|
||||
|
||||
AF_DECLARE_WRITING_SYSTEM_CLASS( af_cjk_writing_system_class )
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/***** *****/
|
||||
/***** C J K G L O B A L M E T R I C S *****/
|
||||
/***** *****/
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
|
||||
|
||||
/*
|
||||
* CJK glyphs tend to fill the square. So we have both vertical and
|
||||
* horizontal blue zones. But some glyphs have flat bounding strokes that
|
||||
* leave some space between neighbour glyphs.
|
||||
*/
|
||||
|
||||
#define AF_CJK_IS_TOP_BLUE( b ) \
|
||||
( (b)->properties & AF_BLUE_PROPERTY_CJK_TOP )
|
||||
#define AF_CJK_IS_HORIZ_BLUE( b ) \
|
||||
( (b)->properties & AF_BLUE_PROPERTY_CJK_HORIZ )
|
||||
#define AF_CJK_IS_RIGHT_BLUE AF_CJK_IS_TOP_BLUE
|
||||
|
||||
#define AF_CJK_MAX_WIDTHS 16
|
||||
|
||||
|
||||
#define AF_CJK_BLUE_ACTIVE ( 1U << 0 ) /* zone height is <= 3/4px */
|
||||
#define AF_CJK_BLUE_TOP ( 1U << 1 ) /* result of AF_CJK_IS_TOP_BLUE */
|
||||
#define AF_CJK_BLUE_ADJUSTMENT ( 1U << 2 ) /* used for scale adjustment */
|
||||
/* optimization */
|
||||
|
||||
|
||||
typedef struct AF_CJKBlueRec_
|
||||
{
|
||||
AF_WidthRec ref;
|
||||
AF_WidthRec shoot; /* undershoot */
|
||||
FT_UInt flags;
|
||||
|
||||
} AF_CJKBlueRec, *AF_CJKBlue;
|
||||
|
||||
|
||||
typedef struct AF_CJKAxisRec_
|
||||
{
|
||||
FT_Fixed scale;
|
||||
FT_Pos delta;
|
||||
|
||||
FT_UInt width_count; /* number of used widths */
|
||||
AF_WidthRec widths[AF_CJK_MAX_WIDTHS]; /* widths array */
|
||||
FT_Pos edge_distance_threshold; /* used for creating edges */
|
||||
FT_Pos standard_width; /* the default stem thickness */
|
||||
FT_Bool extra_light; /* is standard width very light? */
|
||||
|
||||
/* used for horizontal metrics too for CJK */
|
||||
FT_Bool control_overshoot;
|
||||
FT_UInt blue_count;
|
||||
AF_CJKBlueRec blues[AF_BLUE_STRINGSET_MAX];
|
||||
|
||||
FT_Fixed org_scale;
|
||||
FT_Pos org_delta;
|
||||
|
||||
} AF_CJKAxisRec, *AF_CJKAxis;
|
||||
|
||||
|
||||
typedef struct AF_CJKMetricsRec_
|
||||
{
|
||||
AF_StyleMetricsRec root;
|
||||
FT_UInt units_per_em;
|
||||
AF_CJKAxisRec axis[AF_DIMENSION_MAX];
|
||||
|
||||
} AF_CJKMetricsRec, *AF_CJKMetrics;
|
||||
|
||||
|
||||
#ifdef AF_CONFIG_OPTION_CJK
|
||||
FT_LOCAL( FT_Error )
|
||||
af_cjk_metrics_init( AF_CJKMetrics metrics,
|
||||
FT_Face face );
|
||||
|
||||
FT_LOCAL( void )
|
||||
af_cjk_metrics_scale( AF_CJKMetrics metrics,
|
||||
AF_Scaler scaler );
|
||||
|
||||
FT_LOCAL( FT_Error )
|
||||
af_cjk_hints_init( AF_GlyphHints hints,
|
||||
AF_CJKMetrics metrics );
|
||||
|
||||
FT_LOCAL( FT_Error )
|
||||
af_cjk_hints_apply( FT_UInt glyph_index,
|
||||
AF_GlyphHints hints,
|
||||
FT_Outline* outline,
|
||||
AF_CJKMetrics metrics );
|
||||
|
||||
/* shared; called from afindic.c */
|
||||
FT_LOCAL( void )
|
||||
af_cjk_metrics_check_digits( AF_CJKMetrics metrics,
|
||||
FT_Face face );
|
||||
|
||||
FT_LOCAL( void )
|
||||
af_cjk_metrics_init_widths( AF_CJKMetrics metrics,
|
||||
FT_Face face );
|
||||
#endif /* AF_CONFIG_OPTION_CJK */
|
||||
|
||||
|
||||
/* */
|
||||
|
||||
FT_END_HEADER
|
||||
|
||||
#endif /* AFCJK_H_ */
|
||||
|
||||
|
||||
/* END */
|
||||
105
vendor/FreeType2/src/autofit/afcover.h
vendored
Normal file
105
vendor/FreeType2/src/autofit/afcover.h
vendored
Normal file
|
|
@ -0,0 +1,105 @@
|
|||
/***************************************************************************/
|
||||
/* */
|
||||
/* afcover.h */
|
||||
/* */
|
||||
/* Auto-fitter coverages (specification only). */
|
||||
/* */
|
||||
/* Copyright 2013-2018 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. */
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
|
||||
/* This header file can be included multiple times. */
|
||||
/* Define `COVERAGE' as needed. */
|
||||
|
||||
|
||||
/* Add new coverages here. The first and second arguments are the */
|
||||
/* coverage name in lowercase and uppercase, respectively, followed */
|
||||
/* by a description string. The last four arguments are the four */
|
||||
/* characters defining the corresponding OpenType feature. */
|
||||
|
||||
#if 0
|
||||
/* XXX: It's not possible to define blue zone characters in advance. */
|
||||
COVERAGE( alternative_fractions, ALTERNATIVE_FRACTIONS,
|
||||
"alternative fractions",
|
||||
'a', 'f', 'r', 'c' )
|
||||
#endif
|
||||
|
||||
COVERAGE( petite_capitals_from_capitals, PETITE_CAPITALS_FROM_CAPITALS,
|
||||
"petite capitals from capitals",
|
||||
'c', '2', 'c', 'p' )
|
||||
|
||||
COVERAGE( small_capitals_from_capitals, SMALL_CAPITALS_FROM_CAPITALS,
|
||||
"small capitals from capitals",
|
||||
'c', '2', 's', 'c' )
|
||||
|
||||
#if 0
|
||||
/* XXX: Only digits are in this coverage, however, both normal style */
|
||||
/* and oldstyle representation forms are possible. */
|
||||
COVERAGE( denominators, DENOMINATORS,
|
||||
"denominators",
|
||||
'd', 'n', 'o', 'm' )
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
/* XXX: It's not possible to define blue zone characters in advance. */
|
||||
COVERAGE( fractions, FRACTIONS,
|
||||
"fractions",
|
||||
'f', 'r', 'a', 'c' )
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
/* XXX: Only digits are in this coverage, however, both normal style */
|
||||
/* and oldstyle representation forms are possible. */
|
||||
COVERAGE( numerators, NUMERATORS,
|
||||
"numerators",
|
||||
'n', 'u', 'm', 'r' )
|
||||
#endif
|
||||
|
||||
COVERAGE( ordinals, ORDINALS,
|
||||
"ordinals",
|
||||
'o', 'r', 'd', 'n' )
|
||||
|
||||
COVERAGE( petite_capitals, PETITE_CAPITALS,
|
||||
"petite capitals",
|
||||
'p', 'c', 'a', 'p' )
|
||||
|
||||
COVERAGE( ruby, RUBY,
|
||||
"ruby",
|
||||
'r', 'u', 'b', 'y' )
|
||||
|
||||
COVERAGE( scientific_inferiors, SCIENTIFIC_INFERIORS,
|
||||
"scientific inferiors",
|
||||
's', 'i', 'n', 'f' )
|
||||
|
||||
COVERAGE( small_capitals, SMALL_CAPITALS,
|
||||
"small capitals",
|
||||
's', 'm', 'c', 'p' )
|
||||
|
||||
COVERAGE( subscript, SUBSCRIPT,
|
||||
"subscript",
|
||||
's', 'u', 'b', 's' )
|
||||
|
||||
COVERAGE( superscript, SUPERSCRIPT,
|
||||
"superscript",
|
||||
's', 'u', 'p', 's' )
|
||||
|
||||
COVERAGE( titling, TITLING,
|
||||
"titling",
|
||||
't', 'i', 't', 'l' )
|
||||
|
||||
#if 0
|
||||
/* to be always excluded */
|
||||
COVERAGE(nalt, 'n', 'a', 'l', 't'); /* Alternate Annotation Forms (?) */
|
||||
COVERAGE(ornm, 'o', 'r', 'n', 'm'); /* Ornaments (?) */
|
||||
#endif
|
||||
|
||||
|
||||
/* END */
|
||||
75
vendor/FreeType2/src/autofit/afdummy.c
vendored
Normal file
75
vendor/FreeType2/src/autofit/afdummy.c
vendored
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
/***************************************************************************/
|
||||
/* */
|
||||
/* afdummy.c */
|
||||
/* */
|
||||
/* Auto-fitter dummy routines to be used if no hinting should be */
|
||||
/* performed (body). */
|
||||
/* */
|
||||
/* Copyright 2003-2018 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 "afdummy.h"
|
||||
#include "afhints.h"
|
||||
#include "aferrors.h"
|
||||
|
||||
|
||||
static FT_Error
|
||||
af_dummy_hints_init( AF_GlyphHints hints,
|
||||
AF_StyleMetrics metrics )
|
||||
{
|
||||
af_glyph_hints_rescale( hints, metrics );
|
||||
|
||||
hints->x_scale = metrics->scaler.x_scale;
|
||||
hints->y_scale = metrics->scaler.y_scale;
|
||||
hints->x_delta = metrics->scaler.x_delta;
|
||||
hints->y_delta = metrics->scaler.y_delta;
|
||||
|
||||
return FT_Err_Ok;
|
||||
}
|
||||
|
||||
|
||||
static FT_Error
|
||||
af_dummy_hints_apply( FT_UInt glyph_index,
|
||||
AF_GlyphHints hints,
|
||||
FT_Outline* outline )
|
||||
{
|
||||
FT_Error error;
|
||||
|
||||
FT_UNUSED( glyph_index );
|
||||
|
||||
|
||||
error = af_glyph_hints_reload( hints, outline );
|
||||
if ( !error )
|
||||
af_glyph_hints_save( hints, outline );
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
AF_DEFINE_WRITING_SYSTEM_CLASS(
|
||||
af_dummy_writing_system_class,
|
||||
|
||||
AF_WRITING_SYSTEM_DUMMY,
|
||||
|
||||
sizeof ( AF_StyleMetricsRec ),
|
||||
|
||||
(AF_WritingSystem_InitMetricsFunc) NULL, /* style_metrics_init */
|
||||
(AF_WritingSystem_ScaleMetricsFunc)NULL, /* style_metrics_scale */
|
||||
(AF_WritingSystem_DoneMetricsFunc) NULL, /* style_metrics_done */
|
||||
(AF_WritingSystem_GetStdWidthsFunc)NULL, /* style_metrics_getstdw */
|
||||
|
||||
(AF_WritingSystem_InitHintsFunc) af_dummy_hints_init, /* style_hints_init */
|
||||
(AF_WritingSystem_ApplyHintsFunc) af_dummy_hints_apply /* style_hints_apply */
|
||||
)
|
||||
|
||||
|
||||
/* END */
|
||||
40
vendor/FreeType2/src/autofit/afdummy.h
vendored
Normal file
40
vendor/FreeType2/src/autofit/afdummy.h
vendored
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
/***************************************************************************/
|
||||
/* */
|
||||
/* afdummy.h */
|
||||
/* */
|
||||
/* Auto-fitter dummy routines to be used if no hinting should be */
|
||||
/* performed (specification). */
|
||||
/* */
|
||||
/* Copyright 2003-2018 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. */
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
|
||||
#ifndef AFDUMMY_H_
|
||||
#define AFDUMMY_H_
|
||||
|
||||
#include "aftypes.h"
|
||||
|
||||
|
||||
FT_BEGIN_HEADER
|
||||
|
||||
/* A dummy writing system used when no hinting should be performed. */
|
||||
|
||||
AF_DECLARE_WRITING_SYSTEM_CLASS( af_dummy_writing_system_class )
|
||||
|
||||
/* */
|
||||
|
||||
FT_END_HEADER
|
||||
|
||||
|
||||
#endif /* AFDUMMY_H_ */
|
||||
|
||||
|
||||
/* END */
|
||||
42
vendor/FreeType2/src/autofit/aferrors.h
vendored
Normal file
42
vendor/FreeType2/src/autofit/aferrors.h
vendored
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
/***************************************************************************/
|
||||
/* */
|
||||
/* aferrors.h */
|
||||
/* */
|
||||
/* Autofitter error codes (specification only). */
|
||||
/* */
|
||||
/* Copyright 2005-2018 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. */
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* This file is used to define the Autofitter error enumeration */
|
||||
/* constants. */
|
||||
/* */
|
||||
/*************************************************************************/
|
||||
|
||||
#ifndef AFERRORS_H_
|
||||
#define AFERRORS_H_
|
||||
|
||||
#include FT_MODULE_ERRORS_H
|
||||
|
||||
#undef FTERRORS_H_
|
||||
|
||||
#undef FT_ERR_PREFIX
|
||||
#define FT_ERR_PREFIX AF_Err_
|
||||
#define FT_ERR_BASE FT_Mod_Err_Autofit
|
||||
|
||||
#include FT_ERRORS_H
|
||||
|
||||
#endif /* AFERRORS_H_ */
|
||||
|
||||
|
||||
/* END */
|
||||
503
vendor/FreeType2/src/autofit/afglobal.c
vendored
Normal file
503
vendor/FreeType2/src/autofit/afglobal.c
vendored
Normal file
|
|
@ -0,0 +1,503 @@
|
|||
/***************************************************************************/
|
||||
/* */
|
||||
/* afglobal.c */
|
||||
/* */
|
||||
/* Auto-fitter routines to compute global hinting values (body). */
|
||||
/* */
|
||||
/* Copyright 2003-2018 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 "afglobal.h"
|
||||
#include "afranges.h"
|
||||
#include "afshaper.h"
|
||||
#include FT_INTERNAL_DEBUG_H
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* 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_afglobal
|
||||
|
||||
|
||||
/* get writing system specific header files */
|
||||
#undef WRITING_SYSTEM
|
||||
#define WRITING_SYSTEM( ws, WS ) /* empty */
|
||||
#include "afwrtsys.h"
|
||||
|
||||
#include "aferrors.h"
|
||||
#include "afpic.h"
|
||||
|
||||
|
||||
#undef SCRIPT
|
||||
#define SCRIPT( s, S, d, h, H, ss ) \
|
||||
AF_DEFINE_SCRIPT_CLASS( \
|
||||
af_ ## s ## _script_class, \
|
||||
AF_SCRIPT_ ## S, \
|
||||
af_ ## s ## _uniranges, \
|
||||
af_ ## s ## _nonbase_uniranges, \
|
||||
AF_ ## H, \
|
||||
ss )
|
||||
|
||||
#include "afscript.h"
|
||||
|
||||
|
||||
#undef STYLE
|
||||
#define STYLE( s, S, d, ws, sc, ss, c ) \
|
||||
AF_DEFINE_STYLE_CLASS( \
|
||||
af_ ## s ## _style_class, \
|
||||
AF_STYLE_ ## S, \
|
||||
ws, \
|
||||
sc, \
|
||||
ss, \
|
||||
c )
|
||||
|
||||
#include "afstyles.h"
|
||||
|
||||
|
||||
#ifndef FT_CONFIG_OPTION_PIC
|
||||
|
||||
#undef WRITING_SYSTEM
|
||||
#define WRITING_SYSTEM( ws, WS ) \
|
||||
&af_ ## ws ## _writing_system_class,
|
||||
|
||||
FT_LOCAL_ARRAY_DEF( AF_WritingSystemClass )
|
||||
af_writing_system_classes[] =
|
||||
{
|
||||
|
||||
#include "afwrtsys.h"
|
||||
|
||||
NULL /* do not remove */
|
||||
};
|
||||
|
||||
|
||||
#undef SCRIPT
|
||||
#define SCRIPT( s, S, d, h, H, ss ) \
|
||||
&af_ ## s ## _script_class,
|
||||
|
||||
FT_LOCAL_ARRAY_DEF( AF_ScriptClass )
|
||||
af_script_classes[] =
|
||||
{
|
||||
|
||||
#include "afscript.h"
|
||||
|
||||
NULL /* do not remove */
|
||||
};
|
||||
|
||||
|
||||
#undef STYLE
|
||||
#define STYLE( s, S, d, ws, sc, ss, c ) \
|
||||
&af_ ## s ## _style_class,
|
||||
|
||||
FT_LOCAL_ARRAY_DEF( AF_StyleClass )
|
||||
af_style_classes[] =
|
||||
{
|
||||
|
||||
#include "afstyles.h"
|
||||
|
||||
NULL /* do not remove */
|
||||
};
|
||||
|
||||
#endif /* !FT_CONFIG_OPTION_PIC */
|
||||
|
||||
|
||||
#ifdef FT_DEBUG_LEVEL_TRACE
|
||||
|
||||
#undef STYLE
|
||||
#define STYLE( s, S, d, ws, sc, ss, c ) #s,
|
||||
|
||||
FT_LOCAL_ARRAY_DEF( char* )
|
||||
af_style_names[] =
|
||||
{
|
||||
|
||||
#include "afstyles.h"
|
||||
|
||||
};
|
||||
|
||||
#endif /* FT_DEBUG_LEVEL_TRACE */
|
||||
|
||||
|
||||
/* Compute the style index of each glyph within a given face. */
|
||||
|
||||
static FT_Error
|
||||
af_face_globals_compute_style_coverage( AF_FaceGlobals globals )
|
||||
{
|
||||
FT_Error error;
|
||||
FT_Face face = globals->face;
|
||||
FT_CharMap old_charmap = face->charmap;
|
||||
FT_UShort* gstyles = globals->glyph_styles;
|
||||
FT_UInt ss;
|
||||
FT_UInt i;
|
||||
FT_UInt dflt = ~0U; /* a non-valid value */
|
||||
|
||||
|
||||
/* the value AF_STYLE_UNASSIGNED means `uncovered glyph' */
|
||||
for ( i = 0; i < (FT_UInt)globals->glyph_count; i++ )
|
||||
gstyles[i] = AF_STYLE_UNASSIGNED;
|
||||
|
||||
error = FT_Select_Charmap( face, FT_ENCODING_UNICODE );
|
||||
if ( error )
|
||||
{
|
||||
/*
|
||||
* Ignore this error; we simply use the fallback style.
|
||||
* XXX: Shouldn't we rather disable hinting?
|
||||
*/
|
||||
error = FT_Err_Ok;
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
/* scan each style in a Unicode charmap */
|
||||
for ( ss = 0; AF_STYLE_CLASSES_GET[ss]; ss++ )
|
||||
{
|
||||
AF_StyleClass style_class =
|
||||
AF_STYLE_CLASSES_GET[ss];
|
||||
AF_ScriptClass script_class =
|
||||
AF_SCRIPT_CLASSES_GET[style_class->script];
|
||||
AF_Script_UniRange range;
|
||||
|
||||
|
||||
if ( !script_class->script_uni_ranges )
|
||||
continue;
|
||||
|
||||
/*
|
||||
* Scan all Unicode points in the range and set the corresponding
|
||||
* glyph style index.
|
||||
*/
|
||||
if ( style_class->coverage == AF_COVERAGE_DEFAULT )
|
||||
{
|
||||
if ( (FT_UInt)style_class->script ==
|
||||
globals->module->default_script )
|
||||
dflt = ss;
|
||||
|
||||
for ( range = script_class->script_uni_ranges;
|
||||
range->first != 0;
|
||||
range++ )
|
||||
{
|
||||
FT_ULong charcode = range->first;
|
||||
FT_UInt gindex;
|
||||
|
||||
|
||||
gindex = FT_Get_Char_Index( face, charcode );
|
||||
|
||||
if ( gindex != 0 &&
|
||||
gindex < (FT_ULong)globals->glyph_count &&
|
||||
( gstyles[gindex] & AF_STYLE_MASK ) == AF_STYLE_UNASSIGNED )
|
||||
gstyles[gindex] = (FT_UShort)ss;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
charcode = FT_Get_Next_Char( face, charcode, &gindex );
|
||||
|
||||
if ( gindex == 0 || charcode > range->last )
|
||||
break;
|
||||
|
||||
if ( gindex < (FT_ULong)globals->glyph_count &&
|
||||
( gstyles[gindex] & AF_STYLE_MASK ) == AF_STYLE_UNASSIGNED )
|
||||
gstyles[gindex] = (FT_UShort)ss;
|
||||
}
|
||||
}
|
||||
|
||||
/* do the same for the script's non-base characters */
|
||||
for ( range = script_class->script_uni_nonbase_ranges;
|
||||
range->first != 0;
|
||||
range++ )
|
||||
{
|
||||
FT_ULong charcode = range->first;
|
||||
FT_UInt gindex;
|
||||
|
||||
|
||||
gindex = FT_Get_Char_Index( face, charcode );
|
||||
|
||||
if ( gindex != 0 &&
|
||||
gindex < (FT_ULong)globals->glyph_count &&
|
||||
( gstyles[gindex] & AF_STYLE_MASK ) == (FT_UShort)ss )
|
||||
gstyles[gindex] |= AF_NONBASE;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
charcode = FT_Get_Next_Char( face, charcode, &gindex );
|
||||
|
||||
if ( gindex == 0 || charcode > range->last )
|
||||
break;
|
||||
|
||||
if ( gindex < (FT_ULong)globals->glyph_count &&
|
||||
( gstyles[gindex] & AF_STYLE_MASK ) == (FT_UShort)ss )
|
||||
gstyles[gindex] |= AF_NONBASE;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* get glyphs not directly addressable by cmap */
|
||||
af_shaper_get_coverage( globals, style_class, gstyles, 0 );
|
||||
}
|
||||
}
|
||||
|
||||
/* handle the remaining default OpenType features ... */
|
||||
for ( ss = 0; AF_STYLE_CLASSES_GET[ss]; ss++ )
|
||||
{
|
||||
AF_StyleClass style_class = AF_STYLE_CLASSES_GET[ss];
|
||||
|
||||
|
||||
if ( style_class->coverage == AF_COVERAGE_DEFAULT )
|
||||
af_shaper_get_coverage( globals, style_class, gstyles, 0 );
|
||||
}
|
||||
|
||||
/* ... and finally the default OpenType features of the default script */
|
||||
af_shaper_get_coverage( globals, AF_STYLE_CLASSES_GET[dflt], gstyles, 1 );
|
||||
|
||||
/* 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 )
|
||||
gstyles[gindex] |= AF_DIGIT;
|
||||
}
|
||||
|
||||
Exit:
|
||||
/*
|
||||
* By default, all uncovered glyphs are set to the fallback style.
|
||||
* XXX: Shouldn't we disable hinting or do something similar?
|
||||
*/
|
||||
if ( globals->module->fallback_style != AF_STYLE_UNASSIGNED )
|
||||
{
|
||||
FT_Long nn;
|
||||
|
||||
|
||||
for ( nn = 0; nn < globals->glyph_count; nn++ )
|
||||
{
|
||||
if ( ( gstyles[nn] & AF_STYLE_MASK ) == AF_STYLE_UNASSIGNED )
|
||||
{
|
||||
gstyles[nn] &= ~AF_STYLE_MASK;
|
||||
gstyles[nn] |= globals->module->fallback_style;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef FT_DEBUG_LEVEL_TRACE
|
||||
|
||||
FT_TRACE4(( "\n"
|
||||
"style coverage\n"
|
||||
"==============\n"
|
||||
"\n" ));
|
||||
|
||||
for ( ss = 0; AF_STYLE_CLASSES_GET[ss]; ss++ )
|
||||
{
|
||||
AF_StyleClass style_class = AF_STYLE_CLASSES_GET[ss];
|
||||
FT_UInt count = 0;
|
||||
FT_Long idx;
|
||||
|
||||
|
||||
FT_TRACE4(( "%s:\n", af_style_names[style_class->style] ));
|
||||
|
||||
for ( idx = 0; idx < globals->glyph_count; idx++ )
|
||||
{
|
||||
if ( ( gstyles[idx] & AF_STYLE_MASK ) == style_class->style )
|
||||
{
|
||||
if ( !( count % 10 ) )
|
||||
FT_TRACE4(( " " ));
|
||||
|
||||
FT_TRACE4(( " %d", idx ));
|
||||
count++;
|
||||
|
||||
if ( !( count % 10 ) )
|
||||
FT_TRACE4(( "\n" ));
|
||||
}
|
||||
}
|
||||
|
||||
if ( !count )
|
||||
FT_TRACE4(( " (none)\n" ));
|
||||
if ( count % 10 )
|
||||
FT_TRACE4(( "\n" ));
|
||||
}
|
||||
|
||||
#endif /* FT_DEBUG_LEVEL_TRACE */
|
||||
|
||||
FT_Set_Charmap( face, old_charmap );
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
FT_LOCAL_DEF( FT_Error )
|
||||
af_face_globals_new( FT_Face face,
|
||||
AF_FaceGlobals *aglobals,
|
||||
AF_Module module )
|
||||
{
|
||||
FT_Error error;
|
||||
FT_Memory memory;
|
||||
AF_FaceGlobals globals = NULL;
|
||||
|
||||
|
||||
memory = face->memory;
|
||||
|
||||
/* we allocate an AF_FaceGlobals structure together */
|
||||
/* with the glyph_styles array */
|
||||
if ( FT_ALLOC( globals,
|
||||
sizeof ( *globals ) +
|
||||
(FT_ULong)face->num_glyphs * sizeof ( FT_UShort ) ) )
|
||||
goto Exit;
|
||||
|
||||
globals->face = face;
|
||||
globals->glyph_count = face->num_glyphs;
|
||||
/* right after the globals structure come the glyph styles */
|
||||
globals->glyph_styles = (FT_UShort*)( globals + 1 );
|
||||
globals->module = module;
|
||||
globals->stem_darkening_for_ppem = 0;
|
||||
globals->darken_x = 0;
|
||||
globals->darken_y = 0;
|
||||
globals->standard_vertical_width = 0;
|
||||
globals->standard_horizontal_width = 0;
|
||||
globals->scale_down_factor = 0;
|
||||
|
||||
#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ
|
||||
globals->hb_font = hb_ft_font_create( face, NULL );
|
||||
globals->hb_buf = hb_buffer_create();
|
||||
#endif
|
||||
|
||||
error = af_face_globals_compute_style_coverage( globals );
|
||||
if ( error )
|
||||
{
|
||||
af_face_globals_free( globals );
|
||||
globals = NULL;
|
||||
}
|
||||
else
|
||||
globals->increase_x_height = AF_PROP_INCREASE_X_HEIGHT_MAX;
|
||||
|
||||
Exit:
|
||||
*aglobals = globals;
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
FT_LOCAL_DEF( void )
|
||||
af_face_globals_free( AF_FaceGlobals globals )
|
||||
{
|
||||
if ( globals )
|
||||
{
|
||||
FT_Memory memory = globals->face->memory;
|
||||
FT_UInt nn;
|
||||
|
||||
|
||||
for ( nn = 0; nn < AF_STYLE_MAX; nn++ )
|
||||
{
|
||||
if ( globals->metrics[nn] )
|
||||
{
|
||||
AF_StyleClass style_class =
|
||||
AF_STYLE_CLASSES_GET[nn];
|
||||
AF_WritingSystemClass writing_system_class =
|
||||
AF_WRITING_SYSTEM_CLASSES_GET[style_class->writing_system];
|
||||
|
||||
|
||||
if ( writing_system_class->style_metrics_done )
|
||||
writing_system_class->style_metrics_done( globals->metrics[nn] );
|
||||
|
||||
FT_FREE( globals->metrics[nn] );
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ
|
||||
hb_font_destroy( globals->hb_font );
|
||||
hb_buffer_destroy( globals->hb_buf );
|
||||
#endif
|
||||
|
||||
/* no need to free `globals->glyph_styles'; */
|
||||
/* it is part of the `globals' array */
|
||||
FT_FREE( globals );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FT_LOCAL_DEF( FT_Error )
|
||||
af_face_globals_get_metrics( AF_FaceGlobals globals,
|
||||
FT_UInt gindex,
|
||||
FT_UInt options,
|
||||
AF_StyleMetrics *ametrics )
|
||||
{
|
||||
AF_StyleMetrics metrics = NULL;
|
||||
|
||||
AF_Style style = (AF_Style)options;
|
||||
AF_WritingSystemClass writing_system_class;
|
||||
AF_StyleClass style_class;
|
||||
|
||||
FT_Error error = FT_Err_Ok;
|
||||
|
||||
|
||||
if ( gindex >= (FT_ULong)globals->glyph_count )
|
||||
{
|
||||
error = FT_THROW( Invalid_Argument );
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
/* if we have a forced style (via `options'), use it, */
|
||||
/* otherwise look into `glyph_styles' array */
|
||||
if ( style == AF_STYLE_NONE_DFLT || style + 1 >= AF_STYLE_MAX )
|
||||
style = (AF_Style)( globals->glyph_styles[gindex] &
|
||||
AF_STYLE_UNASSIGNED );
|
||||
|
||||
style_class = AF_STYLE_CLASSES_GET[style];
|
||||
writing_system_class = AF_WRITING_SYSTEM_CLASSES_GET
|
||||
[style_class->writing_system];
|
||||
|
||||
metrics = globals->metrics[style];
|
||||
if ( !metrics )
|
||||
{
|
||||
/* create the global metrics object if necessary */
|
||||
FT_Memory memory = globals->face->memory;
|
||||
|
||||
|
||||
if ( FT_ALLOC( metrics, writing_system_class->style_metrics_size ) )
|
||||
goto Exit;
|
||||
|
||||
metrics->style_class = style_class;
|
||||
metrics->globals = globals;
|
||||
|
||||
if ( writing_system_class->style_metrics_init )
|
||||
{
|
||||
error = writing_system_class->style_metrics_init( metrics,
|
||||
globals->face );
|
||||
if ( error )
|
||||
{
|
||||
if ( writing_system_class->style_metrics_done )
|
||||
writing_system_class->style_metrics_done( metrics );
|
||||
|
||||
FT_FREE( metrics );
|
||||
goto Exit;
|
||||
}
|
||||
}
|
||||
|
||||
globals->metrics[style] = metrics;
|
||||
}
|
||||
|
||||
Exit:
|
||||
*ametrics = metrics;
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
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_styles[gindex] & AF_DIGIT );
|
||||
|
||||
return (FT_Bool)0;
|
||||
}
|
||||
|
||||
|
||||
/* END */
|
||||
173
vendor/FreeType2/src/autofit/afglobal.h
vendored
Normal file
173
vendor/FreeType2/src/autofit/afglobal.h
vendored
Normal file
|
|
@ -0,0 +1,173 @@
|
|||
/***************************************************************************/
|
||||
/* */
|
||||
/* afglobal.h */
|
||||
/* */
|
||||
/* Auto-fitter routines to compute global hinting values */
|
||||
/* (specification). */
|
||||
/* */
|
||||
/* Copyright 2003-2018 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. */
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
|
||||
#ifndef AFGLOBAL_H_
|
||||
#define AFGLOBAL_H_
|
||||
|
||||
|
||||
#include "aftypes.h"
|
||||
#include "afmodule.h"
|
||||
#include "afshaper.h"
|
||||
|
||||
|
||||
FT_BEGIN_HEADER
|
||||
|
||||
|
||||
FT_LOCAL_ARRAY( AF_WritingSystemClass )
|
||||
af_writing_system_classes[];
|
||||
|
||||
|
||||
#undef SCRIPT
|
||||
#define SCRIPT( s, S, d, h, H, ss ) \
|
||||
AF_DECLARE_SCRIPT_CLASS( af_ ## s ## _script_class )
|
||||
|
||||
#include "afscript.h"
|
||||
|
||||
FT_LOCAL_ARRAY( AF_ScriptClass )
|
||||
af_script_classes[];
|
||||
|
||||
|
||||
#undef STYLE
|
||||
#define STYLE( s, S, d, ws, sc, ss, c ) \
|
||||
AF_DECLARE_STYLE_CLASS( af_ ## s ## _style_class )
|
||||
|
||||
#include "afstyles.h"
|
||||
|
||||
FT_LOCAL_ARRAY( AF_StyleClass )
|
||||
af_style_classes[];
|
||||
|
||||
|
||||
#ifdef FT_DEBUG_LEVEL_TRACE
|
||||
FT_LOCAL_ARRAY( char* )
|
||||
af_style_names[];
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Default values and flags for both autofitter globals (found in
|
||||
* AF_ModuleRec) and face globals (in AF_FaceGlobalsRec).
|
||||
*/
|
||||
|
||||
/* index of fallback style in `af_style_classes' */
|
||||
#ifdef AF_CONFIG_OPTION_CJK
|
||||
#define AF_STYLE_FALLBACK AF_STYLE_HANI_DFLT
|
||||
#else
|
||||
#define AF_STYLE_FALLBACK AF_STYLE_NONE_DFLT
|
||||
#endif
|
||||
/* default script for OpenType; ignored if HarfBuzz isn't used */
|
||||
#define AF_SCRIPT_DEFAULT AF_SCRIPT_LATN
|
||||
|
||||
/* a bit mask for AF_DIGIT and AF_NONBASE */
|
||||
#define AF_STYLE_MASK 0x3FFF
|
||||
/* an uncovered glyph */
|
||||
#define AF_STYLE_UNASSIGNED AF_STYLE_MASK
|
||||
|
||||
/* if this flag is set, we have an ASCII digit */
|
||||
#define AF_DIGIT 0x8000U
|
||||
/* if this flag is set, we have a non-base character */
|
||||
#define AF_NONBASE 0x4000U
|
||||
|
||||
/* `increase-x-height' property */
|
||||
#define AF_PROP_INCREASE_X_HEIGHT_MIN 6
|
||||
#define AF_PROP_INCREASE_X_HEIGHT_MAX 0
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/***** *****/
|
||||
/***** F A C E G L O B A L S *****/
|
||||
/***** *****/
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
|
||||
|
||||
/*
|
||||
* Note that glyph_styles[] maps each glyph to an index into the
|
||||
* `af_style_classes' array.
|
||||
*
|
||||
*/
|
||||
typedef struct AF_FaceGlobalsRec_
|
||||
{
|
||||
FT_Face face;
|
||||
FT_Long glyph_count; /* same as face->num_glyphs */
|
||||
FT_UShort* glyph_styles;
|
||||
|
||||
#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ
|
||||
hb_font_t* hb_font;
|
||||
hb_buffer_t* hb_buf; /* for feature comparison */
|
||||
#endif
|
||||
|
||||
/* per-face auto-hinter properties */
|
||||
FT_UInt increase_x_height;
|
||||
|
||||
AF_StyleMetrics metrics[AF_STYLE_MAX];
|
||||
|
||||
/* Compute darkening amount once per size. Use this to check whether */
|
||||
/* darken_{x,y} needs to be recomputed. */
|
||||
FT_UShort stem_darkening_for_ppem;
|
||||
/* Copy from e.g. AF_LatinMetrics.axis[AF_DIMENSION_HORZ] */
|
||||
/* to compute the darkening amount. */
|
||||
FT_Pos standard_vertical_width;
|
||||
/* Copy from e.g. AF_LatinMetrics.axis[AF_DIMENSION_VERT] */
|
||||
/* to compute the darkening amount. */
|
||||
FT_Pos standard_horizontal_width;
|
||||
/* The actual amount to darken a glyph along the X axis. */
|
||||
FT_Pos darken_x;
|
||||
/* The actual amount to darken a glyph along the Y axis. */
|
||||
FT_Pos darken_y;
|
||||
/* Amount to scale down by to keep emboldened points */
|
||||
/* on the Y-axis in pre-computed blue zones. */
|
||||
FT_Fixed scale_down_factor;
|
||||
AF_Module module; /* to access global properties */
|
||||
|
||||
} AF_FaceGlobalsRec;
|
||||
|
||||
|
||||
/*
|
||||
* model the global hints data for a given face, decomposed into
|
||||
* style-specific items
|
||||
*/
|
||||
|
||||
FT_LOCAL( FT_Error )
|
||||
af_face_globals_new( FT_Face face,
|
||||
AF_FaceGlobals *aglobals,
|
||||
AF_Module module );
|
||||
|
||||
FT_LOCAL( FT_Error )
|
||||
af_face_globals_get_metrics( AF_FaceGlobals globals,
|
||||
FT_UInt gindex,
|
||||
FT_UInt options,
|
||||
AF_StyleMetrics *ametrics );
|
||||
|
||||
FT_LOCAL( void )
|
||||
af_face_globals_free( AF_FaceGlobals globals );
|
||||
|
||||
FT_LOCAL_DEF( FT_Bool )
|
||||
af_face_globals_is_digit( AF_FaceGlobals globals,
|
||||
FT_UInt gindex );
|
||||
|
||||
/* */
|
||||
|
||||
|
||||
FT_END_HEADER
|
||||
|
||||
#endif /* AFGLOBAL_H_ */
|
||||
|
||||
|
||||
/* END */
|
||||
1659
vendor/FreeType2/src/autofit/afhints.c
vendored
Normal file
1659
vendor/FreeType2/src/autofit/afhints.c
vendored
Normal file
File diff suppressed because it is too large
Load diff
481
vendor/FreeType2/src/autofit/afhints.h
vendored
Normal file
481
vendor/FreeType2/src/autofit/afhints.h
vendored
Normal file
|
|
@ -0,0 +1,481 @@
|
|||
/***************************************************************************/
|
||||
/* */
|
||||
/* afhints.h */
|
||||
/* */
|
||||
/* Auto-fitter hinting routines (specification). */
|
||||
/* */
|
||||
/* Copyright 2003-2018 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. */
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
|
||||
#ifndef AFHINTS_H_
|
||||
#define AFHINTS_H_
|
||||
|
||||
#include "aftypes.h"
|
||||
|
||||
#define xxAF_SORT_SEGMENTS
|
||||
|
||||
FT_BEGIN_HEADER
|
||||
|
||||
/*
|
||||
* The definition of outline glyph hints. These are shared by all
|
||||
* writing system analysis routines (until now).
|
||||
*/
|
||||
|
||||
typedef enum AF_Dimension_
|
||||
{
|
||||
AF_DIMENSION_HORZ = 0, /* x coordinates, */
|
||||
/* i.e., vertical segments & edges */
|
||||
AF_DIMENSION_VERT = 1, /* y coordinates, */
|
||||
/* i.e., horizontal segments & edges */
|
||||
|
||||
AF_DIMENSION_MAX /* do not remove */
|
||||
|
||||
} AF_Dimension;
|
||||
|
||||
|
||||
/* hint directions -- the values are computed so that two vectors are */
|
||||
/* in opposite directions iff `dir1 + dir2 == 0' */
|
||||
typedef enum AF_Direction_
|
||||
{
|
||||
AF_DIR_NONE = 4,
|
||||
AF_DIR_RIGHT = 1,
|
||||
AF_DIR_LEFT = -1,
|
||||
AF_DIR_UP = 2,
|
||||
AF_DIR_DOWN = -2
|
||||
|
||||
} AF_Direction;
|
||||
|
||||
|
||||
/*
|
||||
* The following explanations are mostly taken from the article
|
||||
*
|
||||
* Real-Time Grid Fitting of Typographic Outlines
|
||||
*
|
||||
* by David Turner and Werner Lemberg
|
||||
*
|
||||
* https://www.tug.org/TUGboat/Articles/tb24-3/lemberg.pdf
|
||||
*
|
||||
* with appropriate updates.
|
||||
*
|
||||
*
|
||||
* Segments
|
||||
*
|
||||
* `af_{cjk,latin,...}_hints_compute_segments' are the functions to
|
||||
* find segments in an outline.
|
||||
*
|
||||
* A segment is a series of at least two consecutive points that are
|
||||
* approximately aligned along a coordinate axis. The analysis to do
|
||||
* so is specific to a writing system.
|
||||
*
|
||||
*
|
||||
* Edges
|
||||
*
|
||||
* `af_{cjk,latin,...}_hints_compute_edges' are the functions to find
|
||||
* edges.
|
||||
*
|
||||
* As soon as segments are defined, the auto-hinter groups them into
|
||||
* edges. An edge corresponds to a single position on the main
|
||||
* dimension that collects one or more segments (allowing for a small
|
||||
* threshold).
|
||||
*
|
||||
* As an example, the `latin' writing system first tries to grid-fit
|
||||
* edges, then to align segments on the edges unless it detects that
|
||||
* they form a serif.
|
||||
*
|
||||
*
|
||||
* A H
|
||||
* | |
|
||||
* | |
|
||||
* | |
|
||||
* | |
|
||||
* C | | F
|
||||
* +------<-----+ +-----<------+
|
||||
* | B G |
|
||||
* | |
|
||||
* | |
|
||||
* +--------------->------------------+
|
||||
* D E
|
||||
*
|
||||
*
|
||||
* Stems
|
||||
*
|
||||
* Stems are detected by `af_{cjk,latin,...}_hint_edges'.
|
||||
*
|
||||
* Segments need to be `linked' to other ones in order to detect stems.
|
||||
* A stem is made of two segments that face each other in opposite
|
||||
* directions and that are sufficiently close to each other. Using
|
||||
* vocabulary from the TrueType specification, stem segments form a
|
||||
* `black distance'.
|
||||
*
|
||||
* In the above ASCII drawing, the horizontal segments are BC, DE, and
|
||||
* FG; the vertical segments are AB, CD, EF, and GH.
|
||||
*
|
||||
* Each segment has at most one `best' candidate to form a black
|
||||
* distance, or no candidate at all. Notice that two distinct segments
|
||||
* can have the same candidate, which frequently means a serif.
|
||||
*
|
||||
* A stem is recognized by the following condition:
|
||||
*
|
||||
* best segment_1 = segment_2 && best segment_2 = segment_1
|
||||
*
|
||||
* The best candidate is stored in field `link' in structure
|
||||
* `AF_Segment'.
|
||||
*
|
||||
* In the above ASCII drawing, the best candidate for both AB and CD is
|
||||
* GH, while the best candidate for GH is AB. Similarly, the best
|
||||
* candidate for EF and GH is AB, while the best candidate for AB is
|
||||
* GH.
|
||||
*
|
||||
* The detection and handling of stems is dependent on the writing
|
||||
* system.
|
||||
*
|
||||
*
|
||||
* Serifs
|
||||
*
|
||||
* Serifs are detected by `af_{cjk,latin,...}_hint_edges'.
|
||||
*
|
||||
* In comparison to a stem, a serif (as handled by the auto-hinter
|
||||
* module that takes care of the `latin' writing system) has
|
||||
*
|
||||
* best segment_1 = segment_2 && best segment_2 != segment_1
|
||||
*
|
||||
* where segment_1 corresponds to the serif segment (CD and EF in the
|
||||
* above ASCII drawing).
|
||||
*
|
||||
* The best candidate is stored in field `serif' in structure
|
||||
* `AF_Segment' (and `link' is set to NULL).
|
||||
*
|
||||
*
|
||||
* Touched points
|
||||
*
|
||||
* A point is called `touched' if it has been processed somehow by the
|
||||
* auto-hinter. It basically means that it shouldn't be moved again
|
||||
* (or moved only under certain constraints to preserve the already
|
||||
* applied processing).
|
||||
*
|
||||
*
|
||||
* Flat and round segments
|
||||
*
|
||||
* Segments are `round' or `flat', depending on the series of points
|
||||
* that define them. A segment is round if the next and previous point
|
||||
* of an extremum (which can be either a single point or sequence of
|
||||
* points) are both conic or cubic control points. Otherwise, a
|
||||
* segment with an extremum is flat.
|
||||
*
|
||||
*
|
||||
* Strong Points
|
||||
*
|
||||
* Experience has shown that points not part of an edge need to be
|
||||
* interpolated linearly between their two closest edges, even if these
|
||||
* are not part of the contour of those particular points. Typical
|
||||
* candidates for this are
|
||||
*
|
||||
* - angle points (i.e., points where the `in' and `out' direction
|
||||
* differ greatly)
|
||||
*
|
||||
* - inflection points (i.e., where the `in' and `out' angles are the
|
||||
* same, but the curvature changes sign) [currently, such points
|
||||
* aren't handled specially in the auto-hinter]
|
||||
*
|
||||
* `af_glyph_hints_align_strong_points' is the function that takes
|
||||
* care of such situations; it is equivalent to the TrueType `IP'
|
||||
* hinting instruction.
|
||||
*
|
||||
*
|
||||
* Weak Points
|
||||
*
|
||||
* Other points in the outline must be interpolated using the
|
||||
* coordinates of their previous and next unfitted contour neighbours.
|
||||
* These are called `weak points' and are touched by the function
|
||||
* `af_glyph_hints_align_weak_points', equivalent to the TrueType `IUP'
|
||||
* hinting instruction. Typical candidates are control points and
|
||||
* points on the contour without a major direction.
|
||||
*
|
||||
* The major effect is to reduce possible distortion caused by
|
||||
* alignment of edges and strong points, thus weak points are processed
|
||||
* after strong points.
|
||||
*/
|
||||
|
||||
|
||||
/* point hint flags */
|
||||
#define AF_FLAG_NONE 0
|
||||
|
||||
/* point type flags */
|
||||
#define AF_FLAG_CONIC ( 1U << 0 )
|
||||
#define AF_FLAG_CUBIC ( 1U << 1 )
|
||||
#define AF_FLAG_CONTROL ( AF_FLAG_CONIC | AF_FLAG_CUBIC )
|
||||
|
||||
/* point touch flags */
|
||||
#define AF_FLAG_TOUCH_X ( 1U << 2 )
|
||||
#define AF_FLAG_TOUCH_Y ( 1U << 3 )
|
||||
|
||||
/* candidates for weak interpolation have this flag set */
|
||||
#define AF_FLAG_WEAK_INTERPOLATION ( 1U << 4 )
|
||||
|
||||
/* the distance to the next point is very small */
|
||||
#define AF_FLAG_NEAR ( 1U << 5 )
|
||||
|
||||
|
||||
/* edge hint flags */
|
||||
#define AF_EDGE_NORMAL 0
|
||||
#define AF_EDGE_ROUND ( 1U << 0 )
|
||||
#define AF_EDGE_SERIF ( 1U << 1 )
|
||||
#define AF_EDGE_DONE ( 1U << 2 )
|
||||
#define AF_EDGE_NEUTRAL ( 1U << 3 ) /* edge aligns to a neutral blue zone */
|
||||
|
||||
|
||||
typedef struct AF_PointRec_* AF_Point;
|
||||
typedef struct AF_SegmentRec_* AF_Segment;
|
||||
typedef struct AF_EdgeRec_* AF_Edge;
|
||||
|
||||
|
||||
typedef struct AF_PointRec_
|
||||
{
|
||||
FT_UShort flags; /* point flags used by hinter */
|
||||
FT_Char in_dir; /* direction of inwards vector */
|
||||
FT_Char out_dir; /* direction of outwards vector */
|
||||
|
||||
FT_Pos ox, oy; /* original, scaled position */
|
||||
FT_Short fx, fy; /* original, unscaled position (in font units) */
|
||||
FT_Pos x, y; /* current position */
|
||||
FT_Pos u, v; /* current (x,y) or (y,x) depending on context */
|
||||
|
||||
AF_Point next; /* next point in contour */
|
||||
AF_Point prev; /* previous point in contour */
|
||||
|
||||
} AF_PointRec;
|
||||
|
||||
|
||||
typedef struct AF_SegmentRec_
|
||||
{
|
||||
FT_Byte flags; /* edge/segment flags for this segment */
|
||||
FT_Char dir; /* segment direction */
|
||||
FT_Short pos; /* position of segment */
|
||||
FT_Short delta; /* deviation from segment position */
|
||||
FT_Short min_coord; /* minimum coordinate of segment */
|
||||
FT_Short max_coord; /* maximum coordinate of segment */
|
||||
FT_Short height; /* the hinted segment height */
|
||||
|
||||
AF_Edge edge; /* the segment's parent edge */
|
||||
AF_Segment edge_next; /* link to next segment in parent edge */
|
||||
|
||||
AF_Segment link; /* (stem) link segment */
|
||||
AF_Segment serif; /* primary segment for serifs */
|
||||
FT_Pos score; /* used during stem matching */
|
||||
FT_Pos len; /* used during stem matching */
|
||||
|
||||
AF_Point first; /* first point in edge segment */
|
||||
AF_Point last; /* last point in edge segment */
|
||||
|
||||
} AF_SegmentRec;
|
||||
|
||||
|
||||
typedef struct AF_EdgeRec_
|
||||
{
|
||||
FT_Short fpos; /* original, unscaled position (in font units) */
|
||||
FT_Pos opos; /* original, scaled position */
|
||||
FT_Pos pos; /* current position */
|
||||
|
||||
FT_Byte flags; /* edge flags */
|
||||
FT_Char dir; /* edge direction */
|
||||
FT_Fixed scale; /* used to speed up interpolation between edges */
|
||||
|
||||
AF_Width blue_edge; /* non-NULL if this is a blue edge */
|
||||
AF_Edge link; /* link edge */
|
||||
AF_Edge serif; /* primary edge for serifs */
|
||||
FT_Int score; /* used during stem matching */
|
||||
|
||||
AF_Segment first; /* first segment in edge */
|
||||
AF_Segment last; /* last segment in edge */
|
||||
|
||||
} AF_EdgeRec;
|
||||
|
||||
#define AF_SEGMENTS_EMBEDDED 18 /* number of embedded segments */
|
||||
#define AF_EDGES_EMBEDDED 12 /* number of embedded edges */
|
||||
|
||||
typedef struct AF_AxisHintsRec_
|
||||
{
|
||||
FT_Int num_segments; /* number of used segments */
|
||||
FT_Int max_segments; /* number of allocated segments */
|
||||
AF_Segment segments; /* segments array */
|
||||
#ifdef AF_SORT_SEGMENTS
|
||||
FT_Int mid_segments;
|
||||
#endif
|
||||
|
||||
FT_Int num_edges; /* number of used edges */
|
||||
FT_Int max_edges; /* number of allocated edges */
|
||||
AF_Edge edges; /* edges array */
|
||||
|
||||
AF_Direction major_dir; /* either vertical or horizontal */
|
||||
|
||||
/* two arrays to avoid allocation penalty */
|
||||
struct
|
||||
{
|
||||
AF_SegmentRec segments[AF_SEGMENTS_EMBEDDED];
|
||||
AF_EdgeRec edges[AF_EDGES_EMBEDDED];
|
||||
} embedded;
|
||||
|
||||
|
||||
} AF_AxisHintsRec, *AF_AxisHints;
|
||||
|
||||
|
||||
#define AF_POINTS_EMBEDDED 96 /* number of embedded points */
|
||||
#define AF_CONTOURS_EMBEDDED 8 /* number of embedded contours */
|
||||
|
||||
typedef struct AF_GlyphHintsRec_
|
||||
{
|
||||
FT_Memory memory;
|
||||
|
||||
FT_Fixed x_scale;
|
||||
FT_Pos x_delta;
|
||||
|
||||
FT_Fixed y_scale;
|
||||
FT_Pos y_delta;
|
||||
|
||||
FT_Int max_points; /* number of allocated points */
|
||||
FT_Int num_points; /* number of used points */
|
||||
AF_Point points; /* points array */
|
||||
|
||||
FT_Int max_contours; /* number of allocated contours */
|
||||
FT_Int num_contours; /* number of used contours */
|
||||
AF_Point* contours; /* contours array */
|
||||
|
||||
AF_AxisHintsRec axis[AF_DIMENSION_MAX];
|
||||
|
||||
FT_UInt32 scaler_flags; /* copy of scaler flags */
|
||||
FT_UInt32 other_flags; /* free for style-specific */
|
||||
/* implementations */
|
||||
AF_StyleMetrics metrics;
|
||||
|
||||
FT_Pos xmin_delta; /* used for warping */
|
||||
FT_Pos xmax_delta;
|
||||
|
||||
/* Two arrays to avoid allocation penalty. */
|
||||
/* The `embedded' structure must be the last element! */
|
||||
struct
|
||||
{
|
||||
AF_Point contours[AF_CONTOURS_EMBEDDED];
|
||||
AF_PointRec points[AF_POINTS_EMBEDDED];
|
||||
} embedded;
|
||||
|
||||
} AF_GlyphHintsRec;
|
||||
|
||||
|
||||
#define AF_HINTS_TEST_SCALER( h, f ) ( (h)->scaler_flags & (f) )
|
||||
#define AF_HINTS_TEST_OTHER( h, f ) ( (h)->other_flags & (f) )
|
||||
|
||||
|
||||
#ifdef FT_DEBUG_AUTOFIT
|
||||
|
||||
#define AF_HINTS_DO_HORIZONTAL( h ) \
|
||||
( !_af_debug_disable_horz_hints && \
|
||||
!AF_HINTS_TEST_SCALER( h, AF_SCALER_FLAG_NO_HORIZONTAL ) )
|
||||
|
||||
#define AF_HINTS_DO_VERTICAL( h ) \
|
||||
( !_af_debug_disable_vert_hints && \
|
||||
!AF_HINTS_TEST_SCALER( h, AF_SCALER_FLAG_NO_VERTICAL ) )
|
||||
|
||||
#define AF_HINTS_DO_BLUES( h ) ( !_af_debug_disable_blue_hints )
|
||||
|
||||
#else /* !FT_DEBUG_AUTOFIT */
|
||||
|
||||
#define AF_HINTS_DO_HORIZONTAL( h ) \
|
||||
!AF_HINTS_TEST_SCALER( h, AF_SCALER_FLAG_NO_HORIZONTAL )
|
||||
|
||||
#define AF_HINTS_DO_VERTICAL( h ) \
|
||||
!AF_HINTS_TEST_SCALER( h, AF_SCALER_FLAG_NO_VERTICAL )
|
||||
|
||||
#define AF_HINTS_DO_BLUES( h ) 1
|
||||
|
||||
#endif /* !FT_DEBUG_AUTOFIT */
|
||||
|
||||
|
||||
#define AF_HINTS_DO_ADVANCE( h ) \
|
||||
!AF_HINTS_TEST_SCALER( h, AF_SCALER_FLAG_NO_ADVANCE )
|
||||
|
||||
#define AF_HINTS_DO_WARP( h ) \
|
||||
!AF_HINTS_TEST_SCALER( h, AF_SCALER_FLAG_NO_WARPER )
|
||||
|
||||
|
||||
|
||||
FT_LOCAL( AF_Direction )
|
||||
af_direction_compute( FT_Pos dx,
|
||||
FT_Pos dy );
|
||||
|
||||
|
||||
FT_LOCAL( FT_Error )
|
||||
af_axis_hints_new_segment( AF_AxisHints axis,
|
||||
FT_Memory memory,
|
||||
AF_Segment *asegment );
|
||||
|
||||
FT_LOCAL( FT_Error)
|
||||
af_axis_hints_new_edge( AF_AxisHints axis,
|
||||
FT_Int fpos,
|
||||
AF_Direction dir,
|
||||
FT_Bool top_to_bottom_hinting,
|
||||
FT_Memory memory,
|
||||
AF_Edge *edge );
|
||||
|
||||
FT_LOCAL( void )
|
||||
af_glyph_hints_init( AF_GlyphHints hints,
|
||||
FT_Memory memory );
|
||||
|
||||
FT_LOCAL( void )
|
||||
af_glyph_hints_rescale( AF_GlyphHints hints,
|
||||
AF_StyleMetrics metrics );
|
||||
|
||||
FT_LOCAL( FT_Error )
|
||||
af_glyph_hints_reload( AF_GlyphHints hints,
|
||||
FT_Outline* outline );
|
||||
|
||||
FT_LOCAL( void )
|
||||
af_glyph_hints_save( AF_GlyphHints hints,
|
||||
FT_Outline* outline );
|
||||
|
||||
FT_LOCAL( void )
|
||||
af_glyph_hints_align_edge_points( AF_GlyphHints hints,
|
||||
AF_Dimension dim );
|
||||
|
||||
FT_LOCAL( void )
|
||||
af_glyph_hints_align_strong_points( AF_GlyphHints hints,
|
||||
AF_Dimension dim );
|
||||
|
||||
FT_LOCAL( void )
|
||||
af_glyph_hints_align_weak_points( AF_GlyphHints hints,
|
||||
AF_Dimension dim );
|
||||
|
||||
#ifdef AF_CONFIG_OPTION_USE_WARPER
|
||||
FT_LOCAL( void )
|
||||
af_glyph_hints_scale_dim( AF_GlyphHints hints,
|
||||
AF_Dimension dim,
|
||||
FT_Fixed scale,
|
||||
FT_Pos delta );
|
||||
#endif
|
||||
|
||||
FT_LOCAL( void )
|
||||
af_glyph_hints_done( AF_GlyphHints hints );
|
||||
|
||||
/* */
|
||||
|
||||
#define AF_SEGMENT_LEN( seg ) ( (seg)->max_coord - (seg)->min_coord )
|
||||
|
||||
#define AF_SEGMENT_DIST( seg1, seg2 ) ( ( (seg1)->pos > (seg2)->pos ) \
|
||||
? (seg1)->pos - (seg2)->pos \
|
||||
: (seg2)->pos - (seg1)->pos )
|
||||
|
||||
|
||||
FT_END_HEADER
|
||||
|
||||
#endif /* AFHINTS_H_ */
|
||||
|
||||
|
||||
/* END */
|
||||
157
vendor/FreeType2/src/autofit/afindic.c
vendored
Normal file
157
vendor/FreeType2/src/autofit/afindic.c
vendored
Normal file
|
|
@ -0,0 +1,157 @@
|
|||
/***************************************************************************/
|
||||
/* */
|
||||
/* afindic.c */
|
||||
/* */
|
||||
/* Auto-fitter hinting routines for Indic writing system (body). */
|
||||
/* */
|
||||
/* Copyright 2007-2018 by */
|
||||
/* Rahul Bhalerao <rahul.bhalerao@redhat.com>, <b.rahul.pm@gmail.com>. */
|
||||
/* */
|
||||
/* 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 "aftypes.h"
|
||||
#include "aflatin.h"
|
||||
#include "afcjk.h"
|
||||
|
||||
|
||||
#ifdef AF_CONFIG_OPTION_INDIC
|
||||
|
||||
#include "afindic.h"
|
||||
#include "aferrors.h"
|
||||
|
||||
|
||||
#ifdef AF_CONFIG_OPTION_USE_WARPER
|
||||
#include "afwarp.h"
|
||||
#endif
|
||||
|
||||
|
||||
static FT_Error
|
||||
af_indic_metrics_init( AF_CJKMetrics metrics,
|
||||
FT_Face face )
|
||||
{
|
||||
/* skip blue zone init in CJK routines */
|
||||
FT_CharMap oldmap = face->charmap;
|
||||
|
||||
|
||||
metrics->units_per_em = face->units_per_EM;
|
||||
|
||||
if ( FT_Select_Charmap( face, FT_ENCODING_UNICODE ) )
|
||||
face->charmap = NULL;
|
||||
else
|
||||
{
|
||||
af_cjk_metrics_init_widths( metrics, face );
|
||||
#if 0
|
||||
/* either need indic specific blue_chars[] or just skip blue zones */
|
||||
af_cjk_metrics_init_blues( metrics, face, af_cjk_blue_chars );
|
||||
#endif
|
||||
af_cjk_metrics_check_digits( metrics, face );
|
||||
}
|
||||
|
||||
FT_Set_Charmap( face, oldmap );
|
||||
|
||||
return FT_Err_Ok;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
af_indic_metrics_scale( AF_CJKMetrics metrics,
|
||||
AF_Scaler scaler )
|
||||
{
|
||||
/* use CJK routines */
|
||||
af_cjk_metrics_scale( metrics, scaler );
|
||||
}
|
||||
|
||||
|
||||
static FT_Error
|
||||
af_indic_hints_init( AF_GlyphHints hints,
|
||||
AF_CJKMetrics metrics )
|
||||
{
|
||||
/* use CJK routines */
|
||||
return af_cjk_hints_init( hints, metrics );
|
||||
}
|
||||
|
||||
|
||||
static FT_Error
|
||||
af_indic_hints_apply( FT_UInt glyph_index,
|
||||
AF_GlyphHints hints,
|
||||
FT_Outline* outline,
|
||||
AF_CJKMetrics metrics )
|
||||
{
|
||||
/* use CJK routines */
|
||||
return af_cjk_hints_apply( glyph_index, hints, outline, metrics );
|
||||
}
|
||||
|
||||
|
||||
/* Extract standard_width from writing system/script specific */
|
||||
/* metrics class. */
|
||||
|
||||
static void
|
||||
af_indic_get_standard_widths( AF_CJKMetrics metrics,
|
||||
FT_Pos* stdHW,
|
||||
FT_Pos* stdVW )
|
||||
{
|
||||
if ( stdHW )
|
||||
*stdHW = metrics->axis[AF_DIMENSION_VERT].standard_width;
|
||||
|
||||
if ( stdVW )
|
||||
*stdVW = metrics->axis[AF_DIMENSION_HORZ].standard_width;
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/***** *****/
|
||||
/***** I N D I C S C R I P T C L A S S *****/
|
||||
/***** *****/
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
|
||||
|
||||
AF_DEFINE_WRITING_SYSTEM_CLASS(
|
||||
af_indic_writing_system_class,
|
||||
|
||||
AF_WRITING_SYSTEM_INDIC,
|
||||
|
||||
sizeof ( AF_CJKMetricsRec ),
|
||||
|
||||
(AF_WritingSystem_InitMetricsFunc) af_indic_metrics_init, /* style_metrics_init */
|
||||
(AF_WritingSystem_ScaleMetricsFunc)af_indic_metrics_scale, /* style_metrics_scale */
|
||||
(AF_WritingSystem_DoneMetricsFunc) NULL, /* style_metrics_done */
|
||||
(AF_WritingSystem_GetStdWidthsFunc)af_indic_get_standard_widths, /* style_metrics_getstdw */
|
||||
|
||||
(AF_WritingSystem_InitHintsFunc) af_indic_hints_init, /* style_hints_init */
|
||||
(AF_WritingSystem_ApplyHintsFunc) af_indic_hints_apply /* style_hints_apply */
|
||||
)
|
||||
|
||||
|
||||
#else /* !AF_CONFIG_OPTION_INDIC */
|
||||
|
||||
|
||||
AF_DEFINE_WRITING_SYSTEM_CLASS(
|
||||
af_indic_writing_system_class,
|
||||
|
||||
AF_WRITING_SYSTEM_INDIC,
|
||||
|
||||
sizeof ( AF_CJKMetricsRec ),
|
||||
|
||||
(AF_WritingSystem_InitMetricsFunc) NULL, /* style_metrics_init */
|
||||
(AF_WritingSystem_ScaleMetricsFunc)NULL, /* style_metrics_scale */
|
||||
(AF_WritingSystem_DoneMetricsFunc) NULL, /* style_metrics_done */
|
||||
(AF_WritingSystem_GetStdWidthsFunc)NULL, /* style_metrics_getstdw */
|
||||
|
||||
(AF_WritingSystem_InitHintsFunc) NULL, /* style_hints_init */
|
||||
(AF_WritingSystem_ApplyHintsFunc) NULL /* style_hints_apply */
|
||||
)
|
||||
|
||||
|
||||
#endif /* !AF_CONFIG_OPTION_INDIC */
|
||||
|
||||
|
||||
/* END */
|
||||
41
vendor/FreeType2/src/autofit/afindic.h
vendored
Normal file
41
vendor/FreeType2/src/autofit/afindic.h
vendored
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
/***************************************************************************/
|
||||
/* */
|
||||
/* afindic.h */
|
||||
/* */
|
||||
/* Auto-fitter hinting routines for Indic writing system */
|
||||
/* (specification). */
|
||||
/* */
|
||||
/* Copyright 2007-2018 by */
|
||||
/* Rahul Bhalerao <rahul.bhalerao@redhat.com>, <b.rahul.pm@gmail.com>. */
|
||||
/* */
|
||||
/* 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 AFINDIC_H_
|
||||
#define AFINDIC_H_
|
||||
|
||||
#include "afhints.h"
|
||||
|
||||
|
||||
FT_BEGIN_HEADER
|
||||
|
||||
|
||||
/* the `indic' writing system */
|
||||
|
||||
AF_DECLARE_WRITING_SYSTEM_CLASS( af_indic_writing_system_class )
|
||||
|
||||
|
||||
/* */
|
||||
|
||||
FT_END_HEADER
|
||||
|
||||
#endif /* AFINDIC_H_ */
|
||||
|
||||
|
||||
/* END */
|
||||
3590
vendor/FreeType2/src/autofit/aflatin.c
vendored
Normal file
3590
vendor/FreeType2/src/autofit/aflatin.c
vendored
Normal file
File diff suppressed because it is too large
Load diff
194
vendor/FreeType2/src/autofit/aflatin.h
vendored
Normal file
194
vendor/FreeType2/src/autofit/aflatin.h
vendored
Normal file
|
|
@ -0,0 +1,194 @@
|
|||
/***************************************************************************/
|
||||
/* */
|
||||
/* aflatin.h */
|
||||
/* */
|
||||
/* Auto-fitter hinting routines for latin writing system */
|
||||
/* (specification). */
|
||||
/* */
|
||||
/* Copyright 2003-2018 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. */
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
|
||||
#ifndef AFLATIN_H_
|
||||
#define AFLATIN_H_
|
||||
|
||||
#include "afhints.h"
|
||||
|
||||
|
||||
FT_BEGIN_HEADER
|
||||
|
||||
/* the `latin' writing system */
|
||||
|
||||
AF_DECLARE_WRITING_SYSTEM_CLASS( af_latin_writing_system_class )
|
||||
|
||||
|
||||
/* constants are given with units_per_em == 2048 in mind */
|
||||
#define AF_LATIN_CONSTANT( metrics, c ) \
|
||||
( ( (c) * (FT_Long)( (AF_LatinMetrics)(metrics) )->units_per_em ) / 2048 )
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/***** *****/
|
||||
/***** L A T I N G L O B A L M E T R I C S *****/
|
||||
/***** *****/
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
|
||||
|
||||
/*
|
||||
* The following declarations could be embedded in the file `aflatin.c';
|
||||
* they have been made semi-public to allow alternate writing system
|
||||
* hinters to re-use some of them.
|
||||
*/
|
||||
|
||||
|
||||
#define AF_LATIN_IS_TOP_BLUE( b ) \
|
||||
( (b)->properties & AF_BLUE_PROPERTY_LATIN_TOP )
|
||||
#define AF_LATIN_IS_SUB_TOP_BLUE( b ) \
|
||||
( (b)->properties & AF_BLUE_PROPERTY_LATIN_SUB_TOP )
|
||||
#define AF_LATIN_IS_NEUTRAL_BLUE( b ) \
|
||||
( (b)->properties & AF_BLUE_PROPERTY_LATIN_NEUTRAL )
|
||||
#define AF_LATIN_IS_X_HEIGHT_BLUE( b ) \
|
||||
( (b)->properties & AF_BLUE_PROPERTY_LATIN_X_HEIGHT )
|
||||
#define AF_LATIN_IS_LONG_BLUE( b ) \
|
||||
( (b)->properties & AF_BLUE_PROPERTY_LATIN_LONG )
|
||||
|
||||
#define AF_LATIN_MAX_WIDTHS 16
|
||||
|
||||
|
||||
#define AF_LATIN_BLUE_ACTIVE ( 1U << 0 ) /* zone height is <= 3/4px */
|
||||
#define AF_LATIN_BLUE_TOP ( 1U << 1 ) /* we have a top blue zone */
|
||||
#define AF_LATIN_BLUE_SUB_TOP ( 1U << 2 ) /* we have a subscript top */
|
||||
/* blue zone */
|
||||
#define AF_LATIN_BLUE_NEUTRAL ( 1U << 3 ) /* we have neutral blue zone */
|
||||
#define AF_LATIN_BLUE_ADJUSTMENT ( 1U << 4 ) /* used for scale adjustment */
|
||||
/* optimization */
|
||||
|
||||
|
||||
typedef struct AF_LatinBlueRec_
|
||||
{
|
||||
AF_WidthRec ref;
|
||||
AF_WidthRec shoot;
|
||||
FT_Pos ascender;
|
||||
FT_Pos descender;
|
||||
FT_UInt flags;
|
||||
|
||||
} AF_LatinBlueRec, *AF_LatinBlue;
|
||||
|
||||
|
||||
typedef struct AF_LatinAxisRec_
|
||||
{
|
||||
FT_Fixed scale;
|
||||
FT_Pos delta;
|
||||
|
||||
FT_UInt width_count; /* number of used widths */
|
||||
AF_WidthRec widths[AF_LATIN_MAX_WIDTHS]; /* widths array */
|
||||
FT_Pos edge_distance_threshold; /* used for creating edges */
|
||||
FT_Pos standard_width; /* the default stem thickness */
|
||||
FT_Bool extra_light; /* is standard width very light? */
|
||||
|
||||
/* ignored for horizontal metrics */
|
||||
FT_UInt blue_count;
|
||||
AF_LatinBlueRec blues[AF_BLUE_STRINGSET_MAX];
|
||||
|
||||
FT_Fixed org_scale;
|
||||
FT_Pos org_delta;
|
||||
|
||||
} AF_LatinAxisRec, *AF_LatinAxis;
|
||||
|
||||
|
||||
typedef struct AF_LatinMetricsRec_
|
||||
{
|
||||
AF_StyleMetricsRec root;
|
||||
FT_UInt units_per_em;
|
||||
AF_LatinAxisRec axis[AF_DIMENSION_MAX];
|
||||
|
||||
} AF_LatinMetricsRec, *AF_LatinMetrics;
|
||||
|
||||
|
||||
FT_LOCAL( FT_Error )
|
||||
af_latin_metrics_init( AF_LatinMetrics metrics,
|
||||
FT_Face face );
|
||||
|
||||
FT_LOCAL( void )
|
||||
af_latin_metrics_scale( AF_LatinMetrics metrics,
|
||||
AF_Scaler scaler );
|
||||
|
||||
FT_LOCAL( void )
|
||||
af_latin_metrics_init_widths( AF_LatinMetrics metrics,
|
||||
FT_Face face );
|
||||
|
||||
FT_LOCAL( void )
|
||||
af_latin_metrics_check_digits( AF_LatinMetrics metrics,
|
||||
FT_Face face );
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/***** *****/
|
||||
/***** L A T I N G L Y P H A N A L Y S I S *****/
|
||||
/***** *****/
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
|
||||
#define AF_LATIN_HINTS_HORZ_SNAP ( 1U << 0 ) /* stem width snapping */
|
||||
#define AF_LATIN_HINTS_VERT_SNAP ( 1U << 1 ) /* stem height snapping */
|
||||
#define AF_LATIN_HINTS_STEM_ADJUST ( 1U << 2 ) /* stem width/height */
|
||||
/* adjustment */
|
||||
#define AF_LATIN_HINTS_MONO ( 1U << 3 ) /* monochrome rendering */
|
||||
|
||||
|
||||
#define AF_LATIN_HINTS_DO_HORZ_SNAP( h ) \
|
||||
AF_HINTS_TEST_OTHER( h, AF_LATIN_HINTS_HORZ_SNAP )
|
||||
|
||||
#define AF_LATIN_HINTS_DO_VERT_SNAP( h ) \
|
||||
AF_HINTS_TEST_OTHER( h, AF_LATIN_HINTS_VERT_SNAP )
|
||||
|
||||
#define AF_LATIN_HINTS_DO_STEM_ADJUST( h ) \
|
||||
AF_HINTS_TEST_OTHER( h, AF_LATIN_HINTS_STEM_ADJUST )
|
||||
|
||||
#define AF_LATIN_HINTS_DO_MONO( h ) \
|
||||
AF_HINTS_TEST_OTHER( h, AF_LATIN_HINTS_MONO )
|
||||
|
||||
|
||||
/*
|
||||
* The next functions shouldn't normally be exported. However, other
|
||||
* writing systems might like to use these functions as-is.
|
||||
*/
|
||||
FT_LOCAL( FT_Error )
|
||||
af_latin_hints_compute_segments( AF_GlyphHints hints,
|
||||
AF_Dimension dim );
|
||||
|
||||
FT_LOCAL( void )
|
||||
af_latin_hints_link_segments( AF_GlyphHints hints,
|
||||
FT_UInt width_count,
|
||||
AF_WidthRec* widths,
|
||||
AF_Dimension dim );
|
||||
|
||||
FT_LOCAL( FT_Error )
|
||||
af_latin_hints_compute_edges( AF_GlyphHints hints,
|
||||
AF_Dimension dim );
|
||||
|
||||
FT_LOCAL( FT_Error )
|
||||
af_latin_hints_detect_features( AF_GlyphHints hints,
|
||||
FT_UInt width_count,
|
||||
AF_WidthRec* widths,
|
||||
AF_Dimension dim );
|
||||
|
||||
/* */
|
||||
|
||||
FT_END_HEADER
|
||||
|
||||
#endif /* AFLATIN_H_ */
|
||||
|
||||
|
||||
/* END */
|
||||
2427
vendor/FreeType2/src/autofit/aflatin2.c
vendored
Normal file
2427
vendor/FreeType2/src/autofit/aflatin2.c
vendored
Normal file
File diff suppressed because it is too large
Load diff
46
vendor/FreeType2/src/autofit/aflatin2.h
vendored
Normal file
46
vendor/FreeType2/src/autofit/aflatin2.h
vendored
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
/* ATTENTION: This file doesn't compile. It is only here as a reference */
|
||||
/* of an alternative latin hinting algorithm that was always */
|
||||
/* marked as experimental. */
|
||||
|
||||
|
||||
/***************************************************************************/
|
||||
/* */
|
||||
/* aflatin2.h */
|
||||
/* */
|
||||
/* Auto-fitter hinting routines for latin writing system */
|
||||
/* (specification). */
|
||||
/* */
|
||||
/* Copyright 2003-2018 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. */
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
|
||||
#ifndef AFLATIN2_H_
|
||||
#define AFLATIN2_H_
|
||||
|
||||
#include "afhints.h"
|
||||
|
||||
|
||||
FT_BEGIN_HEADER
|
||||
|
||||
|
||||
/* the `latin' writing system */
|
||||
|
||||
AF_DECLARE_WRITING_SYSTEM_CLASS( af_latin2_writing_system_class )
|
||||
|
||||
|
||||
/* */
|
||||
|
||||
FT_END_HEADER
|
||||
|
||||
#endif /* AFLATIN_H_ */
|
||||
|
||||
|
||||
/* END */
|
||||
721
vendor/FreeType2/src/autofit/afloader.c
vendored
Normal file
721
vendor/FreeType2/src/autofit/afloader.c
vendored
Normal file
|
|
@ -0,0 +1,721 @@
|
|||
/***************************************************************************/
|
||||
/* */
|
||||
/* afloader.c */
|
||||
/* */
|
||||
/* Auto-fitter glyph loading routines (body). */
|
||||
/* */
|
||||
/* Copyright 2003-2018 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 "afglobal.h"
|
||||
#include "afloader.h"
|
||||
#include "afhints.h"
|
||||
#include "aferrors.h"
|
||||
#include "afmodule.h"
|
||||
#include "afpic.h"
|
||||
|
||||
#include FT_INTERNAL_CALC_H
|
||||
|
||||
|
||||
/* Initialize glyph loader. */
|
||||
|
||||
FT_LOCAL_DEF( void )
|
||||
af_loader_init( AF_Loader loader,
|
||||
AF_GlyphHints hints )
|
||||
{
|
||||
FT_ZERO( loader );
|
||||
|
||||
loader->hints = hints;
|
||||
}
|
||||
|
||||
|
||||
/* Reset glyph loader and compute globals if necessary. */
|
||||
|
||||
FT_LOCAL_DEF( FT_Error )
|
||||
af_loader_reset( AF_Loader loader,
|
||||
AF_Module module,
|
||||
FT_Face face )
|
||||
{
|
||||
FT_Error error = FT_Err_Ok;
|
||||
|
||||
|
||||
loader->face = face;
|
||||
loader->globals = (AF_FaceGlobals)face->autohint.data;
|
||||
|
||||
if ( !loader->globals )
|
||||
{
|
||||
error = af_face_globals_new( face, &loader->globals, module );
|
||||
if ( !error )
|
||||
{
|
||||
face->autohint.data =
|
||||
(FT_Pointer)loader->globals;
|
||||
face->autohint.finalizer =
|
||||
(FT_Generic_Finalizer)af_face_globals_free;
|
||||
}
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
/* Finalize glyph loader. */
|
||||
|
||||
FT_LOCAL_DEF( void )
|
||||
af_loader_done( AF_Loader loader )
|
||||
{
|
||||
loader->face = NULL;
|
||||
loader->globals = NULL;
|
||||
loader->hints = NULL;
|
||||
}
|
||||
|
||||
|
||||
#define af_intToFixed( i ) \
|
||||
( (FT_Fixed)( (FT_UInt32)(i) << 16 ) )
|
||||
#define af_fixedToInt( x ) \
|
||||
( (FT_Short)( ( (FT_UInt32)(x) + 0x8000U ) >> 16 ) )
|
||||
#define af_floatToFixed( f ) \
|
||||
( (FT_Fixed)( (f) * 65536.0 + 0.5 ) )
|
||||
|
||||
|
||||
static FT_Error
|
||||
af_loader_embolden_glyph_in_slot( AF_Loader loader,
|
||||
FT_Face face,
|
||||
AF_StyleMetrics style_metrics )
|
||||
{
|
||||
FT_Error error = FT_Err_Ok;
|
||||
|
||||
FT_GlyphSlot slot = face->glyph;
|
||||
AF_FaceGlobals globals = loader->globals;
|
||||
AF_WritingSystemClass writing_system_class;
|
||||
|
||||
FT_Size_Metrics* size_metrics = &face->size->internal->autohint_metrics;
|
||||
|
||||
FT_Pos stdVW = 0;
|
||||
FT_Pos stdHW = 0;
|
||||
|
||||
FT_Bool size_changed = size_metrics->x_ppem !=
|
||||
globals->stem_darkening_for_ppem;
|
||||
|
||||
FT_Fixed em_size = af_intToFixed( face->units_per_EM );
|
||||
FT_Fixed em_ratio = FT_DivFix( af_intToFixed( 1000 ), em_size );
|
||||
|
||||
FT_Matrix scale_down_matrix = { 0x10000L, 0, 0, 0x10000L };
|
||||
|
||||
|
||||
/* Skip stem darkening for broken fonts. */
|
||||
if ( !face->units_per_EM )
|
||||
{
|
||||
error = FT_ERR( Corrupted_Font_Header );
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
/*
|
||||
* We depend on the writing system (script analyzers) to supply
|
||||
* standard widths for the script of the glyph we are looking at. If
|
||||
* it can't deliver, stem darkening is disabled.
|
||||
*/
|
||||
writing_system_class =
|
||||
AF_WRITING_SYSTEM_CLASSES_GET[style_metrics->style_class->writing_system];
|
||||
|
||||
if ( writing_system_class->style_metrics_getstdw )
|
||||
writing_system_class->style_metrics_getstdw( style_metrics,
|
||||
&stdHW,
|
||||
&stdVW );
|
||||
else
|
||||
{
|
||||
error = FT_ERR( Unimplemented_Feature );
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
if ( size_changed ||
|
||||
( stdVW > 0 && stdVW != globals->standard_vertical_width ) )
|
||||
{
|
||||
FT_Fixed darken_by_font_units_x, darken_x;
|
||||
|
||||
|
||||
darken_by_font_units_x =
|
||||
af_intToFixed( af_loader_compute_darkening( loader,
|
||||
face,
|
||||
stdVW ) );
|
||||
darken_x = FT_DivFix( FT_MulFix( darken_by_font_units_x,
|
||||
size_metrics->x_scale ),
|
||||
em_ratio );
|
||||
|
||||
globals->standard_vertical_width = stdVW;
|
||||
globals->stem_darkening_for_ppem = size_metrics->x_ppem;
|
||||
globals->darken_x = af_fixedToInt( darken_x );
|
||||
}
|
||||
|
||||
if ( size_changed ||
|
||||
( stdHW > 0 && stdHW != globals->standard_horizontal_width ) )
|
||||
{
|
||||
FT_Fixed darken_by_font_units_y, darken_y;
|
||||
|
||||
|
||||
darken_by_font_units_y =
|
||||
af_intToFixed( af_loader_compute_darkening( loader,
|
||||
face,
|
||||
stdHW ) );
|
||||
darken_y = FT_DivFix( FT_MulFix( darken_by_font_units_y,
|
||||
size_metrics->y_scale ),
|
||||
em_ratio );
|
||||
|
||||
globals->standard_horizontal_width = stdHW;
|
||||
globals->stem_darkening_for_ppem = size_metrics->x_ppem;
|
||||
globals->darken_y = af_fixedToInt( darken_y );
|
||||
|
||||
/*
|
||||
* Scale outlines down on the Y-axis to keep them inside their blue
|
||||
* zones. The stronger the emboldening, the stronger the downscaling
|
||||
* (plus heuristical padding to prevent outlines still falling out
|
||||
* their zones due to rounding).
|
||||
*
|
||||
* Reason: `FT_Outline_Embolden' works by shifting the rightmost
|
||||
* points of stems farther to the right, and topmost points farther
|
||||
* up. This positions points on the Y-axis outside their
|
||||
* pre-computed blue zones and leads to distortion when applying the
|
||||
* hints in the code further below. Code outside this emboldening
|
||||
* block doesn't know we are presenting it with modified outlines the
|
||||
* analyzer didn't see!
|
||||
*
|
||||
* An unfortunate side effect of downscaling is that the emboldening
|
||||
* effect is slightly decreased. The loss becomes more pronounced
|
||||
* versus the CFF driver at smaller sizes, e.g., at 9ppem and below.
|
||||
*/
|
||||
globals->scale_down_factor =
|
||||
FT_DivFix( em_size - ( darken_by_font_units_y + af_intToFixed( 8 ) ),
|
||||
em_size );
|
||||
}
|
||||
|
||||
FT_Outline_EmboldenXY( &slot->outline,
|
||||
globals->darken_x,
|
||||
globals->darken_y );
|
||||
|
||||
scale_down_matrix.yy = globals->scale_down_factor;
|
||||
FT_Outline_Transform( &slot->outline, &scale_down_matrix );
|
||||
|
||||
Exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
/* Load the glyph at index into the current slot of a face and hint it. */
|
||||
|
||||
FT_LOCAL_DEF( FT_Error )
|
||||
af_loader_load_glyph( AF_Loader loader,
|
||||
AF_Module module,
|
||||
FT_Face face,
|
||||
FT_UInt glyph_index,
|
||||
FT_Int32 load_flags )
|
||||
{
|
||||
FT_Error error;
|
||||
|
||||
FT_Size size = face->size;
|
||||
FT_Size_Internal size_internal = size->internal;
|
||||
FT_GlyphSlot slot = face->glyph;
|
||||
FT_Slot_Internal slot_internal = slot->internal;
|
||||
FT_GlyphLoader gloader = slot_internal->loader;
|
||||
|
||||
AF_GlyphHints hints = loader->hints;
|
||||
AF_ScalerRec scaler;
|
||||
AF_StyleMetrics style_metrics;
|
||||
FT_UInt style_options = AF_STYLE_NONE_DFLT;
|
||||
AF_StyleClass style_class;
|
||||
AF_WritingSystemClass writing_system_class;
|
||||
|
||||
#ifdef FT_CONFIG_OPTION_PIC
|
||||
AF_FaceGlobals globals = loader->globals;
|
||||
#endif
|
||||
|
||||
|
||||
if ( !size )
|
||||
return FT_THROW( Invalid_Size_Handle );
|
||||
|
||||
FT_ZERO( &scaler );
|
||||
|
||||
if ( !size_internal->autohint_metrics.x_scale ||
|
||||
size_internal->autohint_mode != FT_LOAD_TARGET_MODE( load_flags ) )
|
||||
{
|
||||
/* switching between hinting modes usually means different scaling */
|
||||
/* values; this later on enforces recomputation of everything */
|
||||
/* related to the current size */
|
||||
|
||||
size_internal->autohint_mode = FT_LOAD_TARGET_MODE( load_flags );
|
||||
size_internal->autohint_metrics = size->metrics;
|
||||
|
||||
#ifdef AF_CONFIG_OPTION_TT_SIZE_METRICS
|
||||
{
|
||||
FT_Size_Metrics* size_metrics = &size_internal->autohint_metrics;
|
||||
|
||||
|
||||
/* set metrics to integer values and adjust scaling accordingly; */
|
||||
/* this is the same setup as with TrueType fonts, cf. function */
|
||||
/* `tt_size_reset' in file `ttobjs.c' */
|
||||
size_metrics->ascender = FT_PIX_ROUND(
|
||||
FT_MulFix( face->ascender,
|
||||
size_metrics->y_scale ) );
|
||||
size_metrics->descender = FT_PIX_ROUND(
|
||||
FT_MulFix( face->descender,
|
||||
size_metrics->y_scale ) );
|
||||
size_metrics->height = FT_PIX_ROUND(
|
||||
FT_MulFix( face->height,
|
||||
size_metrics->y_scale ) );
|
||||
|
||||
size_metrics->x_scale = FT_DivFix( size_metrics->x_ppem << 6,
|
||||
face->units_per_EM );
|
||||
size_metrics->y_scale = FT_DivFix( size_metrics->y_ppem << 6,
|
||||
face->units_per_EM );
|
||||
size_metrics->max_advance = FT_PIX_ROUND(
|
||||
FT_MulFix( face->max_advance_width,
|
||||
size_metrics->x_scale ) );
|
||||
}
|
||||
#endif /* AF_CONFIG_OPTION_TT_SIZE_METRICS */
|
||||
}
|
||||
|
||||
/*
|
||||
* TODO: This code currently doesn't support fractional advance widths,
|
||||
* i.e., placing hinted glyphs at anything other than integer
|
||||
* x-positions. This is only relevant for the warper code, which
|
||||
* scales and shifts glyphs to optimize blackness of stems (hinting on
|
||||
* the x-axis by nature places things on pixel integers, hinting on the
|
||||
* y-axis only, i.e., LIGHT mode, doesn't touch the x-axis). The delta
|
||||
* values of the scaler would need to be adjusted.
|
||||
*/
|
||||
scaler.face = face;
|
||||
scaler.x_scale = size_internal->autohint_metrics.x_scale;
|
||||
scaler.x_delta = 0;
|
||||
scaler.y_scale = size_internal->autohint_metrics.y_scale;
|
||||
scaler.y_delta = 0;
|
||||
|
||||
scaler.render_mode = FT_LOAD_TARGET_MODE( load_flags );
|
||||
scaler.flags = 0;
|
||||
|
||||
/* note that the fallback style can't be changed anymore */
|
||||
/* after the first call of `af_loader_load_glyph' */
|
||||
error = af_loader_reset( loader, module, face );
|
||||
if ( error )
|
||||
goto Exit;
|
||||
|
||||
#ifdef FT_OPTION_AUTOFIT2
|
||||
/* XXX: undocumented hook to activate the latin2 writing system. */
|
||||
if ( load_flags & ( 1UL << 20 ) )
|
||||
style_options = AF_STYLE_LTN2_DFLT;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Glyphs (really code points) are assigned to scripts. Script
|
||||
* analysis is done lazily: For each glyph that passes through here,
|
||||
* the corresponding script analyzer is called, but returns immediately
|
||||
* if it has been run already.
|
||||
*/
|
||||
error = af_face_globals_get_metrics( loader->globals, glyph_index,
|
||||
style_options, &style_metrics );
|
||||
if ( error )
|
||||
goto Exit;
|
||||
|
||||
style_class = style_metrics->style_class;
|
||||
writing_system_class =
|
||||
AF_WRITING_SYSTEM_CLASSES_GET[style_class->writing_system];
|
||||
|
||||
loader->metrics = style_metrics;
|
||||
|
||||
if ( writing_system_class->style_metrics_scale )
|
||||
writing_system_class->style_metrics_scale( style_metrics, &scaler );
|
||||
else
|
||||
style_metrics->scaler = scaler;
|
||||
|
||||
if ( writing_system_class->style_hints_init )
|
||||
{
|
||||
error = writing_system_class->style_hints_init( hints,
|
||||
style_metrics );
|
||||
if ( error )
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
/*
|
||||
* Do the main work of `af_loader_load_glyph'. Note that we never have
|
||||
* to deal with composite glyphs as those get loaded into
|
||||
* FT_GLYPH_FORMAT_OUTLINE by the recursed `FT_Load_Glyph' function.
|
||||
* In the rare cases where FT_LOAD_NO_RECURSE is set, it implies
|
||||
* FT_LOAD_NO_SCALE and as such the auto-hinter is never called.
|
||||
*/
|
||||
load_flags |= FT_LOAD_NO_SCALE |
|
||||
FT_LOAD_IGNORE_TRANSFORM |
|
||||
FT_LOAD_LINEAR_DESIGN;
|
||||
load_flags &= ~FT_LOAD_RENDER;
|
||||
|
||||
error = FT_Load_Glyph( face, glyph_index, load_flags );
|
||||
if ( error )
|
||||
goto Exit;
|
||||
|
||||
/*
|
||||
* Apply stem darkening (emboldening) here before hints are applied to
|
||||
* the outline. Glyphs are scaled down proportionally to the
|
||||
* emboldening so that curve points don't fall outside their
|
||||
* precomputed blue zones.
|
||||
*
|
||||
* Any emboldening done by the font driver (e.g., the CFF driver)
|
||||
* doesn't reach here because the autohinter loads the unprocessed
|
||||
* glyphs in font units for analysis (functions `af_*_metrics_init_*')
|
||||
* and then above to prepare it for the rasterizers by itself,
|
||||
* independently of the font driver. So emboldening must be done here,
|
||||
* within the autohinter.
|
||||
*
|
||||
* All glyphs to be autohinted pass through here one by one. The
|
||||
* standard widths can therefore change from one glyph to the next,
|
||||
* depending on what script a glyph is assigned to (each script has its
|
||||
* own set of standard widths and other metrics). The darkening amount
|
||||
* must therefore be recomputed for each size and
|
||||
* `standard_{vertical,horizontal}_width' change.
|
||||
*
|
||||
* Ignore errors and carry on without emboldening.
|
||||
*
|
||||
*/
|
||||
|
||||
/* stem darkening only works well in `light' mode */
|
||||
if ( scaler.render_mode == FT_RENDER_MODE_LIGHT &&
|
||||
( !face->internal->no_stem_darkening ||
|
||||
( face->internal->no_stem_darkening < 0 &&
|
||||
!module->no_stem_darkening ) ) )
|
||||
af_loader_embolden_glyph_in_slot( loader, face, style_metrics );
|
||||
|
||||
loader->transformed = slot_internal->glyph_transformed;
|
||||
if ( loader->transformed )
|
||||
{
|
||||
FT_Matrix inverse;
|
||||
|
||||
|
||||
loader->trans_matrix = slot_internal->glyph_matrix;
|
||||
loader->trans_delta = slot_internal->glyph_delta;
|
||||
|
||||
inverse = loader->trans_matrix;
|
||||
if ( !FT_Matrix_Invert( &inverse ) )
|
||||
FT_Vector_Transform( &loader->trans_delta, &inverse );
|
||||
}
|
||||
|
||||
switch ( slot->format )
|
||||
{
|
||||
case FT_GLYPH_FORMAT_OUTLINE:
|
||||
/* translate the loaded glyph when an internal transform is needed */
|
||||
if ( loader->transformed )
|
||||
FT_Outline_Translate( &slot->outline,
|
||||
loader->trans_delta.x,
|
||||
loader->trans_delta.y );
|
||||
|
||||
/* compute original horizontal phantom points */
|
||||
/* (and ignore vertical ones) */
|
||||
loader->pp1.x = hints->x_delta;
|
||||
loader->pp1.y = hints->y_delta;
|
||||
loader->pp2.x = FT_MulFix( slot->metrics.horiAdvance,
|
||||
hints->x_scale ) + hints->x_delta;
|
||||
loader->pp2.y = hints->y_delta;
|
||||
|
||||
/* be sure to check for spacing glyphs */
|
||||
if ( slot->outline.n_points == 0 )
|
||||
goto Hint_Metrics;
|
||||
|
||||
/* now load the slot image into the auto-outline */
|
||||
/* and run the automatic hinting process */
|
||||
if ( writing_system_class->style_hints_apply )
|
||||
writing_system_class->style_hints_apply( glyph_index,
|
||||
hints,
|
||||
&gloader->base.outline,
|
||||
style_metrics );
|
||||
|
||||
/* we now need to adjust the metrics according to the change in */
|
||||
/* width/positioning that occurred during the hinting process */
|
||||
if ( scaler.render_mode != FT_RENDER_MODE_LIGHT )
|
||||
{
|
||||
FT_Pos old_rsb, old_lsb, new_lsb;
|
||||
FT_Pos pp1x_uh, pp2x_uh;
|
||||
|
||||
AF_AxisHints axis = &hints->axis[AF_DIMENSION_HORZ];
|
||||
AF_Edge edge1 = axis->edges; /* leftmost edge */
|
||||
AF_Edge edge2 = edge1 +
|
||||
axis->num_edges - 1; /* rightmost edge */
|
||||
|
||||
|
||||
if ( axis->num_edges > 1 && AF_HINTS_DO_ADVANCE( hints ) )
|
||||
{
|
||||
old_rsb = loader->pp2.x - edge2->opos;
|
||||
/* loader->pp1.x is always zero at this point of time */
|
||||
old_lsb = edge1->opos /* - loader->pp1.x */;
|
||||
new_lsb = edge1->pos;
|
||||
|
||||
/* remember unhinted values to later account */
|
||||
/* for rounding errors */
|
||||
pp1x_uh = new_lsb - old_lsb;
|
||||
pp2x_uh = edge2->pos + old_rsb;
|
||||
|
||||
/* prefer too much space over too little space */
|
||||
/* for very small sizes */
|
||||
|
||||
if ( old_lsb < 24 )
|
||||
pp1x_uh -= 8;
|
||||
|
||||
if ( old_rsb < 24 )
|
||||
pp2x_uh += 8;
|
||||
|
||||
loader->pp1.x = FT_PIX_ROUND( pp1x_uh );
|
||||
loader->pp2.x = FT_PIX_ROUND( pp2x_uh );
|
||||
|
||||
if ( loader->pp1.x >= new_lsb && old_lsb > 0 )
|
||||
loader->pp1.x -= 64;
|
||||
|
||||
if ( loader->pp2.x <= edge2->pos && old_rsb > 0 )
|
||||
loader->pp2.x += 64;
|
||||
|
||||
slot->lsb_delta = loader->pp1.x - pp1x_uh;
|
||||
slot->rsb_delta = loader->pp2.x - pp2x_uh;
|
||||
}
|
||||
else
|
||||
{
|
||||
FT_Pos pp1x = loader->pp1.x;
|
||||
FT_Pos pp2x = loader->pp2.x;
|
||||
|
||||
|
||||
loader->pp1.x = FT_PIX_ROUND( pp1x + hints->xmin_delta );
|
||||
loader->pp2.x = FT_PIX_ROUND( pp2x + hints->xmax_delta );
|
||||
|
||||
slot->lsb_delta = loader->pp1.x - pp1x;
|
||||
slot->rsb_delta = loader->pp2.x - pp2x;
|
||||
}
|
||||
}
|
||||
/* `light' mode uses integer advance widths */
|
||||
/* but sets `lsb_delta' and `rsb_delta' */
|
||||
else
|
||||
{
|
||||
FT_Pos pp1x = loader->pp1.x;
|
||||
FT_Pos pp2x = loader->pp2.x;
|
||||
|
||||
|
||||
loader->pp1.x = FT_PIX_ROUND( pp1x );
|
||||
loader->pp2.x = FT_PIX_ROUND( pp2x );
|
||||
|
||||
slot->lsb_delta = loader->pp1.x - pp1x;
|
||||
slot->rsb_delta = loader->pp2.x - pp2x;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
/* we don't support other formats (yet?) */
|
||||
error = FT_THROW( Unimplemented_Feature );
|
||||
}
|
||||
|
||||
Hint_Metrics:
|
||||
{
|
||||
FT_BBox bbox;
|
||||
FT_Vector vvector;
|
||||
|
||||
|
||||
vvector.x = slot->metrics.vertBearingX - slot->metrics.horiBearingX;
|
||||
vvector.y = slot->metrics.vertBearingY - slot->metrics.horiBearingY;
|
||||
vvector.x = FT_MulFix( vvector.x, style_metrics->scaler.x_scale );
|
||||
vvector.y = FT_MulFix( vvector.y, style_metrics->scaler.y_scale );
|
||||
|
||||
/* transform the hinted outline if needed */
|
||||
if ( loader->transformed )
|
||||
{
|
||||
FT_Outline_Transform( &gloader->base.outline, &loader->trans_matrix );
|
||||
FT_Vector_Transform( &vvector, &loader->trans_matrix );
|
||||
}
|
||||
|
||||
/* we must translate our final outline by -pp1.x and compute */
|
||||
/* the new metrics */
|
||||
if ( loader->pp1.x )
|
||||
FT_Outline_Translate( &gloader->base.outline, -loader->pp1.x, 0 );
|
||||
|
||||
FT_Outline_Get_CBox( &gloader->base.outline, &bbox );
|
||||
|
||||
bbox.xMin = FT_PIX_FLOOR( bbox.xMin );
|
||||
bbox.yMin = FT_PIX_FLOOR( bbox.yMin );
|
||||
bbox.xMax = FT_PIX_CEIL( bbox.xMax );
|
||||
bbox.yMax = FT_PIX_CEIL( bbox.yMax );
|
||||
|
||||
slot->metrics.width = bbox.xMax - bbox.xMin;
|
||||
slot->metrics.height = bbox.yMax - bbox.yMin;
|
||||
slot->metrics.horiBearingX = bbox.xMin;
|
||||
slot->metrics.horiBearingY = bbox.yMax;
|
||||
|
||||
slot->metrics.vertBearingX = FT_PIX_FLOOR( bbox.xMin + vvector.x );
|
||||
slot->metrics.vertBearingY = FT_PIX_FLOOR( bbox.yMax + vvector.y );
|
||||
|
||||
/* for mono-width fonts (like Andale, Courier, etc.) we need */
|
||||
/* to keep the original rounded advance width; ditto for */
|
||||
/* digits if all have the same advance width */
|
||||
if ( scaler.render_mode != FT_RENDER_MODE_LIGHT &&
|
||||
( FT_IS_FIXED_WIDTH( slot->face ) ||
|
||||
( af_face_globals_is_digit( loader->globals, glyph_index ) &&
|
||||
style_metrics->digits_have_same_width ) ) )
|
||||
{
|
||||
slot->metrics.horiAdvance =
|
||||
FT_MulFix( slot->metrics.horiAdvance,
|
||||
style_metrics->scaler.x_scale );
|
||||
|
||||
/* Set delta values to 0. Otherwise code that uses them is */
|
||||
/* going to ruin the fixed advance width. */
|
||||
slot->lsb_delta = 0;
|
||||
slot->rsb_delta = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* non-spacing glyphs must stay as-is */
|
||||
if ( slot->metrics.horiAdvance )
|
||||
slot->metrics.horiAdvance = loader->pp2.x - loader->pp1.x;
|
||||
}
|
||||
|
||||
slot->metrics.vertAdvance = FT_MulFix( slot->metrics.vertAdvance,
|
||||
style_metrics->scaler.y_scale );
|
||||
|
||||
slot->metrics.horiAdvance = FT_PIX_ROUND( slot->metrics.horiAdvance );
|
||||
slot->metrics.vertAdvance = FT_PIX_ROUND( slot->metrics.vertAdvance );
|
||||
|
||||
slot->format = FT_GLYPH_FORMAT_OUTLINE;
|
||||
}
|
||||
|
||||
Exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Compute amount of font units the face should be emboldened by, in
|
||||
* analogy to the CFF driver's `cf2_computeDarkening' function. See there
|
||||
* for details of the algorithm.
|
||||
*
|
||||
* XXX: Currently a crude adaption of the original algorithm. Do better?
|
||||
*/
|
||||
FT_LOCAL_DEF( FT_Int32 )
|
||||
af_loader_compute_darkening( AF_Loader loader,
|
||||
FT_Face face,
|
||||
FT_Pos standard_width )
|
||||
{
|
||||
AF_Module module = loader->globals->module;
|
||||
|
||||
FT_UShort units_per_EM;
|
||||
FT_Fixed ppem, em_ratio;
|
||||
FT_Fixed stem_width, stem_width_per_1000, scaled_stem, darken_amount;
|
||||
FT_Int log_base_2;
|
||||
FT_Int x1, y1, x2, y2, x3, y3, x4, y4;
|
||||
|
||||
|
||||
ppem = FT_MAX( af_intToFixed( 4 ),
|
||||
af_intToFixed( face->size->metrics.x_ppem ) );
|
||||
units_per_EM = face->units_per_EM;
|
||||
|
||||
em_ratio = FT_DivFix( af_intToFixed( 1000 ),
|
||||
af_intToFixed ( units_per_EM ) );
|
||||
if ( em_ratio < af_floatToFixed( .01 ) )
|
||||
{
|
||||
/* If something goes wrong, don't embolden. */
|
||||
return 0;
|
||||
}
|
||||
|
||||
x1 = module->darken_params[0];
|
||||
y1 = module->darken_params[1];
|
||||
x2 = module->darken_params[2];
|
||||
y2 = module->darken_params[3];
|
||||
x3 = module->darken_params[4];
|
||||
y3 = module->darken_params[5];
|
||||
x4 = module->darken_params[6];
|
||||
y4 = module->darken_params[7];
|
||||
|
||||
if ( standard_width <= 0 )
|
||||
{
|
||||
stem_width = af_intToFixed( 75 ); /* taken from cf2font.c */
|
||||
stem_width_per_1000 = stem_width;
|
||||
}
|
||||
else
|
||||
{
|
||||
stem_width = af_intToFixed( standard_width );
|
||||
stem_width_per_1000 = FT_MulFix( stem_width, em_ratio );
|
||||
}
|
||||
|
||||
log_base_2 = FT_MSB( (FT_UInt32)stem_width_per_1000 ) +
|
||||
FT_MSB( (FT_UInt32)ppem );
|
||||
|
||||
if ( log_base_2 >= 46 )
|
||||
{
|
||||
/* possible overflow */
|
||||
scaled_stem = af_intToFixed( x4 );
|
||||
}
|
||||
else
|
||||
scaled_stem = FT_MulFix( stem_width_per_1000, ppem );
|
||||
|
||||
/* now apply the darkening parameters */
|
||||
if ( scaled_stem < af_intToFixed( x1 ) )
|
||||
darken_amount = FT_DivFix( af_intToFixed( y1 ), ppem );
|
||||
|
||||
else if ( scaled_stem < af_intToFixed( x2 ) )
|
||||
{
|
||||
FT_Int xdelta = x2 - x1;
|
||||
FT_Int ydelta = y2 - y1;
|
||||
FT_Int x = stem_width_per_1000 -
|
||||
FT_DivFix( af_intToFixed( x1 ), ppem );
|
||||
|
||||
|
||||
if ( !xdelta )
|
||||
goto Try_x3;
|
||||
|
||||
darken_amount = FT_MulDiv( x, ydelta, xdelta ) +
|
||||
FT_DivFix( af_intToFixed( y1 ), ppem );
|
||||
}
|
||||
|
||||
else if ( scaled_stem < af_intToFixed( x3 ) )
|
||||
{
|
||||
Try_x3:
|
||||
{
|
||||
FT_Int xdelta = x3 - x2;
|
||||
FT_Int ydelta = y3 - y2;
|
||||
FT_Int x = stem_width_per_1000 -
|
||||
FT_DivFix( af_intToFixed( x2 ), ppem );
|
||||
|
||||
|
||||
if ( !xdelta )
|
||||
goto Try_x4;
|
||||
|
||||
darken_amount = FT_MulDiv( x, ydelta, xdelta ) +
|
||||
FT_DivFix( af_intToFixed( y2 ), ppem );
|
||||
}
|
||||
}
|
||||
|
||||
else if ( scaled_stem < af_intToFixed( x4 ) )
|
||||
{
|
||||
Try_x4:
|
||||
{
|
||||
FT_Int xdelta = x4 - x3;
|
||||
FT_Int ydelta = y4 - y3;
|
||||
FT_Int x = stem_width_per_1000 -
|
||||
FT_DivFix( af_intToFixed( x3 ), ppem );
|
||||
|
||||
|
||||
if ( !xdelta )
|
||||
goto Use_y4;
|
||||
|
||||
darken_amount = FT_MulDiv( x, ydelta, xdelta ) +
|
||||
FT_DivFix( af_intToFixed( y3 ), ppem );
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
Use_y4:
|
||||
darken_amount = FT_DivFix( af_intToFixed( y4 ), ppem );
|
||||
}
|
||||
|
||||
/* Convert darken_amount from per 1000 em to true character space. */
|
||||
return af_fixedToInt( FT_DivFix( darken_amount, em_ratio ) );
|
||||
}
|
||||
|
||||
|
||||
/* END */
|
||||
91
vendor/FreeType2/src/autofit/afloader.h
vendored
Normal file
91
vendor/FreeType2/src/autofit/afloader.h
vendored
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
/***************************************************************************/
|
||||
/* */
|
||||
/* afloader.h */
|
||||
/* */
|
||||
/* Auto-fitter glyph loading routines (specification). */
|
||||
/* */
|
||||
/* Copyright 2003-2018 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. */
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
|
||||
#ifndef AFLOADER_H_
|
||||
#define AFLOADER_H_
|
||||
|
||||
#include "afhints.h"
|
||||
#include "afmodule.h"
|
||||
#include "afglobal.h"
|
||||
|
||||
|
||||
FT_BEGIN_HEADER
|
||||
|
||||
/*
|
||||
* The autofitter module's (global) data structure to communicate with
|
||||
* actual fonts. If necessary, `local' data like the current face, the
|
||||
* current face's auto-hint data, or the current glyph's parameters
|
||||
* relevant to auto-hinting are `swapped in'. Cf. functions like
|
||||
* `af_loader_reset' and `af_loader_load_g'.
|
||||
*/
|
||||
|
||||
typedef struct AF_LoaderRec_
|
||||
{
|
||||
/* current face data */
|
||||
FT_Face face;
|
||||
AF_FaceGlobals globals;
|
||||
|
||||
/* current glyph data */
|
||||
AF_GlyphHints hints;
|
||||
AF_StyleMetrics metrics;
|
||||
FT_Bool transformed;
|
||||
FT_Matrix trans_matrix;
|
||||
FT_Vector trans_delta;
|
||||
FT_Vector pp1;
|
||||
FT_Vector pp2;
|
||||
/* we don't handle vertical phantom points */
|
||||
|
||||
} AF_LoaderRec, *AF_Loader;
|
||||
|
||||
|
||||
FT_LOCAL( void )
|
||||
af_loader_init( AF_Loader loader,
|
||||
AF_GlyphHints hints );
|
||||
|
||||
|
||||
FT_LOCAL( FT_Error )
|
||||
af_loader_reset( AF_Loader loader,
|
||||
AF_Module module,
|
||||
FT_Face face );
|
||||
|
||||
|
||||
FT_LOCAL( void )
|
||||
af_loader_done( AF_Loader loader );
|
||||
|
||||
|
||||
FT_LOCAL( FT_Error )
|
||||
af_loader_load_glyph( AF_Loader loader,
|
||||
AF_Module module,
|
||||
FT_Face face,
|
||||
FT_UInt gindex,
|
||||
FT_Int32 load_flags );
|
||||
|
||||
FT_LOCAL_DEF( FT_Int32 )
|
||||
af_loader_compute_darkening( AF_Loader loader,
|
||||
FT_Face face,
|
||||
FT_Pos standard_width );
|
||||
|
||||
/* */
|
||||
|
||||
|
||||
FT_END_HEADER
|
||||
|
||||
#endif /* AFLOADER_H_ */
|
||||
|
||||
|
||||
/* END */
|
||||
600
vendor/FreeType2/src/autofit/afmodule.c
vendored
Normal file
600
vendor/FreeType2/src/autofit/afmodule.c
vendored
Normal file
|
|
@ -0,0 +1,600 @@
|
|||
/***************************************************************************/
|
||||
/* */
|
||||
/* afmodule.c */
|
||||
/* */
|
||||
/* Auto-fitter module implementation (body). */
|
||||
/* */
|
||||
/* Copyright 2003-2018 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 "afglobal.h"
|
||||
#include "afmodule.h"
|
||||
#include "afloader.h"
|
||||
#include "aferrors.h"
|
||||
#include "afpic.h"
|
||||
|
||||
#ifdef FT_DEBUG_AUTOFIT
|
||||
|
||||
#ifndef FT_MAKE_OPTION_SINGLE_OBJECT
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
extern void
|
||||
af_glyph_hints_dump_segments( AF_GlyphHints hints,
|
||||
FT_Bool to_stdout );
|
||||
extern void
|
||||
af_glyph_hints_dump_points( AF_GlyphHints hints,
|
||||
FT_Bool to_stdout );
|
||||
extern void
|
||||
af_glyph_hints_dump_edges( AF_GlyphHints hints,
|
||||
FT_Bool to_stdout );
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
int _af_debug_disable_horz_hints;
|
||||
int _af_debug_disable_vert_hints;
|
||||
int _af_debug_disable_blue_hints;
|
||||
|
||||
/* we use a global object instead of a local one for debugging */
|
||||
AF_GlyphHintsRec _af_debug_hints_rec[1];
|
||||
|
||||
void* _af_debug_hints = _af_debug_hints_rec;
|
||||
#endif
|
||||
|
||||
#include FT_INTERNAL_OBJECTS_H
|
||||
#include FT_INTERNAL_DEBUG_H
|
||||
#include FT_DRIVER_H
|
||||
#include FT_SERVICE_PROPERTIES_H
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* 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_afmodule
|
||||
|
||||
|
||||
static FT_Error
|
||||
af_property_get_face_globals( FT_Face face,
|
||||
AF_FaceGlobals* aglobals,
|
||||
AF_Module module )
|
||||
{
|
||||
FT_Error error = FT_Err_Ok;
|
||||
AF_FaceGlobals globals;
|
||||
|
||||
|
||||
if ( !face )
|
||||
return FT_THROW( Invalid_Face_Handle );
|
||||
|
||||
globals = (AF_FaceGlobals)face->autohint.data;
|
||||
if ( !globals )
|
||||
{
|
||||
/* trigger computation of the global style data */
|
||||
/* in case it hasn't been done yet */
|
||||
error = af_face_globals_new( face, &globals, module );
|
||||
if ( !error )
|
||||
{
|
||||
face->autohint.data =
|
||||
(FT_Pointer)globals;
|
||||
face->autohint.finalizer =
|
||||
(FT_Generic_Finalizer)af_face_globals_free;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !error )
|
||||
*aglobals = globals;
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
#ifdef FT_CONFIG_OPTION_PIC
|
||||
|
||||
#undef AF_SCRIPT_CLASSES_GET
|
||||
#define AF_SCRIPT_CLASSES_GET \
|
||||
( GET_PIC( ft_module->library )->af_script_classes )
|
||||
|
||||
#undef AF_STYLE_CLASSES_GET
|
||||
#define AF_STYLE_CLASSES_GET \
|
||||
( GET_PIC( ft_module->library )->af_style_classes )
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
static FT_Error
|
||||
af_property_set( FT_Module ft_module,
|
||||
const char* property_name,
|
||||
const void* value,
|
||||
FT_Bool value_is_string )
|
||||
{
|
||||
FT_Error error = FT_Err_Ok;
|
||||
AF_Module module = (AF_Module)ft_module;
|
||||
|
||||
#ifndef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
|
||||
FT_UNUSED( value_is_string );
|
||||
#endif
|
||||
|
||||
|
||||
if ( !ft_strcmp( property_name, "fallback-script" ) )
|
||||
{
|
||||
FT_UInt* fallback_script;
|
||||
FT_UInt ss;
|
||||
|
||||
|
||||
#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
|
||||
if ( value_is_string )
|
||||
return FT_THROW( Invalid_Argument );
|
||||
#endif
|
||||
|
||||
fallback_script = (FT_UInt*)value;
|
||||
|
||||
/* We translate the fallback script to a fallback style that uses */
|
||||
/* `fallback-script' as its script and `AF_COVERAGE_NONE' as its */
|
||||
/* coverage value. */
|
||||
for ( ss = 0; AF_STYLE_CLASSES_GET[ss]; ss++ )
|
||||
{
|
||||
AF_StyleClass style_class = AF_STYLE_CLASSES_GET[ss];
|
||||
|
||||
|
||||
if ( (FT_UInt)style_class->script == *fallback_script &&
|
||||
style_class->coverage == AF_COVERAGE_DEFAULT )
|
||||
{
|
||||
module->fallback_style = ss;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !AF_STYLE_CLASSES_GET[ss] )
|
||||
{
|
||||
FT_TRACE0(( "af_property_set: Invalid value %d for property `%s'\n",
|
||||
fallback_script, property_name ));
|
||||
return FT_THROW( Invalid_Argument );
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
else if ( !ft_strcmp( property_name, "default-script" ) )
|
||||
{
|
||||
FT_UInt* default_script;
|
||||
|
||||
|
||||
#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
|
||||
if ( value_is_string )
|
||||
return FT_THROW( Invalid_Argument );
|
||||
#endif
|
||||
|
||||
default_script = (FT_UInt*)value;
|
||||
|
||||
module->default_script = *default_script;
|
||||
|
||||
return error;
|
||||
}
|
||||
else if ( !ft_strcmp( property_name, "increase-x-height" ) )
|
||||
{
|
||||
FT_Prop_IncreaseXHeight* prop;
|
||||
AF_FaceGlobals globals;
|
||||
|
||||
|
||||
#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
|
||||
if ( value_is_string )
|
||||
return FT_THROW( Invalid_Argument );
|
||||
#endif
|
||||
|
||||
prop = (FT_Prop_IncreaseXHeight*)value;
|
||||
|
||||
error = af_property_get_face_globals( prop->face, &globals, module );
|
||||
if ( !error )
|
||||
globals->increase_x_height = prop->limit;
|
||||
|
||||
return error;
|
||||
}
|
||||
#ifdef AF_CONFIG_OPTION_USE_WARPER
|
||||
else if ( !ft_strcmp( property_name, "warping" ) )
|
||||
{
|
||||
#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
|
||||
if ( value_is_string )
|
||||
{
|
||||
const char* s = (const char*)value;
|
||||
long w = ft_strtol( s, NULL, 10 );
|
||||
|
||||
|
||||
if ( w == 0 )
|
||||
module->warping = 0;
|
||||
else if ( w == 1 )
|
||||
module->warping = 1;
|
||||
else
|
||||
return FT_THROW( Invalid_Argument );
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
FT_Bool* warping = (FT_Bool*)value;
|
||||
|
||||
|
||||
module->warping = *warping;
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
#endif /* AF_CONFIG_OPTION_USE_WARPER */
|
||||
else if ( !ft_strcmp( property_name, "darkening-parameters" ) )
|
||||
{
|
||||
FT_Int* darken_params;
|
||||
FT_Int x1, y1, x2, y2, x3, y3, x4, y4;
|
||||
|
||||
#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
|
||||
FT_Int dp[8];
|
||||
|
||||
|
||||
if ( value_is_string )
|
||||
{
|
||||
const char* s = (const char*)value;
|
||||
char* ep;
|
||||
int i;
|
||||
|
||||
|
||||
/* eight comma-separated numbers */
|
||||
for ( i = 0; i < 7; i++ )
|
||||
{
|
||||
dp[i] = (FT_Int)ft_strtol( s, &ep, 10 );
|
||||
if ( *ep != ',' || s == ep )
|
||||
return FT_THROW( Invalid_Argument );
|
||||
|
||||
s = ep + 1;
|
||||
}
|
||||
|
||||
dp[7] = (FT_Int)ft_strtol( s, &ep, 10 );
|
||||
if ( !( *ep == '\0' || *ep == ' ' ) || s == ep )
|
||||
return FT_THROW( Invalid_Argument );
|
||||
|
||||
darken_params = dp;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
darken_params = (FT_Int*)value;
|
||||
|
||||
x1 = darken_params[0];
|
||||
y1 = darken_params[1];
|
||||
x2 = darken_params[2];
|
||||
y2 = darken_params[3];
|
||||
x3 = darken_params[4];
|
||||
y3 = darken_params[5];
|
||||
x4 = darken_params[6];
|
||||
y4 = darken_params[7];
|
||||
|
||||
if ( x1 < 0 || x2 < 0 || x3 < 0 || x4 < 0 ||
|
||||
y1 < 0 || y2 < 0 || y3 < 0 || y4 < 0 ||
|
||||
x1 > x2 || x2 > x3 || x3 > x4 ||
|
||||
y1 > 500 || y2 > 500 || y3 > 500 || y4 > 500 )
|
||||
return FT_THROW( Invalid_Argument );
|
||||
|
||||
module->darken_params[0] = x1;
|
||||
module->darken_params[1] = y1;
|
||||
module->darken_params[2] = x2;
|
||||
module->darken_params[3] = y2;
|
||||
module->darken_params[4] = x3;
|
||||
module->darken_params[5] = y3;
|
||||
module->darken_params[6] = x4;
|
||||
module->darken_params[7] = y4;
|
||||
|
||||
return error;
|
||||
}
|
||||
else if ( !ft_strcmp( property_name, "no-stem-darkening" ) )
|
||||
{
|
||||
#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
|
||||
if ( value_is_string )
|
||||
{
|
||||
const char* s = (const char*)value;
|
||||
long nsd = ft_strtol( s, NULL, 10 );
|
||||
|
||||
|
||||
if ( !nsd )
|
||||
module->no_stem_darkening = FALSE;
|
||||
else
|
||||
module->no_stem_darkening = TRUE;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
FT_Bool* no_stem_darkening = (FT_Bool*)value;
|
||||
|
||||
|
||||
module->no_stem_darkening = *no_stem_darkening;
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
FT_TRACE0(( "af_property_set: missing property `%s'\n",
|
||||
property_name ));
|
||||
return FT_THROW( Missing_Property );
|
||||
}
|
||||
|
||||
|
||||
static FT_Error
|
||||
af_property_get( FT_Module ft_module,
|
||||
const char* property_name,
|
||||
void* value )
|
||||
{
|
||||
FT_Error error = FT_Err_Ok;
|
||||
AF_Module module = (AF_Module)ft_module;
|
||||
FT_UInt fallback_style = module->fallback_style;
|
||||
FT_UInt default_script = module->default_script;
|
||||
#ifdef AF_CONFIG_OPTION_USE_WARPER
|
||||
FT_Bool warping = module->warping;
|
||||
#endif
|
||||
|
||||
|
||||
if ( !ft_strcmp( property_name, "glyph-to-script-map" ) )
|
||||
{
|
||||
FT_Prop_GlyphToScriptMap* prop = (FT_Prop_GlyphToScriptMap*)value;
|
||||
AF_FaceGlobals globals;
|
||||
|
||||
|
||||
error = af_property_get_face_globals( prop->face, &globals, module );
|
||||
if ( !error )
|
||||
prop->map = globals->glyph_styles;
|
||||
|
||||
return error;
|
||||
}
|
||||
else if ( !ft_strcmp( property_name, "fallback-script" ) )
|
||||
{
|
||||
FT_UInt* val = (FT_UInt*)value;
|
||||
|
||||
AF_StyleClass style_class = AF_STYLE_CLASSES_GET[fallback_style];
|
||||
|
||||
|
||||
*val = style_class->script;
|
||||
|
||||
return error;
|
||||
}
|
||||
else if ( !ft_strcmp( property_name, "default-script" ) )
|
||||
{
|
||||
FT_UInt* val = (FT_UInt*)value;
|
||||
|
||||
|
||||
*val = default_script;
|
||||
|
||||
return error;
|
||||
}
|
||||
else if ( !ft_strcmp( property_name, "increase-x-height" ) )
|
||||
{
|
||||
FT_Prop_IncreaseXHeight* prop = (FT_Prop_IncreaseXHeight*)value;
|
||||
AF_FaceGlobals globals;
|
||||
|
||||
|
||||
error = af_property_get_face_globals( prop->face, &globals, module );
|
||||
if ( !error )
|
||||
prop->limit = globals->increase_x_height;
|
||||
|
||||
return error;
|
||||
}
|
||||
#ifdef AF_CONFIG_OPTION_USE_WARPER
|
||||
else if ( !ft_strcmp( property_name, "warping" ) )
|
||||
{
|
||||
FT_Bool* val = (FT_Bool*)value;
|
||||
|
||||
|
||||
*val = warping;
|
||||
|
||||
return error;
|
||||
}
|
||||
#endif /* AF_CONFIG_OPTION_USE_WARPER */
|
||||
else if ( !ft_strcmp( property_name, "darkening-parameters" ) )
|
||||
{
|
||||
FT_Int* darken_params = module->darken_params;
|
||||
FT_Int* val = (FT_Int*)value;
|
||||
|
||||
|
||||
val[0] = darken_params[0];
|
||||
val[1] = darken_params[1];
|
||||
val[2] = darken_params[2];
|
||||
val[3] = darken_params[3];
|
||||
val[4] = darken_params[4];
|
||||
val[5] = darken_params[5];
|
||||
val[6] = darken_params[6];
|
||||
val[7] = darken_params[7];
|
||||
|
||||
return error;
|
||||
}
|
||||
else if ( !ft_strcmp( property_name, "no-stem-darkening" ) )
|
||||
{
|
||||
FT_Bool no_stem_darkening = module->no_stem_darkening;
|
||||
FT_Bool* val = (FT_Bool*)value;
|
||||
|
||||
|
||||
*val = no_stem_darkening;
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
FT_TRACE0(( "af_property_get: missing property `%s'\n",
|
||||
property_name ));
|
||||
return FT_THROW( Missing_Property );
|
||||
}
|
||||
|
||||
|
||||
FT_DEFINE_SERVICE_PROPERTIESREC(
|
||||
af_service_properties,
|
||||
|
||||
(FT_Properties_SetFunc)af_property_set, /* set_property */
|
||||
(FT_Properties_GetFunc)af_property_get ) /* get_property */
|
||||
|
||||
|
||||
FT_DEFINE_SERVICEDESCREC1(
|
||||
af_services,
|
||||
|
||||
FT_SERVICE_ID_PROPERTIES, &AF_SERVICE_PROPERTIES_GET )
|
||||
|
||||
|
||||
FT_CALLBACK_DEF( FT_Module_Interface )
|
||||
af_get_interface( FT_Module module,
|
||||
const char* module_interface )
|
||||
{
|
||||
/* AF_SERVICES_GET dereferences `library' in PIC mode */
|
||||
#ifdef FT_CONFIG_OPTION_PIC
|
||||
FT_Library library;
|
||||
|
||||
|
||||
if ( !module )
|
||||
return NULL;
|
||||
library = module->library;
|
||||
if ( !library )
|
||||
return NULL;
|
||||
#else
|
||||
FT_UNUSED( module );
|
||||
#endif
|
||||
|
||||
return ft_service_list_lookup( AF_SERVICES_GET, module_interface );
|
||||
}
|
||||
|
||||
|
||||
FT_CALLBACK_DEF( FT_Error )
|
||||
af_autofitter_init( FT_Module ft_module ) /* AF_Module */
|
||||
{
|
||||
AF_Module module = (AF_Module)ft_module;
|
||||
|
||||
|
||||
module->fallback_style = AF_STYLE_FALLBACK;
|
||||
module->default_script = AF_SCRIPT_DEFAULT;
|
||||
#ifdef AF_CONFIG_OPTION_USE_WARPER
|
||||
module->warping = 0;
|
||||
#endif
|
||||
module->no_stem_darkening = TRUE;
|
||||
|
||||
module->darken_params[0] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_X1;
|
||||
module->darken_params[1] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y1;
|
||||
module->darken_params[2] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_X2;
|
||||
module->darken_params[3] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y2;
|
||||
module->darken_params[4] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_X3;
|
||||
module->darken_params[5] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y3;
|
||||
module->darken_params[6] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_X4;
|
||||
module->darken_params[7] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y4;
|
||||
|
||||
return FT_Err_Ok;
|
||||
}
|
||||
|
||||
|
||||
FT_CALLBACK_DEF( void )
|
||||
af_autofitter_done( FT_Module ft_module ) /* AF_Module */
|
||||
{
|
||||
FT_UNUSED( ft_module );
|
||||
|
||||
#ifdef FT_DEBUG_AUTOFIT
|
||||
if ( _af_debug_hints_rec->memory )
|
||||
af_glyph_hints_done( _af_debug_hints_rec );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
FT_CALLBACK_DEF( FT_Error )
|
||||
af_autofitter_load_glyph( AF_Module module,
|
||||
FT_GlyphSlot slot,
|
||||
FT_Size size,
|
||||
FT_UInt glyph_index,
|
||||
FT_Int32 load_flags )
|
||||
{
|
||||
FT_Error error = FT_Err_Ok;
|
||||
FT_Memory memory = module->root.library->memory;
|
||||
|
||||
#ifdef FT_DEBUG_AUTOFIT
|
||||
|
||||
/* in debug mode, we use a global object that survives this routine */
|
||||
|
||||
AF_GlyphHints hints = _af_debug_hints_rec;
|
||||
AF_LoaderRec loader[1];
|
||||
|
||||
FT_UNUSED( size );
|
||||
|
||||
|
||||
if ( hints->memory )
|
||||
af_glyph_hints_done( hints );
|
||||
|
||||
af_glyph_hints_init( hints, memory );
|
||||
af_loader_init( loader, hints );
|
||||
|
||||
error = af_loader_load_glyph( loader, module, slot->face,
|
||||
glyph_index, load_flags );
|
||||
|
||||
#ifdef FT_DEBUG_LEVEL_TRACE
|
||||
if ( ft_trace_levels[FT_COMPONENT] )
|
||||
{
|
||||
#endif
|
||||
af_glyph_hints_dump_points( hints, 0 );
|
||||
af_glyph_hints_dump_segments( hints, 0 );
|
||||
af_glyph_hints_dump_edges( hints, 0 );
|
||||
#ifdef FT_DEBUG_LEVEL_TRACE
|
||||
}
|
||||
#endif
|
||||
|
||||
af_loader_done( loader );
|
||||
|
||||
return error;
|
||||
|
||||
#else /* !FT_DEBUG_AUTOFIT */
|
||||
|
||||
AF_GlyphHintsRec hints[1];
|
||||
AF_LoaderRec loader[1];
|
||||
|
||||
FT_UNUSED( size );
|
||||
|
||||
|
||||
af_glyph_hints_init( hints, memory );
|
||||
af_loader_init( loader, hints );
|
||||
|
||||
error = af_loader_load_glyph( loader, module, slot->face,
|
||||
glyph_index, load_flags );
|
||||
|
||||
af_loader_done( loader );
|
||||
af_glyph_hints_done( hints );
|
||||
|
||||
return error;
|
||||
|
||||
#endif /* !FT_DEBUG_AUTOFIT */
|
||||
}
|
||||
|
||||
|
||||
FT_DEFINE_AUTOHINTER_INTERFACE(
|
||||
af_autofitter_interface,
|
||||
|
||||
NULL, /* reset_face */
|
||||
NULL, /* get_global_hints */
|
||||
NULL, /* done_global_hints */
|
||||
(FT_AutoHinter_GlyphLoadFunc)af_autofitter_load_glyph ) /* load_glyph */
|
||||
|
||||
|
||||
FT_DEFINE_MODULE(
|
||||
autofit_module_class,
|
||||
|
||||
FT_MODULE_HINTER,
|
||||
sizeof ( AF_ModuleRec ),
|
||||
|
||||
"autofitter",
|
||||
0x10000L, /* version 1.0 of the autofitter */
|
||||
0x20000L, /* requires FreeType 2.0 or above */
|
||||
|
||||
(const void*)&AF_INTERFACE_GET,
|
||||
|
||||
(FT_Module_Constructor)af_autofitter_init, /* module_init */
|
||||
(FT_Module_Destructor) af_autofitter_done, /* module_done */
|
||||
(FT_Module_Requester) af_get_interface /* get_interface */
|
||||
)
|
||||
|
||||
|
||||
/* END */
|
||||
58
vendor/FreeType2/src/autofit/afmodule.h
vendored
Normal file
58
vendor/FreeType2/src/autofit/afmodule.h
vendored
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
/***************************************************************************/
|
||||
/* */
|
||||
/* afmodule.h */
|
||||
/* */
|
||||
/* Auto-fitter module implementation (specification). */
|
||||
/* */
|
||||
/* Copyright 2003-2018 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. */
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
|
||||
#ifndef AFMODULE_H_
|
||||
#define AFMODULE_H_
|
||||
|
||||
#include <ft2build.h>
|
||||
#include FT_INTERNAL_OBJECTS_H
|
||||
#include FT_MODULE_H
|
||||
|
||||
|
||||
FT_BEGIN_HEADER
|
||||
|
||||
|
||||
/*
|
||||
* This is the `extended' FT_Module structure that holds the
|
||||
* autofitter's global data.
|
||||
*/
|
||||
|
||||
typedef struct AF_ModuleRec_
|
||||
{
|
||||
FT_ModuleRec root;
|
||||
|
||||
FT_UInt fallback_style;
|
||||
FT_UInt default_script;
|
||||
#ifdef AF_CONFIG_OPTION_USE_WARPER
|
||||
FT_Bool warping;
|
||||
#endif
|
||||
FT_Bool no_stem_darkening;
|
||||
FT_Int darken_params[8];
|
||||
|
||||
} AF_ModuleRec, *AF_Module;
|
||||
|
||||
|
||||
FT_DECLARE_MODULE( autofit_module_class )
|
||||
|
||||
|
||||
FT_END_HEADER
|
||||
|
||||
#endif /* AFMODULE_H_ */
|
||||
|
||||
|
||||
/* END */
|
||||
152
vendor/FreeType2/src/autofit/afpic.c
vendored
Normal file
152
vendor/FreeType2/src/autofit/afpic.c
vendored
Normal file
|
|
@ -0,0 +1,152 @@
|
|||
/***************************************************************************/
|
||||
/* */
|
||||
/* afpic.c */
|
||||
/* */
|
||||
/* The FreeType position independent code services for autofit module. */
|
||||
/* */
|
||||
/* Copyright 2009-2018 by */
|
||||
/* Oran Agra and Mickey Gabel. */
|
||||
/* */
|
||||
/* 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_FREETYPE_H
|
||||
#include FT_INTERNAL_OBJECTS_H
|
||||
#include "afpic.h"
|
||||
#include "afglobal.h"
|
||||
#include "aferrors.h"
|
||||
|
||||
|
||||
#ifdef FT_CONFIG_OPTION_PIC
|
||||
|
||||
/* forward declaration of PIC init functions from afmodule.c */
|
||||
FT_Error
|
||||
FT_Create_Class_af_services( FT_Library library,
|
||||
FT_ServiceDescRec** output_class );
|
||||
|
||||
void
|
||||
FT_Destroy_Class_af_services( FT_Library library,
|
||||
FT_ServiceDescRec* clazz );
|
||||
|
||||
void
|
||||
FT_Init_Class_af_service_properties( FT_Service_PropertiesRec* clazz );
|
||||
|
||||
void FT_Init_Class_af_autofitter_interface(
|
||||
FT_Library library,
|
||||
FT_AutoHinter_InterfaceRec* clazz );
|
||||
|
||||
|
||||
/* forward declaration of PIC init functions from writing system classes */
|
||||
#undef WRITING_SYSTEM
|
||||
#define WRITING_SYSTEM( ws, WS ) /* empty */
|
||||
|
||||
#include "afwrtsys.h"
|
||||
|
||||
|
||||
void
|
||||
autofit_module_class_pic_free( FT_Library library )
|
||||
{
|
||||
FT_PIC_Container* pic_container = &library->pic_container;
|
||||
FT_Memory memory = library->memory;
|
||||
|
||||
|
||||
if ( pic_container->autofit )
|
||||
{
|
||||
AFModulePIC* container = (AFModulePIC*)pic_container->autofit;
|
||||
|
||||
|
||||
if ( container->af_services )
|
||||
FT_Destroy_Class_af_services( library,
|
||||
container->af_services );
|
||||
container->af_services = NULL;
|
||||
|
||||
FT_FREE( container );
|
||||
pic_container->autofit = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FT_Error
|
||||
autofit_module_class_pic_init( FT_Library library )
|
||||
{
|
||||
FT_PIC_Container* pic_container = &library->pic_container;
|
||||
FT_UInt ss;
|
||||
FT_Error error = FT_Err_Ok;
|
||||
AFModulePIC* container = NULL;
|
||||
FT_Memory memory = library->memory;
|
||||
|
||||
|
||||
/* allocate pointer, clear and set global container pointer */
|
||||
if ( FT_ALLOC ( container, sizeof ( *container ) ) )
|
||||
return error;
|
||||
FT_MEM_SET( container, 0, sizeof ( *container ) );
|
||||
pic_container->autofit = container;
|
||||
|
||||
/* initialize pointer table - */
|
||||
/* this is how the module usually expects this data */
|
||||
error = FT_Create_Class_af_services( library,
|
||||
&container->af_services );
|
||||
if ( error )
|
||||
goto Exit;
|
||||
|
||||
FT_Init_Class_af_service_properties( &container->af_service_properties );
|
||||
|
||||
for ( ss = 0; ss < AF_WRITING_SYSTEM_MAX; ss++ )
|
||||
container->af_writing_system_classes[ss] =
|
||||
&container->af_writing_system_classes_rec[ss];
|
||||
container->af_writing_system_classes[AF_WRITING_SYSTEM_MAX] = NULL;
|
||||
|
||||
for ( ss = 0; ss < AF_SCRIPT_MAX; ss++ )
|
||||
container->af_script_classes[ss] =
|
||||
&container->af_script_classes_rec[ss];
|
||||
container->af_script_classes[AF_SCRIPT_MAX] = NULL;
|
||||
|
||||
for ( ss = 0; ss < AF_STYLE_MAX; ss++ )
|
||||
container->af_style_classes[ss] =
|
||||
&container->af_style_classes_rec[ss];
|
||||
container->af_style_classes[AF_STYLE_MAX] = NULL;
|
||||
|
||||
#undef WRITING_SYSTEM
|
||||
#define WRITING_SYSTEM( ws, WS ) \
|
||||
FT_Init_Class_af_ ## ws ## _writing_system_class( \
|
||||
&container->af_writing_system_classes_rec[ss++] );
|
||||
|
||||
ss = 0;
|
||||
#include "afwrtsys.h"
|
||||
|
||||
#undef SCRIPT
|
||||
#define SCRIPT( s, S, d, h, H, sss ) \
|
||||
FT_Init_Class_af_ ## s ## _script_class( \
|
||||
&container->af_script_classes_rec[ss++] );
|
||||
|
||||
ss = 0;
|
||||
#include "afscript.h"
|
||||
|
||||
#undef STYLE
|
||||
#define STYLE( s, S, d, ws, sc, bss, c ) \
|
||||
FT_Init_Class_af_ ## s ## _style_class( \
|
||||
&container->af_style_classes_rec[ss++] );
|
||||
|
||||
ss = 0;
|
||||
#include "afstyles.h"
|
||||
|
||||
FT_Init_Class_af_autofitter_interface(
|
||||
library, &container->af_autofitter_interface );
|
||||
|
||||
Exit:
|
||||
if ( error )
|
||||
autofit_module_class_pic_free( library );
|
||||
return error;
|
||||
}
|
||||
|
||||
#endif /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
|
||||
/* END */
|
||||
105
vendor/FreeType2/src/autofit/afpic.h
vendored
Normal file
105
vendor/FreeType2/src/autofit/afpic.h
vendored
Normal file
|
|
@ -0,0 +1,105 @@
|
|||
/***************************************************************************/
|
||||
/* */
|
||||
/* afpic.h */
|
||||
/* */
|
||||
/* The FreeType position independent code services for autofit module. */
|
||||
/* */
|
||||
/* Copyright 2009-2018 by */
|
||||
/* Oran Agra and Mickey Gabel. */
|
||||
/* */
|
||||
/* 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 AFPIC_H_
|
||||
#define AFPIC_H_
|
||||
|
||||
|
||||
#include FT_INTERNAL_PIC_H
|
||||
|
||||
|
||||
#ifndef FT_CONFIG_OPTION_PIC
|
||||
|
||||
#define AF_SERVICES_GET af_services
|
||||
#define AF_SERVICE_PROPERTIES_GET af_service_properties
|
||||
|
||||
#define AF_WRITING_SYSTEM_CLASSES_GET af_writing_system_classes
|
||||
#define AF_SCRIPT_CLASSES_GET af_script_classes
|
||||
#define AF_STYLE_CLASSES_GET af_style_classes
|
||||
#define AF_INTERFACE_GET af_autofitter_interface
|
||||
|
||||
#else /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
/* some include files required for members of AFModulePIC */
|
||||
#include FT_SERVICE_PROPERTIES_H
|
||||
|
||||
#include "aftypes.h"
|
||||
|
||||
|
||||
FT_BEGIN_HEADER
|
||||
|
||||
typedef struct AFModulePIC_
|
||||
{
|
||||
FT_ServiceDescRec* af_services;
|
||||
FT_Service_PropertiesRec af_service_properties;
|
||||
|
||||
AF_WritingSystemClass af_writing_system_classes
|
||||
[AF_WRITING_SYSTEM_MAX + 1];
|
||||
AF_WritingSystemClassRec af_writing_system_classes_rec
|
||||
[AF_WRITING_SYSTEM_MAX];
|
||||
|
||||
AF_ScriptClass af_script_classes
|
||||
[AF_SCRIPT_MAX + 1];
|
||||
AF_ScriptClassRec af_script_classes_rec
|
||||
[AF_SCRIPT_MAX];
|
||||
|
||||
AF_StyleClass af_style_classes
|
||||
[AF_STYLE_MAX + 1];
|
||||
AF_StyleClassRec af_style_classes_rec
|
||||
[AF_STYLE_MAX];
|
||||
|
||||
FT_AutoHinter_InterfaceRec af_autofitter_interface;
|
||||
|
||||
} AFModulePIC;
|
||||
|
||||
|
||||
#define GET_PIC( lib ) \
|
||||
( (AFModulePIC*)( (lib)->pic_container.autofit ) )
|
||||
|
||||
#define AF_SERVICES_GET \
|
||||
( GET_PIC( library )->af_services )
|
||||
#define AF_SERVICE_PROPERTIES_GET \
|
||||
( GET_PIC( library )->af_service_properties )
|
||||
|
||||
#define AF_WRITING_SYSTEM_CLASSES_GET \
|
||||
( GET_PIC( FT_FACE_LIBRARY( globals->face ) )->af_writing_system_classes )
|
||||
#define AF_SCRIPT_CLASSES_GET \
|
||||
( GET_PIC( FT_FACE_LIBRARY( globals->face ) )->af_script_classes )
|
||||
#define AF_STYLE_CLASSES_GET \
|
||||
( GET_PIC( FT_FACE_LIBRARY( globals->face ) )->af_style_classes )
|
||||
#define AF_INTERFACE_GET \
|
||||
( GET_PIC( library )->af_autofitter_interface )
|
||||
|
||||
|
||||
/* see afpic.c for the implementation */
|
||||
void
|
||||
autofit_module_class_pic_free( FT_Library library );
|
||||
|
||||
FT_Error
|
||||
autofit_module_class_pic_init( FT_Library library );
|
||||
|
||||
FT_END_HEADER
|
||||
|
||||
#endif /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
/* */
|
||||
|
||||
#endif /* AFPIC_H_ */
|
||||
|
||||
|
||||
/* END */
|
||||
1033
vendor/FreeType2/src/autofit/afranges.c
vendored
Normal file
1033
vendor/FreeType2/src/autofit/afranges.c
vendored
Normal file
File diff suppressed because it is too large
Load diff
47
vendor/FreeType2/src/autofit/afranges.h
vendored
Normal file
47
vendor/FreeType2/src/autofit/afranges.h
vendored
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
/***************************************************************************/
|
||||
/* */
|
||||
/* afranges.h */
|
||||
/* */
|
||||
/* Auto-fitter Unicode script ranges (specification). */
|
||||
/* */
|
||||
/* Copyright 2013-2018 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. */
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
|
||||
#ifndef AFRANGES_H_
|
||||
#define AFRANGES_H_
|
||||
|
||||
|
||||
#include "aftypes.h"
|
||||
|
||||
|
||||
FT_BEGIN_HEADER
|
||||
|
||||
#undef SCRIPT
|
||||
#define SCRIPT( s, S, d, h, H, ss ) \
|
||||
extern const AF_Script_UniRangeRec af_ ## s ## _uniranges[];
|
||||
|
||||
#include "afscript.h"
|
||||
|
||||
#undef SCRIPT
|
||||
#define SCRIPT( s, S, d, h, H, ss ) \
|
||||
extern const AF_Script_UniRangeRec af_ ## s ## _nonbase_uniranges[];
|
||||
|
||||
#include "afscript.h"
|
||||
|
||||
/* */
|
||||
|
||||
FT_END_HEADER
|
||||
|
||||
#endif /* AFRANGES_H_ */
|
||||
|
||||
|
||||
/* END */
|
||||
390
vendor/FreeType2/src/autofit/afscript.h
vendored
Normal file
390
vendor/FreeType2/src/autofit/afscript.h
vendored
Normal file
|
|
@ -0,0 +1,390 @@
|
|||
/***************************************************************************/
|
||||
/* */
|
||||
/* afscript.h */
|
||||
/* */
|
||||
/* Auto-fitter scripts (specification only). */
|
||||
/* */
|
||||
/* Copyright 2013-2018 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. */
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
|
||||
/* The following part can be included multiple times. */
|
||||
/* Define `SCRIPT' as needed. */
|
||||
|
||||
|
||||
/* Add new scripts here. The first and second arguments are the */
|
||||
/* script name in lowercase and uppercase, respectively, followed */
|
||||
/* by a description string. Then comes the corresponding HarfBuzz */
|
||||
/* script name tag, followed by a string of standard characters (to */
|
||||
/* derive the standard width and height of stems). */
|
||||
/* */
|
||||
/* Note that fallback scripts only have a default style, thus we */
|
||||
/* use `HB_SCRIPT_INVALID' as the HarfBuzz script name tag for */
|
||||
/* them. */
|
||||
|
||||
SCRIPT( adlm, ADLM,
|
||||
"Adlam",
|
||||
HB_SCRIPT_ADLAM,
|
||||
HINTING_BOTTOM_TO_TOP,
|
||||
"\xF0\x9E\xA4\x8C \xF0\x9E\xA4\xAE" ) /* 𞤌 𞤮 */
|
||||
|
||||
SCRIPT( arab, ARAB,
|
||||
"Arabic",
|
||||
HB_SCRIPT_ARABIC,
|
||||
HINTING_BOTTOM_TO_TOP,
|
||||
"\xD9\x84 \xD8\xAD \xD9\x80" ) /* ل ح ـ */
|
||||
|
||||
SCRIPT( armn, ARMN,
|
||||
"Armenian",
|
||||
HB_SCRIPT_ARMENIAN,
|
||||
HINTING_BOTTOM_TO_TOP,
|
||||
"\xD5\xBD \xD5\x8D" ) /* ս Ս */
|
||||
|
||||
SCRIPT( avst, AVST,
|
||||
"Avestan",
|
||||
HB_SCRIPT_AVESTAN,
|
||||
HINTING_BOTTOM_TO_TOP,
|
||||
"\xF0\x90\xAC\x9A" ) /* 𐬚 */
|
||||
|
||||
SCRIPT( bamu, BAMU,
|
||||
"Bamum",
|
||||
HB_SCRIPT_BAMUM,
|
||||
HINTING_BOTTOM_TO_TOP,
|
||||
"\xEA\x9B\x81 \xEA\x9B\xAF" ) /* ꛁ ꛯ */
|
||||
|
||||
/* there are no simple forms for letters; we thus use two digit shapes */
|
||||
SCRIPT( beng, BENG,
|
||||
"Bengali",
|
||||
HB_SCRIPT_BENGALI,
|
||||
HINTING_TOP_TO_BOTTOM,
|
||||
"\xE0\xA7\xA6 \xE0\xA7\xAA" ) /* ০ ৪ */
|
||||
|
||||
SCRIPT( buhd, BUHD,
|
||||
"Buhid",
|
||||
HB_SCRIPT_BUHID,
|
||||
HINTING_BOTTOM_TO_TOP,
|
||||
"\xE1\x9D\x8B \xE1\x9D\x8F" ) /* ᝋ ᝏ */
|
||||
|
||||
SCRIPT( cakm, CAKM,
|
||||
"Chakma",
|
||||
HB_SCRIPT_CHAKMA,
|
||||
HINTING_BOTTOM_TO_TOP,
|
||||
"\xF0\x91\x84\xA4 \xF0\x91\x84\x89 \xF0\x91\x84\x9B" ) /* 𑄤 𑄉 𑄛 */
|
||||
|
||||
SCRIPT( cans, CANS,
|
||||
"Canadian Syllabics",
|
||||
HB_SCRIPT_CANADIAN_SYLLABICS,
|
||||
HINTING_BOTTOM_TO_TOP,
|
||||
"\xE1\x91\x8C \xE1\x93\x9A" ) /* ᑌ ᓚ */
|
||||
|
||||
SCRIPT( cari, CARI,
|
||||
"Carian",
|
||||
HB_SCRIPT_CARIAN,
|
||||
HINTING_BOTTOM_TO_TOP,
|
||||
"\xF0\x90\x8A\xAB \xF0\x90\x8B\x89" ) /* 𐊫 𐋉 */
|
||||
|
||||
SCRIPT( cher, CHER,
|
||||
"Cherokee",
|
||||
HB_SCRIPT_CHEROKEE,
|
||||
HINTING_BOTTOM_TO_TOP,
|
||||
"\xE1\x8E\xA4 \xE1\x8F\x85 \xEA\xAE\x95" ) /* Ꭴ Ꮕ ꮕ */
|
||||
|
||||
SCRIPT( copt, COPT,
|
||||
"Coptic",
|
||||
HB_SCRIPT_COPTIC,
|
||||
HINTING_BOTTOM_TO_TOP,
|
||||
"\xE2\xB2\x9E \xE2\xB2\x9F" ) /* Ⲟ ⲟ */
|
||||
|
||||
SCRIPT( cprt, CPRT,
|
||||
"Cypriot",
|
||||
HB_SCRIPT_CYPRIOT,
|
||||
HINTING_BOTTOM_TO_TOP,
|
||||
"\xF0\x90\xA0\x85 \xF0\x90\xA0\xA3" ) /* 𐠅 𐠣 */
|
||||
|
||||
SCRIPT( cyrl, CYRL,
|
||||
"Cyrillic",
|
||||
HB_SCRIPT_CYRILLIC,
|
||||
HINTING_BOTTOM_TO_TOP,
|
||||
"\xD0\xBE \xD0\x9E" ) /* о О */
|
||||
|
||||
SCRIPT( deva, DEVA,
|
||||
"Devanagari",
|
||||
HB_SCRIPT_DEVANAGARI,
|
||||
HINTING_TOP_TO_BOTTOM,
|
||||
"\xE0\xA4\xA0 \xE0\xA4\xB5 \xE0\xA4\x9F" ) /* ठ व ट */
|
||||
|
||||
SCRIPT( dsrt, DSRT,
|
||||
"Deseret",
|
||||
HB_SCRIPT_DESERET,
|
||||
HINTING_BOTTOM_TO_TOP,
|
||||
"\xF0\x90\x90\x84 \xF0\x90\x90\xAC" ) /* 𐐄 𐐬 */
|
||||
|
||||
SCRIPT( ethi, ETHI,
|
||||
"Ethiopic",
|
||||
HB_SCRIPT_ETHIOPIC,
|
||||
HINTING_BOTTOM_TO_TOP,
|
||||
"\xE1\x8B\x90" ) /* ዐ */
|
||||
|
||||
SCRIPT( geor, GEOR,
|
||||
"Georgian (Mkhedruli)",
|
||||
HB_SCRIPT_GEORGIAN,
|
||||
HINTING_BOTTOM_TO_TOP,
|
||||
"\xE1\x83\x98 \xE1\x83\x94 \xE1\x83\x90 \xE1\xB2\xBF" ) /* ი ე ა Ი */
|
||||
|
||||
SCRIPT( geok, GEOK,
|
||||
"Georgian (Khutsuri)",
|
||||
HB_SCRIPT_INVALID,
|
||||
HINTING_BOTTOM_TO_TOP,
|
||||
"\xE1\x82\xB6 \xE1\x82\xB1 \xE2\xB4\x99" ) /* Ⴖ Ⴑ ⴙ */
|
||||
|
||||
SCRIPT( glag, GLAG,
|
||||
"Glagolitic",
|
||||
HB_SCRIPT_GLAGOLITIC,
|
||||
HINTING_BOTTOM_TO_TOP,
|
||||
"\xE2\xB0\x95 \xE2\xB1\x85" ) /* Ⱅ ⱅ */
|
||||
|
||||
SCRIPT( goth, GOTH,
|
||||
"Gothic",
|
||||
HB_SCRIPT_GOTHIC,
|
||||
HINTING_TOP_TO_BOTTOM,
|
||||
"\xF0\x90\x8C\xB4 \xF0\x90\x8C\xBE \xF0\x90\x8D\x83" ) /* 𐌴 𐌾 𐍃 */
|
||||
|
||||
SCRIPT( grek, GREK,
|
||||
"Greek",
|
||||
HB_SCRIPT_GREEK,
|
||||
HINTING_BOTTOM_TO_TOP,
|
||||
"\xCE\xBF \xCE\x9F" ) /* ο Ο */
|
||||
|
||||
SCRIPT( gujr, GUJR,
|
||||
"Gujarati",
|
||||
HB_SCRIPT_GUJARATI,
|
||||
HINTING_BOTTOM_TO_TOP,
|
||||
"\xE0\xAA\x9F \xE0\xAB\xA6" ) /* ટ ૦ */
|
||||
|
||||
SCRIPT( guru, GURU,
|
||||
"Gurmukhi",
|
||||
HB_SCRIPT_GURMUKHI,
|
||||
HINTING_TOP_TO_BOTTOM,
|
||||
"\xE0\xA8\xA0 \xE0\xA8\xB0 \xE0\xA9\xA6" ) /* ਠ ਰ ੦ */
|
||||
|
||||
SCRIPT( hebr, HEBR,
|
||||
"Hebrew",
|
||||
HB_SCRIPT_HEBREW,
|
||||
HINTING_BOTTOM_TO_TOP,
|
||||
"\xD7\x9D" ) /* ם */
|
||||
|
||||
SCRIPT( kali, KALI,
|
||||
"Kayah Li",
|
||||
HB_SCRIPT_KAYAH_LI,
|
||||
HINTING_BOTTOM_TO_TOP,
|
||||
"\xEA\xA4\x8D \xEA\xA4\x80" ) /* ꤍ ꤀ */
|
||||
|
||||
/* only digit zero has a simple shape in the Khmer script */
|
||||
SCRIPT( khmr, KHMR,
|
||||
"Khmer",
|
||||
HB_SCRIPT_KHMER,
|
||||
HINTING_BOTTOM_TO_TOP,
|
||||
"\xE1\x9F\xA0" ) /* ០ */
|
||||
|
||||
SCRIPT( khms, KHMS,
|
||||
"Khmer Symbols",
|
||||
HB_SCRIPT_INVALID,
|
||||
HINTING_BOTTOM_TO_TOP,
|
||||
"\xE1\xA7\xA1 \xE1\xA7\xAA" ) /* ᧡ ᧪ */
|
||||
|
||||
SCRIPT( knda, KNDA,
|
||||
"Kannada",
|
||||
HB_SCRIPT_KANNADA,
|
||||
HINTING_BOTTOM_TO_TOP,
|
||||
"\xE0\xB3\xA6 \xE0\xB2\xAC" ) /* ೦ ಬ */
|
||||
|
||||
/* only digit zero has a simple shape in the Lao script */
|
||||
SCRIPT( lao, LAO,
|
||||
"Lao",
|
||||
HB_SCRIPT_LAO,
|
||||
HINTING_BOTTOM_TO_TOP,
|
||||
"\xE0\xBB\x90" ) /* ໐ */
|
||||
|
||||
SCRIPT( latn, LATN,
|
||||
"Latin",
|
||||
HB_SCRIPT_LATIN,
|
||||
HINTING_BOTTOM_TO_TOP,
|
||||
"o O 0" )
|
||||
|
||||
SCRIPT( latb, LATB,
|
||||
"Latin Subscript Fallback",
|
||||
HB_SCRIPT_INVALID,
|
||||
HINTING_BOTTOM_TO_TOP,
|
||||
"\xE2\x82\x92 \xE2\x82\x80" ) /* ₒ ₀ */
|
||||
|
||||
SCRIPT( latp, LATP,
|
||||
"Latin Superscript Fallback",
|
||||
HB_SCRIPT_INVALID,
|
||||
HINTING_BOTTOM_TO_TOP,
|
||||
"\xE1\xB5\x92 \xE1\xB4\xBC \xE2\x81\xB0" ) /* ᵒ ᴼ ⁰ */
|
||||
|
||||
SCRIPT( lisu, LISU,
|
||||
"Lisu",
|
||||
HB_SCRIPT_LISU,
|
||||
HINTING_BOTTOM_TO_TOP,
|
||||
"\xEA\x93\xB3" ) /* ꓳ */
|
||||
|
||||
SCRIPT( mlym, MLYM,
|
||||
"Malayalam",
|
||||
HB_SCRIPT_MALAYALAM,
|
||||
HINTING_BOTTOM_TO_TOP,
|
||||
"\xE0\xB4\xA0 \xE0\xB4\xB1" ) /* ഠ റ */
|
||||
|
||||
SCRIPT( mymr, MYMR,
|
||||
"Myanmar",
|
||||
HB_SCRIPT_MYANMAR,
|
||||
HINTING_BOTTOM_TO_TOP,
|
||||
"\xE1\x80\x9D \xE1\x80\x84 \xE1\x80\x82" ) /* ဝ င ဂ */
|
||||
|
||||
SCRIPT( nkoo, NKOO,
|
||||
"N'Ko",
|
||||
HB_SCRIPT_NKO,
|
||||
HINTING_BOTTOM_TO_TOP,
|
||||
"\xDF\x8B \xDF\x80" ) /* ߋ ߀ */
|
||||
|
||||
SCRIPT( none, NONE,
|
||||
"no script",
|
||||
HB_SCRIPT_INVALID,
|
||||
HINTING_BOTTOM_TO_TOP,
|
||||
"" )
|
||||
|
||||
SCRIPT( olck, OLCK,
|
||||
"Ol Chiki",
|
||||
HB_SCRIPT_OL_CHIKI,
|
||||
HINTING_BOTTOM_TO_TOP,
|
||||
"\xE1\xB1\x9B" ) /* ᱛ */
|
||||
|
||||
SCRIPT( orkh, ORKH,
|
||||
"Old Turkic",
|
||||
HB_SCRIPT_OLD_TURKIC,
|
||||
HINTING_BOTTOM_TO_TOP,
|
||||
"\xF0\x90\xB0\x97" ) /* 𐰗 */
|
||||
|
||||
SCRIPT( osge, OSGE,
|
||||
"Osage",
|
||||
HB_SCRIPT_OSAGE,
|
||||
HINTING_BOTTOM_TO_TOP,
|
||||
"\xF0\x90\x93\x82 \xF0\x90\x93\xAA" ) /* 𐓂 𐓪 */
|
||||
|
||||
SCRIPT( osma, OSMA,
|
||||
"Osmanya",
|
||||
HB_SCRIPT_OSMANYA,
|
||||
HINTING_BOTTOM_TO_TOP,
|
||||
"\xF0\x90\x92\x86 \xF0\x90\x92\xA0" ) /* 𐒆 𐒠 */
|
||||
|
||||
SCRIPT( saur, SAUR,
|
||||
"Saurashtra",
|
||||
HB_SCRIPT_SAURASHTRA,
|
||||
HINTING_BOTTOM_TO_TOP,
|
||||
"\xEA\xA2\x9D \xEA\xA3\x90" ) /* ꢝ ꣐ */
|
||||
|
||||
SCRIPT( shaw, SHAW,
|
||||
"Shavian",
|
||||
HB_SCRIPT_SHAVIAN,
|
||||
HINTING_BOTTOM_TO_TOP,
|
||||
"\xF0\x90\x91\xB4" ) /* 𐑴 */
|
||||
|
||||
SCRIPT( sinh, SINH,
|
||||
"Sinhala",
|
||||
HB_SCRIPT_SINHALA,
|
||||
HINTING_BOTTOM_TO_TOP,
|
||||
"\xE0\xB6\xA7" ) /* ට */
|
||||
|
||||
/* only digit zero has a simple (round) shape in the Sundanese script */
|
||||
SCRIPT( sund, SUND,
|
||||
"Sundanese",
|
||||
HB_SCRIPT_SUNDANESE,
|
||||
HINTING_BOTTOM_TO_TOP,
|
||||
"\xE1\xAE\xB0" ) /* ᮰ */
|
||||
|
||||
/* only digit zero has a simple (round) shape in the Tamil script */
|
||||
SCRIPT( taml, TAML,
|
||||
"Tamil",
|
||||
HB_SCRIPT_TAMIL,
|
||||
HINTING_BOTTOM_TO_TOP,
|
||||
"\xE0\xAF\xA6" ) /* ௦ */
|
||||
|
||||
SCRIPT( tavt, TAVT,
|
||||
"Tai Viet",
|
||||
HB_SCRIPT_TAI_VIET,
|
||||
HINTING_BOTTOM_TO_TOP,
|
||||
"\xEA\xAA\x92 \xEA\xAA\xAB" ) /* ꪒ ꪫ */
|
||||
|
||||
/* there are no simple forms for letters; we thus use two digit shapes */
|
||||
SCRIPT( telu, TELU,
|
||||
"Telugu",
|
||||
HB_SCRIPT_TELUGU,
|
||||
HINTING_BOTTOM_TO_TOP,
|
||||
"\xE0\xB1\xA6 \xE0\xB1\xA7" ) /* ౦ ౧ */
|
||||
|
||||
SCRIPT( tfng, TFNG,
|
||||
"Tifinagh",
|
||||
HB_SCRIPT_TIFINAGH,
|
||||
HINTING_BOTTOM_TO_TOP,
|
||||
"\xE2\xB5\x94" ) /* ⵔ */
|
||||
|
||||
SCRIPT( thai, THAI,
|
||||
"Thai",
|
||||
HB_SCRIPT_THAI,
|
||||
HINTING_BOTTOM_TO_TOP,
|
||||
"\xE0\xB8\xB2 \xE0\xB9\x85 \xE0\xB9\x90" ) /* า ๅ ๐ */
|
||||
|
||||
SCRIPT( vaii, VAII,
|
||||
"Vai",
|
||||
HB_SCRIPT_VAI,
|
||||
HINTING_BOTTOM_TO_TOP,
|
||||
"\xEA\x98\x93 \xEA\x96\x9C \xEA\x96\xB4" ) /* ꘓ ꖜ ꖴ */
|
||||
|
||||
#ifdef AF_CONFIG_OPTION_INDIC
|
||||
|
||||
SCRIPT( limb, LIMB,
|
||||
"Limbu",
|
||||
HB_SCRIPT_LIMBU,
|
||||
HINTING_BOTTOM_TO_TOP,
|
||||
"o" ) /* XXX */
|
||||
|
||||
SCRIPT( orya, ORYA,
|
||||
"Oriya",
|
||||
HB_SCRIPT_ORIYA,
|
||||
HINTING_BOTTOM_TO_TOP,
|
||||
"o" ) /* XXX */
|
||||
|
||||
SCRIPT( sylo, SYLO,
|
||||
"Syloti Nagri",
|
||||
HB_SCRIPT_SYLOTI_NAGRI,
|
||||
HINTING_BOTTOM_TO_TOP,
|
||||
"o" ) /* XXX */
|
||||
|
||||
SCRIPT( tibt, TIBT,
|
||||
"Tibetan",
|
||||
HB_SCRIPT_TIBETAN,
|
||||
HINTING_BOTTOM_TO_TOP,
|
||||
"o" ) /* XXX */
|
||||
|
||||
#endif /* AF_CONFIG_OPTION_INDIC */
|
||||
|
||||
#ifdef AF_CONFIG_OPTION_CJK
|
||||
|
||||
SCRIPT( hani, HANI,
|
||||
"CJKV ideographs",
|
||||
HB_SCRIPT_HAN,
|
||||
HINTING_BOTTOM_TO_TOP,
|
||||
"\xE7\x94\xB0 \xE5\x9B\x97" ) /* 田 囗 */
|
||||
|
||||
#endif /* AF_CONFIG_OPTION_CJK */
|
||||
|
||||
|
||||
/* END */
|
||||
683
vendor/FreeType2/src/autofit/afshaper.c
vendored
Normal file
683
vendor/FreeType2/src/autofit/afshaper.c
vendored
Normal file
|
|
@ -0,0 +1,683 @@
|
|||
/***************************************************************************/
|
||||
/* */
|
||||
/* afshaper.c */
|
||||
/* */
|
||||
/* HarfBuzz interface for accessing OpenType features (body). */
|
||||
/* */
|
||||
/* Copyright 2013-2018 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_FREETYPE_H
|
||||
#include FT_ADVANCES_H
|
||||
#include "afglobal.h"
|
||||
#include "aftypes.h"
|
||||
#include "afshaper.h"
|
||||
|
||||
#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* 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_afshaper
|
||||
|
||||
|
||||
/*
|
||||
* We use `sets' (in the HarfBuzz sense, which comes quite near to the
|
||||
* usual mathematical meaning) to manage both lookups and glyph indices.
|
||||
*
|
||||
* 1. For each coverage, collect lookup IDs in a set. Note that an
|
||||
* auto-hinter `coverage' is represented by one `feature', and a
|
||||
* feature consists of an arbitrary number of (font specific) `lookup's
|
||||
* that actually do the mapping job. Please check the OpenType
|
||||
* specification for more details on features and lookups.
|
||||
*
|
||||
* 2. Create glyph ID sets from the corresponding lookup sets.
|
||||
*
|
||||
* 3. The glyph set corresponding to AF_COVERAGE_DEFAULT is computed
|
||||
* with all lookups specific to the OpenType script activated. It
|
||||
* relies on the order of AF_DEFINE_STYLE_CLASS entries so that
|
||||
* special coverages (like `oldstyle figures') don't get overwritten.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/* load coverage tags */
|
||||
#undef COVERAGE
|
||||
#define COVERAGE( name, NAME, description, \
|
||||
tag1, tag2, tag3, tag4 ) \
|
||||
static const hb_tag_t name ## _coverage[] = \
|
||||
{ \
|
||||
HB_TAG( tag1, tag2, tag3, tag4 ), \
|
||||
HB_TAG_NONE \
|
||||
};
|
||||
|
||||
|
||||
#include "afcover.h"
|
||||
|
||||
|
||||
/* define mapping between coverage tags and AF_Coverage */
|
||||
#undef COVERAGE
|
||||
#define COVERAGE( name, NAME, description, \
|
||||
tag1, tag2, tag3, tag4 ) \
|
||||
name ## _coverage,
|
||||
|
||||
|
||||
static const hb_tag_t* coverages[] =
|
||||
{
|
||||
#include "afcover.h"
|
||||
|
||||
NULL /* AF_COVERAGE_DEFAULT */
|
||||
};
|
||||
|
||||
|
||||
/* load HarfBuzz script tags */
|
||||
#undef SCRIPT
|
||||
#define SCRIPT( s, S, d, h, H, ss ) h,
|
||||
|
||||
|
||||
static const hb_script_t scripts[] =
|
||||
{
|
||||
#include "afscript.h"
|
||||
};
|
||||
|
||||
|
||||
FT_Error
|
||||
af_shaper_get_coverage( AF_FaceGlobals globals,
|
||||
AF_StyleClass style_class,
|
||||
FT_UShort* gstyles,
|
||||
FT_Bool default_script )
|
||||
{
|
||||
hb_face_t* face;
|
||||
|
||||
hb_set_t* gsub_lookups = NULL; /* GSUB lookups for a given script */
|
||||
hb_set_t* gsub_glyphs = NULL; /* glyphs covered by GSUB lookups */
|
||||
hb_set_t* gpos_lookups = NULL; /* GPOS lookups for a given script */
|
||||
hb_set_t* gpos_glyphs = NULL; /* glyphs covered by GPOS lookups */
|
||||
|
||||
hb_script_t script;
|
||||
const hb_tag_t* coverage_tags;
|
||||
hb_tag_t script_tags[] = { HB_TAG_NONE,
|
||||
HB_TAG_NONE,
|
||||
HB_TAG_NONE,
|
||||
HB_TAG_NONE };
|
||||
|
||||
hb_codepoint_t idx;
|
||||
#ifdef FT_DEBUG_LEVEL_TRACE
|
||||
int count;
|
||||
#endif
|
||||
|
||||
|
||||
if ( !globals || !style_class || !gstyles )
|
||||
return FT_THROW( Invalid_Argument );
|
||||
|
||||
face = hb_font_get_face( globals->hb_font );
|
||||
|
||||
coverage_tags = coverages[style_class->coverage];
|
||||
script = scripts[style_class->script];
|
||||
|
||||
/* Convert a HarfBuzz script tag into the corresponding OpenType */
|
||||
/* tag or tags -- some Indic scripts like Devanagari have an old */
|
||||
/* and a new set of features. */
|
||||
hb_ot_tags_from_script( script,
|
||||
&script_tags[0],
|
||||
&script_tags[1] );
|
||||
|
||||
/* `hb_ot_tags_from_script' usually returns HB_OT_TAG_DEFAULT_SCRIPT */
|
||||
/* as the second tag. We change that to HB_TAG_NONE except for the */
|
||||
/* default script. */
|
||||
if ( default_script )
|
||||
{
|
||||
if ( script_tags[0] == HB_TAG_NONE )
|
||||
script_tags[0] = HB_OT_TAG_DEFAULT_SCRIPT;
|
||||
else
|
||||
{
|
||||
if ( script_tags[1] == HB_TAG_NONE )
|
||||
script_tags[1] = HB_OT_TAG_DEFAULT_SCRIPT;
|
||||
else if ( script_tags[1] != HB_OT_TAG_DEFAULT_SCRIPT )
|
||||
script_tags[2] = HB_OT_TAG_DEFAULT_SCRIPT;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* we use non-standard tags like `khms' for special purposes; */
|
||||
/* HarfBuzz maps them to `DFLT', which we don't want to handle here */
|
||||
if ( script_tags[0] == HB_OT_TAG_DEFAULT_SCRIPT )
|
||||
goto Exit;
|
||||
|
||||
if ( script_tags[1] == HB_OT_TAG_DEFAULT_SCRIPT )
|
||||
script_tags[1] = HB_TAG_NONE;
|
||||
}
|
||||
|
||||
gsub_lookups = hb_set_create();
|
||||
hb_ot_layout_collect_lookups( face,
|
||||
HB_OT_TAG_GSUB,
|
||||
script_tags,
|
||||
NULL,
|
||||
coverage_tags,
|
||||
gsub_lookups );
|
||||
|
||||
if ( hb_set_is_empty( gsub_lookups ) )
|
||||
goto Exit; /* nothing to do */
|
||||
|
||||
FT_TRACE4(( "GSUB lookups (style `%s'):\n"
|
||||
" ",
|
||||
af_style_names[style_class->style] ));
|
||||
|
||||
#ifdef FT_DEBUG_LEVEL_TRACE
|
||||
count = 0;
|
||||
#endif
|
||||
|
||||
gsub_glyphs = hb_set_create();
|
||||
for ( idx = HB_SET_VALUE_INVALID; hb_set_next( gsub_lookups, &idx ); )
|
||||
{
|
||||
#ifdef FT_DEBUG_LEVEL_TRACE
|
||||
FT_TRACE4(( " %d", idx ));
|
||||
count++;
|
||||
#endif
|
||||
|
||||
/* get output coverage of GSUB feature */
|
||||
hb_ot_layout_lookup_collect_glyphs( face,
|
||||
HB_OT_TAG_GSUB,
|
||||
idx,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
gsub_glyphs );
|
||||
}
|
||||
|
||||
#ifdef FT_DEBUG_LEVEL_TRACE
|
||||
if ( !count )
|
||||
FT_TRACE4(( " (none)" ));
|
||||
FT_TRACE4(( "\n\n" ));
|
||||
#endif
|
||||
|
||||
FT_TRACE4(( "GPOS lookups (style `%s'):\n"
|
||||
" ",
|
||||
af_style_names[style_class->style] ));
|
||||
|
||||
gpos_lookups = hb_set_create();
|
||||
hb_ot_layout_collect_lookups( face,
|
||||
HB_OT_TAG_GPOS,
|
||||
script_tags,
|
||||
NULL,
|
||||
coverage_tags,
|
||||
gpos_lookups );
|
||||
|
||||
#ifdef FT_DEBUG_LEVEL_TRACE
|
||||
count = 0;
|
||||
#endif
|
||||
|
||||
gpos_glyphs = hb_set_create();
|
||||
for ( idx = HB_SET_VALUE_INVALID; hb_set_next( gpos_lookups, &idx ); )
|
||||
{
|
||||
#ifdef FT_DEBUG_LEVEL_TRACE
|
||||
FT_TRACE4(( " %d", idx ));
|
||||
count++;
|
||||
#endif
|
||||
|
||||
/* get input coverage of GPOS feature */
|
||||
hb_ot_layout_lookup_collect_glyphs( face,
|
||||
HB_OT_TAG_GPOS,
|
||||
idx,
|
||||
NULL,
|
||||
gpos_glyphs,
|
||||
NULL,
|
||||
NULL );
|
||||
}
|
||||
|
||||
#ifdef FT_DEBUG_LEVEL_TRACE
|
||||
if ( !count )
|
||||
FT_TRACE4(( " (none)" ));
|
||||
FT_TRACE4(( "\n\n" ));
|
||||
#endif
|
||||
|
||||
/*
|
||||
* We now check whether we can construct blue zones, using glyphs
|
||||
* covered by the feature only. In case there is not a single zone
|
||||
* (this is, not a single character is covered), we skip this coverage.
|
||||
*
|
||||
*/
|
||||
if ( style_class->coverage != AF_COVERAGE_DEFAULT )
|
||||
{
|
||||
AF_Blue_Stringset bss = style_class->blue_stringset;
|
||||
const AF_Blue_StringRec* bs = &af_blue_stringsets[bss];
|
||||
|
||||
FT_Bool found = 0;
|
||||
|
||||
|
||||
for ( ; bs->string != AF_BLUE_STRING_MAX; bs++ )
|
||||
{
|
||||
const char* p = &af_blue_strings[bs->string];
|
||||
|
||||
|
||||
while ( *p )
|
||||
{
|
||||
hb_codepoint_t ch;
|
||||
|
||||
|
||||
GET_UTF8_CHAR( ch, p );
|
||||
|
||||
for ( idx = HB_SET_VALUE_INVALID; hb_set_next( gsub_lookups,
|
||||
&idx ); )
|
||||
{
|
||||
hb_codepoint_t gidx = FT_Get_Char_Index( globals->face, ch );
|
||||
|
||||
|
||||
if ( hb_ot_layout_lookup_would_substitute( face, idx,
|
||||
&gidx, 1, 1 ) )
|
||||
{
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( !found )
|
||||
{
|
||||
FT_TRACE4(( " no blue characters found; style skipped\n" ));
|
||||
goto Exit;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Various OpenType features might use the same glyphs at different
|
||||
* vertical positions; for example, superscript and subscript glyphs
|
||||
* could be the same. However, the auto-hinter is completely
|
||||
* agnostic of OpenType features after the feature analysis has been
|
||||
* completed: The engine then simply receives a glyph index and returns a
|
||||
* hinted and usually rendered glyph.
|
||||
*
|
||||
* Consider the superscript feature of font `pala.ttf': Some of the
|
||||
* glyphs are `real', this is, they have a zero vertical offset, but
|
||||
* most of them are small caps glyphs shifted up to the superscript
|
||||
* position (this is, the `sups' feature is present in both the GSUB and
|
||||
* GPOS tables). The code for blue zones computation actually uses a
|
||||
* feature's y offset so that the `real' glyphs get correct hints. But
|
||||
* later on it is impossible to decide whether a glyph index belongs to,
|
||||
* say, the small caps or superscript feature.
|
||||
*
|
||||
* For this reason, we don't assign a style to a glyph if the current
|
||||
* feature covers the glyph in both the GSUB and the GPOS tables. This
|
||||
* is quite a broad condition, assuming that
|
||||
*
|
||||
* (a) glyphs that get used in multiple features are present in a
|
||||
* feature without vertical shift,
|
||||
*
|
||||
* and
|
||||
*
|
||||
* (b) a feature's GPOS data really moves the glyph vertically.
|
||||
*
|
||||
* Not fulfilling condition (a) makes a font larger; it would also
|
||||
* reduce the number of glyphs that could be addressed directly without
|
||||
* using OpenType features, so this assumption is rather strong.
|
||||
*
|
||||
* Condition (b) is much weaker, and there might be glyphs which get
|
||||
* missed. However, the OpenType features we are going to handle are
|
||||
* primarily located in GSUB, and HarfBuzz doesn't provide an API to
|
||||
* directly get the necessary information from the GPOS table. A
|
||||
* possible solution might be to directly parse the GPOS table to find
|
||||
* out whether a glyph gets shifted vertically, but this is something I
|
||||
* would like to avoid if not really necessary.
|
||||
*
|
||||
* Note that we don't follow this logic for the default coverage.
|
||||
* Complex scripts like Devanagari have mandatory GPOS features to
|
||||
* position many glyph elements, using mark-to-base or mark-to-ligature
|
||||
* tables; the number of glyphs missed due to condition (b) would be far
|
||||
* too large.
|
||||
*
|
||||
*/
|
||||
if ( style_class->coverage != AF_COVERAGE_DEFAULT )
|
||||
hb_set_subtract( gsub_glyphs, gpos_glyphs );
|
||||
|
||||
#ifdef FT_DEBUG_LEVEL_TRACE
|
||||
FT_TRACE4(( " glyphs without GPOS data (`*' means already assigned)" ));
|
||||
count = 0;
|
||||
#endif
|
||||
|
||||
for ( idx = HB_SET_VALUE_INVALID; hb_set_next( gsub_glyphs, &idx ); )
|
||||
{
|
||||
#ifdef FT_DEBUG_LEVEL_TRACE
|
||||
if ( !( count % 10 ) )
|
||||
FT_TRACE4(( "\n"
|
||||
" " ));
|
||||
|
||||
FT_TRACE4(( " %d", idx ));
|
||||
count++;
|
||||
#endif
|
||||
|
||||
/* glyph indices returned by `hb_ot_layout_lookup_collect_glyphs' */
|
||||
/* can be arbitrary: some fonts use fake indices for processing */
|
||||
/* internal to GSUB or GPOS, which is fully valid */
|
||||
if ( idx >= (hb_codepoint_t)globals->glyph_count )
|
||||
continue;
|
||||
|
||||
if ( gstyles[idx] == AF_STYLE_UNASSIGNED )
|
||||
gstyles[idx] = (FT_UShort)style_class->style;
|
||||
#ifdef FT_DEBUG_LEVEL_TRACE
|
||||
else
|
||||
FT_TRACE4(( "*" ));
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef FT_DEBUG_LEVEL_TRACE
|
||||
if ( !count )
|
||||
FT_TRACE4(( "\n"
|
||||
" (none)" ));
|
||||
FT_TRACE4(( "\n\n" ));
|
||||
#endif
|
||||
|
||||
Exit:
|
||||
hb_set_destroy( gsub_lookups );
|
||||
hb_set_destroy( gsub_glyphs );
|
||||
hb_set_destroy( gpos_lookups );
|
||||
hb_set_destroy( gpos_glyphs );
|
||||
|
||||
return FT_Err_Ok;
|
||||
}
|
||||
|
||||
|
||||
/* construct HarfBuzz features */
|
||||
#undef COVERAGE
|
||||
#define COVERAGE( name, NAME, description, \
|
||||
tag1, tag2, tag3, tag4 ) \
|
||||
static const hb_feature_t name ## _feature[] = \
|
||||
{ \
|
||||
{ \
|
||||
HB_TAG( tag1, tag2, tag3, tag4 ), \
|
||||
1, 0, (unsigned int)-1 \
|
||||
} \
|
||||
};
|
||||
|
||||
|
||||
#include "afcover.h"
|
||||
|
||||
|
||||
/* define mapping between HarfBuzz features and AF_Coverage */
|
||||
#undef COVERAGE
|
||||
#define COVERAGE( name, NAME, description, \
|
||||
tag1, tag2, tag3, tag4 ) \
|
||||
name ## _feature,
|
||||
|
||||
|
||||
static const hb_feature_t* features[] =
|
||||
{
|
||||
#include "afcover.h"
|
||||
|
||||
NULL /* AF_COVERAGE_DEFAULT */
|
||||
};
|
||||
|
||||
|
||||
void*
|
||||
af_shaper_buf_create( FT_Face face )
|
||||
{
|
||||
FT_UNUSED( face );
|
||||
|
||||
return (void*)hb_buffer_create();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
af_shaper_buf_destroy( FT_Face face,
|
||||
void* buf )
|
||||
{
|
||||
FT_UNUSED( face );
|
||||
|
||||
hb_buffer_destroy( (hb_buffer_t*)buf );
|
||||
}
|
||||
|
||||
|
||||
const char*
|
||||
af_shaper_get_cluster( const char* p,
|
||||
AF_StyleMetrics metrics,
|
||||
void* buf_,
|
||||
unsigned int* count )
|
||||
{
|
||||
AF_StyleClass style_class;
|
||||
const hb_feature_t* feature;
|
||||
FT_Int upem;
|
||||
const char* q;
|
||||
int len;
|
||||
|
||||
hb_buffer_t* buf = (hb_buffer_t*)buf_;
|
||||
hb_font_t* font;
|
||||
hb_codepoint_t dummy;
|
||||
|
||||
|
||||
upem = (FT_Int)metrics->globals->face->units_per_EM;
|
||||
style_class = metrics->style_class;
|
||||
feature = features[style_class->coverage];
|
||||
|
||||
font = metrics->globals->hb_font;
|
||||
|
||||
/* we shape at a size of units per EM; this means font units */
|
||||
hb_font_set_scale( font, upem, upem );
|
||||
|
||||
while ( *p == ' ' )
|
||||
p++;
|
||||
|
||||
/* count bytes up to next space (or end of buffer) */
|
||||
q = p;
|
||||
while ( !( *q == ' ' || *q == '\0' ) )
|
||||
GET_UTF8_CHAR( dummy, q );
|
||||
len = (int)( q - p );
|
||||
|
||||
/* feed character(s) to the HarfBuzz buffer */
|
||||
hb_buffer_clear_contents( buf );
|
||||
hb_buffer_add_utf8( buf, p, len, 0, len );
|
||||
|
||||
/* we let HarfBuzz guess the script and writing direction */
|
||||
hb_buffer_guess_segment_properties( buf );
|
||||
|
||||
/* shape buffer, which means conversion from character codes to */
|
||||
/* glyph indices, possibly applying a feature */
|
||||
hb_shape( font, buf, feature, feature ? 1 : 0 );
|
||||
|
||||
if ( feature )
|
||||
{
|
||||
hb_buffer_t* hb_buf = metrics->globals->hb_buf;
|
||||
|
||||
unsigned int gcount;
|
||||
hb_glyph_info_t* ginfo;
|
||||
|
||||
unsigned int hb_gcount;
|
||||
hb_glyph_info_t* hb_ginfo;
|
||||
|
||||
|
||||
/* we have to check whether applying a feature does actually change */
|
||||
/* glyph indices; otherwise the affected glyph or glyphs aren't */
|
||||
/* available at all in the feature */
|
||||
|
||||
hb_buffer_clear_contents( hb_buf );
|
||||
hb_buffer_add_utf8( hb_buf, p, len, 0, len );
|
||||
hb_buffer_guess_segment_properties( hb_buf );
|
||||
hb_shape( font, hb_buf, NULL, 0 );
|
||||
|
||||
ginfo = hb_buffer_get_glyph_infos( buf, &gcount );
|
||||
hb_ginfo = hb_buffer_get_glyph_infos( hb_buf, &hb_gcount );
|
||||
|
||||
if ( gcount == hb_gcount )
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
|
||||
for (i = 0; i < gcount; i++ )
|
||||
if ( ginfo[i].codepoint != hb_ginfo[i].codepoint )
|
||||
break;
|
||||
|
||||
if ( i == gcount )
|
||||
{
|
||||
/* both buffers have identical glyph indices */
|
||||
hb_buffer_clear_contents( buf );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*count = hb_buffer_get_length( buf );
|
||||
|
||||
#ifdef FT_DEBUG_LEVEL_TRACE
|
||||
if ( feature && *count > 1 )
|
||||
FT_TRACE1(( "af_shaper_get_cluster:"
|
||||
" input character mapped to multiple glyphs\n" ));
|
||||
#endif
|
||||
|
||||
return q;
|
||||
}
|
||||
|
||||
|
||||
FT_ULong
|
||||
af_shaper_get_elem( AF_StyleMetrics metrics,
|
||||
void* buf_,
|
||||
unsigned int idx,
|
||||
FT_Long* advance,
|
||||
FT_Long* y_offset )
|
||||
{
|
||||
hb_buffer_t* buf = (hb_buffer_t*)buf_;
|
||||
hb_glyph_info_t* ginfo;
|
||||
hb_glyph_position_t* gpos;
|
||||
unsigned int gcount;
|
||||
|
||||
FT_UNUSED( metrics );
|
||||
|
||||
|
||||
ginfo = hb_buffer_get_glyph_infos( buf, &gcount );
|
||||
gpos = hb_buffer_get_glyph_positions( buf, &gcount );
|
||||
|
||||
if ( idx >= gcount )
|
||||
return 0;
|
||||
|
||||
if ( advance )
|
||||
*advance = gpos[idx].x_advance;
|
||||
if ( y_offset )
|
||||
*y_offset = gpos[idx].y_offset;
|
||||
|
||||
return ginfo[idx].codepoint;
|
||||
}
|
||||
|
||||
|
||||
#else /* !FT_CONFIG_OPTION_USE_HARFBUZZ */
|
||||
|
||||
|
||||
FT_Error
|
||||
af_shaper_get_coverage( AF_FaceGlobals globals,
|
||||
AF_StyleClass style_class,
|
||||
FT_UShort* gstyles,
|
||||
FT_Bool default_script )
|
||||
{
|
||||
FT_UNUSED( globals );
|
||||
FT_UNUSED( style_class );
|
||||
FT_UNUSED( gstyles );
|
||||
FT_UNUSED( default_script );
|
||||
|
||||
return FT_Err_Ok;
|
||||
}
|
||||
|
||||
|
||||
void*
|
||||
af_shaper_buf_create( FT_Face face )
|
||||
{
|
||||
FT_Error error;
|
||||
FT_Memory memory = face->memory;
|
||||
FT_ULong* buf;
|
||||
|
||||
|
||||
FT_MEM_ALLOC( buf, sizeof ( FT_ULong ) );
|
||||
|
||||
return (void*)buf;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
af_shaper_buf_destroy( FT_Face face,
|
||||
void* buf )
|
||||
{
|
||||
FT_Memory memory = face->memory;
|
||||
|
||||
|
||||
FT_FREE( buf );
|
||||
}
|
||||
|
||||
|
||||
const char*
|
||||
af_shaper_get_cluster( const char* p,
|
||||
AF_StyleMetrics metrics,
|
||||
void* buf_,
|
||||
unsigned int* count )
|
||||
{
|
||||
FT_Face face = metrics->globals->face;
|
||||
FT_ULong ch, dummy = 0;
|
||||
FT_ULong* buf = (FT_ULong*)buf_;
|
||||
|
||||
|
||||
while ( *p == ' ' )
|
||||
p++;
|
||||
|
||||
GET_UTF8_CHAR( ch, p );
|
||||
|
||||
/* since we don't have an engine to handle clusters, */
|
||||
/* we scan the characters but return zero */
|
||||
while ( !( *p == ' ' || *p == '\0' ) )
|
||||
GET_UTF8_CHAR( dummy, p );
|
||||
|
||||
if ( dummy )
|
||||
{
|
||||
*buf = 0;
|
||||
*count = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
*buf = FT_Get_Char_Index( face, ch );
|
||||
*count = 1;
|
||||
}
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
FT_ULong
|
||||
af_shaper_get_elem( AF_StyleMetrics metrics,
|
||||
void* buf_,
|
||||
unsigned int idx,
|
||||
FT_Long* advance,
|
||||
FT_Long* y_offset )
|
||||
{
|
||||
FT_Face face = metrics->globals->face;
|
||||
FT_ULong glyph_index = *(FT_ULong*)buf_;
|
||||
|
||||
FT_UNUSED( idx );
|
||||
|
||||
|
||||
if ( advance )
|
||||
FT_Get_Advance( face,
|
||||
glyph_index,
|
||||
FT_LOAD_NO_SCALE |
|
||||
FT_LOAD_NO_HINTING |
|
||||
FT_LOAD_IGNORE_TRANSFORM,
|
||||
advance );
|
||||
|
||||
if ( y_offset )
|
||||
*y_offset = 0;
|
||||
|
||||
return glyph_index;
|
||||
}
|
||||
|
||||
|
||||
#endif /* !FT_CONFIG_OPTION_USE_HARFBUZZ */
|
||||
|
||||
|
||||
/* END */
|
||||
72
vendor/FreeType2/src/autofit/afshaper.h
vendored
Normal file
72
vendor/FreeType2/src/autofit/afshaper.h
vendored
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
/***************************************************************************/
|
||||
/* */
|
||||
/* afshaper.h */
|
||||
/* */
|
||||
/* HarfBuzz interface for accessing OpenType features (specification). */
|
||||
/* */
|
||||
/* Copyright 2013-2018 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. */
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
|
||||
#ifndef AFSHAPER_H_
|
||||
#define AFSHAPER_H_
|
||||
|
||||
|
||||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
|
||||
|
||||
#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ
|
||||
|
||||
#include <hb.h>
|
||||
#include <hb-ot.h>
|
||||
#include <hb-ft.h>
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
FT_BEGIN_HEADER
|
||||
|
||||
FT_Error
|
||||
af_shaper_get_coverage( AF_FaceGlobals globals,
|
||||
AF_StyleClass style_class,
|
||||
FT_UShort* gstyles,
|
||||
FT_Bool default_script );
|
||||
|
||||
|
||||
void*
|
||||
af_shaper_buf_create( FT_Face face );
|
||||
|
||||
void
|
||||
af_shaper_buf_destroy( FT_Face face,
|
||||
void* buf );
|
||||
|
||||
const char*
|
||||
af_shaper_get_cluster( const char* p,
|
||||
AF_StyleMetrics metrics,
|
||||
void* buf_,
|
||||
unsigned int* count );
|
||||
|
||||
FT_ULong
|
||||
af_shaper_get_elem( AF_StyleMetrics metrics,
|
||||
void* buf_,
|
||||
unsigned int idx,
|
||||
FT_Long* x_advance,
|
||||
FT_Long* y_offset );
|
||||
|
||||
/* */
|
||||
|
||||
FT_END_HEADER
|
||||
|
||||
#endif /* AFSHAPER_H_ */
|
||||
|
||||
|
||||
/* END */
|
||||
475
vendor/FreeType2/src/autofit/afstyles.h
vendored
Normal file
475
vendor/FreeType2/src/autofit/afstyles.h
vendored
Normal file
|
|
@ -0,0 +1,475 @@
|
|||
/***************************************************************************/
|
||||
/* */
|
||||
/* afstyles.h */
|
||||
/* */
|
||||
/* Auto-fitter styles (specification only). */
|
||||
/* */
|
||||
/* Copyright 2013-2018 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. */
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
|
||||
/* The following part can be included multiple times. */
|
||||
/* Define `STYLE' as needed. */
|
||||
|
||||
|
||||
/* Add new styles here. The first and second arguments are the */
|
||||
/* style name in lowercase and uppercase, respectively, followed */
|
||||
/* by a description string. The next arguments are the */
|
||||
/* corresponding writing system, script, blue stringset, and */
|
||||
/* coverage. */
|
||||
/* */
|
||||
/* Note that styles using `AF_COVERAGE_DEFAULT' should always */
|
||||
/* come after styles with other coverages. Also note that */
|
||||
/* fallback scripts only use `AF_COVERAGE_DEFAULT' for its */
|
||||
/* style. */
|
||||
/* */
|
||||
/* Example: */
|
||||
/* */
|
||||
/* STYLE( cyrl_dflt, CYRL_DFLT, */
|
||||
/* "Cyrillic default style", */
|
||||
/* AF_WRITING_SYSTEM_LATIN, */
|
||||
/* AF_SCRIPT_CYRL, */
|
||||
/* AF_BLUE_STRINGSET_CYRL, */
|
||||
/* AF_COVERAGE_DEFAULT ) */
|
||||
|
||||
#undef STYLE_LATIN
|
||||
#define STYLE_LATIN( s, S, f, F, ds, df, C ) \
|
||||
STYLE( s ## _ ## f, S ## _ ## F, \
|
||||
ds " " df " style", \
|
||||
AF_WRITING_SYSTEM_LATIN, \
|
||||
AF_SCRIPT_ ## S, \
|
||||
AF_BLUE_STRINGSET_ ## S, \
|
||||
AF_COVERAGE_ ## C )
|
||||
|
||||
#undef META_STYLE_LATIN
|
||||
#define META_STYLE_LATIN( s, S, ds ) \
|
||||
STYLE_LATIN( s, S, c2cp, C2CP, ds, \
|
||||
"petite capitals from capitals", \
|
||||
PETITE_CAPITALS_FROM_CAPITALS ) \
|
||||
STYLE_LATIN( s, S, c2sc, C2SC, ds, \
|
||||
"small capitals from capitals", \
|
||||
SMALL_CAPITALS_FROM_CAPITALS ) \
|
||||
STYLE_LATIN( s, S, ordn, ORDN, ds, \
|
||||
"ordinals", \
|
||||
ORDINALS ) \
|
||||
STYLE_LATIN( s, S, pcap, PCAP, ds, \
|
||||
"petite capitals", \
|
||||
PETITE_CAPITALS ) \
|
||||
STYLE_LATIN( s, S, sinf, SINF, ds, \
|
||||
"scientific inferiors", \
|
||||
SCIENTIFIC_INFERIORS ) \
|
||||
STYLE_LATIN( s, S, smcp, SMCP, ds, \
|
||||
"small capitals", \
|
||||
SMALL_CAPITALS ) \
|
||||
STYLE_LATIN( s, S, subs, SUBS, ds, \
|
||||
"subscript", \
|
||||
SUBSCRIPT ) \
|
||||
STYLE_LATIN( s, S, sups, SUPS, ds, \
|
||||
"superscript", \
|
||||
SUPERSCRIPT ) \
|
||||
STYLE_LATIN( s, S, titl, TITL, ds, \
|
||||
"titling", \
|
||||
TITLING ) \
|
||||
STYLE_LATIN( s, S, dflt, DFLT, ds, \
|
||||
"default", \
|
||||
DEFAULT )
|
||||
|
||||
|
||||
STYLE( adlm_dflt, ADLM_DFLT,
|
||||
"Adlam default style",
|
||||
AF_WRITING_SYSTEM_LATIN,
|
||||
AF_SCRIPT_ADLM,
|
||||
AF_BLUE_STRINGSET_ADLM,
|
||||
AF_COVERAGE_DEFAULT )
|
||||
|
||||
STYLE( arab_dflt, ARAB_DFLT,
|
||||
"Arabic default style",
|
||||
AF_WRITING_SYSTEM_LATIN,
|
||||
AF_SCRIPT_ARAB,
|
||||
AF_BLUE_STRINGSET_ARAB,
|
||||
AF_COVERAGE_DEFAULT )
|
||||
|
||||
STYLE( armn_dflt, ARMN_DFLT,
|
||||
"Armenian default style",
|
||||
AF_WRITING_SYSTEM_LATIN,
|
||||
AF_SCRIPT_ARMN,
|
||||
AF_BLUE_STRINGSET_ARMN,
|
||||
AF_COVERAGE_DEFAULT )
|
||||
|
||||
STYLE( avst_dflt, AVST_DFLT,
|
||||
"Avestan default style",
|
||||
AF_WRITING_SYSTEM_LATIN,
|
||||
AF_SCRIPT_AVST,
|
||||
AF_BLUE_STRINGSET_AVST,
|
||||
AF_COVERAGE_DEFAULT )
|
||||
|
||||
STYLE( bamu_dflt, BAMU_DFLT,
|
||||
"Bamum default style",
|
||||
AF_WRITING_SYSTEM_LATIN,
|
||||
AF_SCRIPT_BAMU,
|
||||
AF_BLUE_STRINGSET_BAMU,
|
||||
AF_COVERAGE_DEFAULT )
|
||||
|
||||
STYLE( beng_dflt, BENG_DFLT,
|
||||
"Bengali default style",
|
||||
AF_WRITING_SYSTEM_LATIN,
|
||||
AF_SCRIPT_BENG,
|
||||
AF_BLUE_STRINGSET_BENG,
|
||||
AF_COVERAGE_DEFAULT )
|
||||
|
||||
STYLE( buhd_dflt, BUHD_DFLT,
|
||||
"Buhid default style",
|
||||
AF_WRITING_SYSTEM_LATIN,
|
||||
AF_SCRIPT_BUHD,
|
||||
AF_BLUE_STRINGSET_BUHD,
|
||||
AF_COVERAGE_DEFAULT )
|
||||
|
||||
STYLE( cakm_dflt, CAKM_DFLT,
|
||||
"Chakma default style",
|
||||
AF_WRITING_SYSTEM_LATIN,
|
||||
AF_SCRIPT_CAKM,
|
||||
AF_BLUE_STRINGSET_CAKM,
|
||||
AF_COVERAGE_DEFAULT )
|
||||
|
||||
STYLE( cans_dflt, CANS_DFLT,
|
||||
"Canadian Syllabics default style",
|
||||
AF_WRITING_SYSTEM_LATIN,
|
||||
AF_SCRIPT_CANS,
|
||||
AF_BLUE_STRINGSET_CANS,
|
||||
AF_COVERAGE_DEFAULT )
|
||||
|
||||
STYLE( cari_dflt, CARI_DFLT,
|
||||
"Carian default style",
|
||||
AF_WRITING_SYSTEM_LATIN,
|
||||
AF_SCRIPT_CARI,
|
||||
AF_BLUE_STRINGSET_CARI,
|
||||
AF_COVERAGE_DEFAULT )
|
||||
|
||||
STYLE( cher_dflt, CHER_DFLT,
|
||||
"Cherokee default style",
|
||||
AF_WRITING_SYSTEM_LATIN,
|
||||
AF_SCRIPT_CHER,
|
||||
AF_BLUE_STRINGSET_CHER,
|
||||
AF_COVERAGE_DEFAULT )
|
||||
|
||||
STYLE( copt_dflt, COPT_DFLT,
|
||||
"Coptic default style",
|
||||
AF_WRITING_SYSTEM_LATIN,
|
||||
AF_SCRIPT_COPT,
|
||||
AF_BLUE_STRINGSET_COPT,
|
||||
AF_COVERAGE_DEFAULT )
|
||||
|
||||
STYLE( cprt_dflt, CPRT_DFLT,
|
||||
"Cypriot default style",
|
||||
AF_WRITING_SYSTEM_LATIN,
|
||||
AF_SCRIPT_CPRT,
|
||||
AF_BLUE_STRINGSET_CPRT,
|
||||
AF_COVERAGE_DEFAULT )
|
||||
|
||||
META_STYLE_LATIN( cyrl, CYRL, "Cyrillic" )
|
||||
|
||||
STYLE( deva_dflt, DEVA_DFLT,
|
||||
"Devanagari default style",
|
||||
AF_WRITING_SYSTEM_LATIN,
|
||||
AF_SCRIPT_DEVA,
|
||||
AF_BLUE_STRINGSET_DEVA,
|
||||
AF_COVERAGE_DEFAULT )
|
||||
|
||||
STYLE( dsrt_dflt, DSRT_DFLT,
|
||||
"Deseret default style",
|
||||
AF_WRITING_SYSTEM_LATIN,
|
||||
AF_SCRIPT_DSRT,
|
||||
AF_BLUE_STRINGSET_DSRT,
|
||||
AF_COVERAGE_DEFAULT )
|
||||
|
||||
STYLE( ethi_dflt, ETHI_DFLT,
|
||||
"Ethiopic default style",
|
||||
AF_WRITING_SYSTEM_LATIN,
|
||||
AF_SCRIPT_ETHI,
|
||||
AF_BLUE_STRINGSET_ETHI,
|
||||
AF_COVERAGE_DEFAULT )
|
||||
|
||||
STYLE( geor_dflt, GEOR_DFLT,
|
||||
"Georgian (Mkhedruli) default style",
|
||||
AF_WRITING_SYSTEM_LATIN,
|
||||
AF_SCRIPT_GEOR,
|
||||
AF_BLUE_STRINGSET_GEOR,
|
||||
AF_COVERAGE_DEFAULT )
|
||||
|
||||
STYLE( geok_dflt, GEOK_DFLT,
|
||||
"Georgian (Khutsuri) default style",
|
||||
AF_WRITING_SYSTEM_LATIN,
|
||||
AF_SCRIPT_GEOK,
|
||||
AF_BLUE_STRINGSET_GEOK,
|
||||
AF_COVERAGE_DEFAULT )
|
||||
|
||||
STYLE( glag_dflt, GLAG_DFLT,
|
||||
"Glagolitic default style",
|
||||
AF_WRITING_SYSTEM_LATIN,
|
||||
AF_SCRIPT_GLAG,
|
||||
AF_BLUE_STRINGSET_GLAG,
|
||||
AF_COVERAGE_DEFAULT )
|
||||
|
||||
STYLE( goth_dflt, GOTH_DFLT,
|
||||
"Gothic default style",
|
||||
AF_WRITING_SYSTEM_LATIN,
|
||||
AF_SCRIPT_GOTH,
|
||||
AF_BLUE_STRINGSET_GOTH,
|
||||
AF_COVERAGE_DEFAULT )
|
||||
|
||||
META_STYLE_LATIN( grek, GREK, "Greek" )
|
||||
|
||||
STYLE( gujr_dflt, GUJR_DFLT,
|
||||
"Gujarati default style",
|
||||
AF_WRITING_SYSTEM_LATIN,
|
||||
AF_SCRIPT_GUJR,
|
||||
AF_BLUE_STRINGSET_GUJR,
|
||||
AF_COVERAGE_DEFAULT )
|
||||
|
||||
STYLE( guru_dflt, GURU_DFLT,
|
||||
"Gurmukhi default style",
|
||||
AF_WRITING_SYSTEM_LATIN,
|
||||
AF_SCRIPT_GURU,
|
||||
AF_BLUE_STRINGSET_GURU,
|
||||
AF_COVERAGE_DEFAULT )
|
||||
|
||||
STYLE( hebr_dflt, HEBR_DFLT,
|
||||
"Hebrew default style",
|
||||
AF_WRITING_SYSTEM_LATIN,
|
||||
AF_SCRIPT_HEBR,
|
||||
AF_BLUE_STRINGSET_HEBR,
|
||||
AF_COVERAGE_DEFAULT )
|
||||
|
||||
STYLE( kali_dflt, KALI_DFLT,
|
||||
"Kayah Li default style",
|
||||
AF_WRITING_SYSTEM_LATIN,
|
||||
AF_SCRIPT_KALI,
|
||||
AF_BLUE_STRINGSET_KALI,
|
||||
AF_COVERAGE_DEFAULT )
|
||||
|
||||
STYLE( khmr_dflt, KHMR_DFLT,
|
||||
"Khmer default style",
|
||||
AF_WRITING_SYSTEM_LATIN,
|
||||
AF_SCRIPT_KHMR,
|
||||
AF_BLUE_STRINGSET_KHMR,
|
||||
AF_COVERAGE_DEFAULT )
|
||||
|
||||
STYLE( khms_dflt, KHMS_DFLT,
|
||||
"Khmer Symbols default style",
|
||||
AF_WRITING_SYSTEM_LATIN,
|
||||
AF_SCRIPT_KHMS,
|
||||
AF_BLUE_STRINGSET_KHMS,
|
||||
AF_COVERAGE_DEFAULT )
|
||||
|
||||
STYLE( knda_dflt, KNDA_DFLT,
|
||||
"Kannada default style",
|
||||
AF_WRITING_SYSTEM_LATIN,
|
||||
AF_SCRIPT_KNDA,
|
||||
AF_BLUE_STRINGSET_KNDA,
|
||||
AF_COVERAGE_DEFAULT )
|
||||
|
||||
STYLE( lao_dflt, LAO_DFLT,
|
||||
"Lao default style",
|
||||
AF_WRITING_SYSTEM_LATIN,
|
||||
AF_SCRIPT_LAO,
|
||||
AF_BLUE_STRINGSET_LAO,
|
||||
AF_COVERAGE_DEFAULT )
|
||||
|
||||
META_STYLE_LATIN( latn, LATN, "Latin" )
|
||||
|
||||
STYLE( latb_dflt, LATB_DFLT,
|
||||
"Latin subscript fallback default style",
|
||||
AF_WRITING_SYSTEM_LATIN,
|
||||
AF_SCRIPT_LATB,
|
||||
AF_BLUE_STRINGSET_LATB,
|
||||
AF_COVERAGE_DEFAULT )
|
||||
|
||||
STYLE( latp_dflt, LATP_DFLT,
|
||||
"Latin superscript fallback default style",
|
||||
AF_WRITING_SYSTEM_LATIN,
|
||||
AF_SCRIPT_LATP,
|
||||
AF_BLUE_STRINGSET_LATP,
|
||||
AF_COVERAGE_DEFAULT )
|
||||
|
||||
#ifdef FT_OPTION_AUTOFIT2
|
||||
STYLE( ltn2_dflt, LTN2_DFLT,
|
||||
"Latin 2 default style",
|
||||
AF_WRITING_SYSTEM_LATIN2,
|
||||
AF_SCRIPT_LATN,
|
||||
AF_BLUE_STRINGSET_LATN,
|
||||
AF_COVERAGE_DEFAULT )
|
||||
#endif
|
||||
|
||||
STYLE( lisu_dflt, LISU_DFLT,
|
||||
"Lisu default style",
|
||||
AF_WRITING_SYSTEM_LATIN,
|
||||
AF_SCRIPT_LISU,
|
||||
AF_BLUE_STRINGSET_LISU,
|
||||
AF_COVERAGE_DEFAULT )
|
||||
|
||||
STYLE( mlym_dflt, MLYM_DFLT,
|
||||
"Malayalam default style",
|
||||
AF_WRITING_SYSTEM_LATIN,
|
||||
AF_SCRIPT_MLYM,
|
||||
AF_BLUE_STRINGSET_MLYM,
|
||||
AF_COVERAGE_DEFAULT )
|
||||
|
||||
STYLE( mymr_dflt, MYMR_DFLT,
|
||||
"Myanmar default style",
|
||||
AF_WRITING_SYSTEM_LATIN,
|
||||
AF_SCRIPT_MYMR,
|
||||
AF_BLUE_STRINGSET_MYMR,
|
||||
AF_COVERAGE_DEFAULT )
|
||||
|
||||
STYLE( nkoo_dflt, NKOO_DFLT,
|
||||
"N'Ko default style",
|
||||
AF_WRITING_SYSTEM_LATIN,
|
||||
AF_SCRIPT_NKOO,
|
||||
AF_BLUE_STRINGSET_NKOO,
|
||||
AF_COVERAGE_DEFAULT )
|
||||
|
||||
STYLE( none_dflt, NONE_DFLT,
|
||||
"no style",
|
||||
AF_WRITING_SYSTEM_DUMMY,
|
||||
AF_SCRIPT_NONE,
|
||||
AF_BLUE_STRINGSET_NONE,
|
||||
AF_COVERAGE_DEFAULT )
|
||||
|
||||
STYLE( olck_dflt, OLCK_DFLT,
|
||||
"Ol Chiki default style",
|
||||
AF_WRITING_SYSTEM_LATIN,
|
||||
AF_SCRIPT_OLCK,
|
||||
AF_BLUE_STRINGSET_OLCK,
|
||||
AF_COVERAGE_DEFAULT )
|
||||
|
||||
STYLE( orkh_dflt, ORKH_DFLT,
|
||||
"Old Turkic default style",
|
||||
AF_WRITING_SYSTEM_LATIN,
|
||||
AF_SCRIPT_ORKH,
|
||||
AF_BLUE_STRINGSET_ORKH,
|
||||
AF_COVERAGE_DEFAULT )
|
||||
|
||||
STYLE( osge_dflt, OSGE_DFLT,
|
||||
"Osage default style",
|
||||
AF_WRITING_SYSTEM_LATIN,
|
||||
AF_SCRIPT_OSGE,
|
||||
AF_BLUE_STRINGSET_OSGE,
|
||||
AF_COVERAGE_DEFAULT )
|
||||
|
||||
STYLE( osma_dflt, OSMA_DFLT,
|
||||
"Osmanya default style",
|
||||
AF_WRITING_SYSTEM_LATIN,
|
||||
AF_SCRIPT_OSMA,
|
||||
AF_BLUE_STRINGSET_OSMA,
|
||||
AF_COVERAGE_DEFAULT )
|
||||
|
||||
STYLE( saur_dflt, SAUR_DFLT,
|
||||
"Saurashtra default style",
|
||||
AF_WRITING_SYSTEM_LATIN,
|
||||
AF_SCRIPT_SAUR,
|
||||
AF_BLUE_STRINGSET_SAUR,
|
||||
AF_COVERAGE_DEFAULT )
|
||||
|
||||
STYLE( shaw_dflt, SHAW_DFLT,
|
||||
"Shavian default style",
|
||||
AF_WRITING_SYSTEM_LATIN,
|
||||
AF_SCRIPT_SHAW,
|
||||
AF_BLUE_STRINGSET_SHAW,
|
||||
AF_COVERAGE_DEFAULT )
|
||||
|
||||
STYLE( sinh_dflt, SINH_DFLT,
|
||||
"Sinhala default style",
|
||||
AF_WRITING_SYSTEM_LATIN,
|
||||
AF_SCRIPT_SINH,
|
||||
AF_BLUE_STRINGSET_SINH,
|
||||
AF_COVERAGE_DEFAULT )
|
||||
|
||||
STYLE( sund_dflt, SUND_DFLT,
|
||||
"Sundanese default style",
|
||||
AF_WRITING_SYSTEM_LATIN,
|
||||
AF_SCRIPT_SUND,
|
||||
AF_BLUE_STRINGSET_SUND,
|
||||
AF_COVERAGE_DEFAULT )
|
||||
|
||||
STYLE( taml_dflt, TAML_DFLT,
|
||||
"Tamil default style",
|
||||
AF_WRITING_SYSTEM_LATIN,
|
||||
AF_SCRIPT_TAML,
|
||||
AF_BLUE_STRINGSET_TAML,
|
||||
AF_COVERAGE_DEFAULT )
|
||||
|
||||
STYLE( tavt_dflt, TAVT_DFLT,
|
||||
"Tai Viet default style",
|
||||
AF_WRITING_SYSTEM_LATIN,
|
||||
AF_SCRIPT_TAVT,
|
||||
AF_BLUE_STRINGSET_TAVT,
|
||||
AF_COVERAGE_DEFAULT )
|
||||
|
||||
STYLE( telu_dflt, TELU_DFLT,
|
||||
"Telugu default style",
|
||||
AF_WRITING_SYSTEM_LATIN,
|
||||
AF_SCRIPT_TELU,
|
||||
AF_BLUE_STRINGSET_TELU,
|
||||
AF_COVERAGE_DEFAULT )
|
||||
|
||||
STYLE( tfng_dflt, TFNG_DFLT,
|
||||
"Tifinagh default style",
|
||||
AF_WRITING_SYSTEM_LATIN,
|
||||
AF_SCRIPT_TFNG,
|
||||
AF_BLUE_STRINGSET_TFNG,
|
||||
AF_COVERAGE_DEFAULT )
|
||||
|
||||
STYLE( thai_dflt, THAI_DFLT,
|
||||
"Thai default style",
|
||||
AF_WRITING_SYSTEM_LATIN,
|
||||
AF_SCRIPT_THAI,
|
||||
AF_BLUE_STRINGSET_THAI,
|
||||
AF_COVERAGE_DEFAULT )
|
||||
|
||||
STYLE( vaii_dflt, VAII_DFLT,
|
||||
"Vai default style",
|
||||
AF_WRITING_SYSTEM_LATIN,
|
||||
AF_SCRIPT_VAII,
|
||||
AF_BLUE_STRINGSET_VAII,
|
||||
AF_COVERAGE_DEFAULT )
|
||||
|
||||
#ifdef AF_CONFIG_OPTION_INDIC
|
||||
|
||||
/* no blue stringset support for the Indic writing system yet */
|
||||
#undef STYLE_DEFAULT_INDIC
|
||||
#define STYLE_DEFAULT_INDIC( s, S, d ) \
|
||||
STYLE( s ## _dflt, S ## _DFLT, \
|
||||
d " default style", \
|
||||
AF_WRITING_SYSTEM_INDIC, \
|
||||
AF_SCRIPT_ ## S, \
|
||||
(AF_Blue_Stringset)0, \
|
||||
AF_COVERAGE_DEFAULT )
|
||||
|
||||
STYLE_DEFAULT_INDIC( limb, LIMB, "Limbu" )
|
||||
STYLE_DEFAULT_INDIC( orya, ORYA, "Oriya" )
|
||||
STYLE_DEFAULT_INDIC( sylo, SYLO, "Syloti Nagri" )
|
||||
STYLE_DEFAULT_INDIC( tibt, TIBT, "Tibetan" )
|
||||
|
||||
#endif /* AF_CONFIG_OPTION_INDIC */
|
||||
|
||||
#ifdef AF_CONFIG_OPTION_CJK
|
||||
|
||||
STYLE( hani_dflt, HANI_DFLT,
|
||||
"CJKV ideographs default style",
|
||||
AF_WRITING_SYSTEM_CJK,
|
||||
AF_SCRIPT_HANI,
|
||||
AF_BLUE_STRINGSET_HANI,
|
||||
AF_COVERAGE_DEFAULT )
|
||||
|
||||
#endif /* AF_CONFIG_OPTION_CJK */
|
||||
|
||||
|
||||
/* END */
|
||||
651
vendor/FreeType2/src/autofit/aftypes.h
vendored
Normal file
651
vendor/FreeType2/src/autofit/aftypes.h
vendored
Normal file
|
|
@ -0,0 +1,651 @@
|
|||
/***************************************************************************/
|
||||
/* */
|
||||
/* aftypes.h */
|
||||
/* */
|
||||
/* Auto-fitter types (specification only). */
|
||||
/* */
|
||||
/* Copyright 2003-2018 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. */
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
*
|
||||
* The auto-fitter is a complete rewrite of the old auto-hinter.
|
||||
* Its main feature is the ability to differentiate between different
|
||||
* writing systems and scripts in order to apply specific rules.
|
||||
*
|
||||
* The code has also been compartmentalized into several entities that
|
||||
* should make algorithmic experimentation easier than with the old
|
||||
* code.
|
||||
*
|
||||
*************************************************************************/
|
||||
|
||||
|
||||
#ifndef AFTYPES_H_
|
||||
#define AFTYPES_H_
|
||||
|
||||
#include <ft2build.h>
|
||||
|
||||
#include FT_FREETYPE_H
|
||||
#include FT_OUTLINE_H
|
||||
#include FT_INTERNAL_OBJECTS_H
|
||||
#include FT_INTERNAL_DEBUG_H
|
||||
|
||||
#include "afblue.h"
|
||||
|
||||
#ifdef FT_DEBUG_AUTOFIT
|
||||
#include FT_CONFIG_STANDARD_LIBRARY_H
|
||||
#endif
|
||||
|
||||
|
||||
FT_BEGIN_HEADER
|
||||
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/***** *****/
|
||||
/***** D E B U G G I N G *****/
|
||||
/***** *****/
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
|
||||
#ifdef FT_DEBUG_AUTOFIT
|
||||
|
||||
extern int _af_debug_disable_horz_hints;
|
||||
extern int _af_debug_disable_vert_hints;
|
||||
extern int _af_debug_disable_blue_hints;
|
||||
extern void* _af_debug_hints;
|
||||
|
||||
#endif /* FT_DEBUG_AUTOFIT */
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/***** *****/
|
||||
/***** U T I L I T Y S T U F F *****/
|
||||
/***** *****/
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
|
||||
typedef struct AF_WidthRec_
|
||||
{
|
||||
FT_Pos org; /* original position/width in font units */
|
||||
FT_Pos cur; /* current/scaled position/width in device subpixels */
|
||||
FT_Pos fit; /* current/fitted position/width in device subpixels */
|
||||
|
||||
} AF_WidthRec, *AF_Width;
|
||||
|
||||
|
||||
FT_LOCAL( void )
|
||||
af_sort_pos( FT_UInt count,
|
||||
FT_Pos* table );
|
||||
|
||||
FT_LOCAL( void )
|
||||
af_sort_and_quantize_widths( FT_UInt* count,
|
||||
AF_Width widths,
|
||||
FT_Pos threshold );
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/***** *****/
|
||||
/***** A N G L E T Y P E S *****/
|
||||
/***** *****/
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
|
||||
/*
|
||||
* The auto-fitter doesn't need a very high angular accuracy;
|
||||
* this allows us to speed up some computations considerably with a
|
||||
* light Cordic algorithm (see afangles.c).
|
||||
*/
|
||||
|
||||
typedef FT_Int AF_Angle;
|
||||
|
||||
|
||||
#define AF_ANGLE_PI 256
|
||||
#define AF_ANGLE_2PI ( AF_ANGLE_PI * 2 )
|
||||
#define AF_ANGLE_PI2 ( AF_ANGLE_PI / 2 )
|
||||
#define AF_ANGLE_PI4 ( AF_ANGLE_PI / 4 )
|
||||
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* compute the angle of a given 2-D vector
|
||||
*/
|
||||
FT_LOCAL( AF_Angle )
|
||||
af_angle_atan( FT_Pos dx,
|
||||
FT_Pos dy );
|
||||
|
||||
|
||||
/*
|
||||
* compute `angle2 - angle1'; the result is always within
|
||||
* the range [-AF_ANGLE_PI .. AF_ANGLE_PI - 1]
|
||||
*/
|
||||
FT_LOCAL( AF_Angle )
|
||||
af_angle_diff( AF_Angle angle1,
|
||||
AF_Angle angle2 );
|
||||
#endif /* 0 */
|
||||
|
||||
|
||||
#define AF_ANGLE_DIFF( result, angle1, angle2 ) \
|
||||
FT_BEGIN_STMNT \
|
||||
AF_Angle _delta = (angle2) - (angle1); \
|
||||
\
|
||||
\
|
||||
while ( _delta <= -AF_ANGLE_PI ) \
|
||||
_delta += AF_ANGLE_2PI; \
|
||||
\
|
||||
while ( _delta > AF_ANGLE_PI ) \
|
||||
_delta -= AF_ANGLE_2PI; \
|
||||
\
|
||||
result = _delta; \
|
||||
FT_END_STMNT
|
||||
|
||||
|
||||
/* opaque handle to glyph-specific hints -- see `afhints.h' for more
|
||||
* details
|
||||
*/
|
||||
typedef struct AF_GlyphHintsRec_* AF_GlyphHints;
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/***** *****/
|
||||
/***** S C A L E R S *****/
|
||||
/***** *****/
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
|
||||
/*
|
||||
* A scaler models the target pixel device that will receive the
|
||||
* auto-hinted glyph image.
|
||||
*/
|
||||
|
||||
#define AF_SCALER_FLAG_NO_HORIZONTAL 1U /* disable horizontal hinting */
|
||||
#define AF_SCALER_FLAG_NO_VERTICAL 2U /* disable vertical hinting */
|
||||
#define AF_SCALER_FLAG_NO_ADVANCE 4U /* disable advance hinting */
|
||||
#define AF_SCALER_FLAG_NO_WARPER 8U /* disable warper */
|
||||
|
||||
|
||||
typedef struct AF_ScalerRec_
|
||||
{
|
||||
FT_Face face; /* source font face */
|
||||
FT_Fixed x_scale; /* from font units to 1/64th device pixels */
|
||||
FT_Fixed y_scale; /* from font units to 1/64th device pixels */
|
||||
FT_Pos x_delta; /* in 1/64th device pixels */
|
||||
FT_Pos y_delta; /* in 1/64th device pixels */
|
||||
FT_Render_Mode render_mode; /* monochrome, anti-aliased, LCD, etc. */
|
||||
FT_UInt32 flags; /* additional control flags, see above */
|
||||
|
||||
} AF_ScalerRec, *AF_Scaler;
|
||||
|
||||
|
||||
#define AF_SCALER_EQUAL_SCALES( a, b ) \
|
||||
( (a)->x_scale == (b)->x_scale && \
|
||||
(a)->y_scale == (b)->y_scale && \
|
||||
(a)->x_delta == (b)->x_delta && \
|
||||
(a)->y_delta == (b)->y_delta )
|
||||
|
||||
|
||||
typedef struct AF_StyleMetricsRec_* AF_StyleMetrics;
|
||||
|
||||
/* This function parses an FT_Face to compute global metrics for
|
||||
* a specific style.
|
||||
*/
|
||||
typedef FT_Error
|
||||
(*AF_WritingSystem_InitMetricsFunc)( AF_StyleMetrics metrics,
|
||||
FT_Face face );
|
||||
|
||||
typedef void
|
||||
(*AF_WritingSystem_ScaleMetricsFunc)( AF_StyleMetrics metrics,
|
||||
AF_Scaler scaler );
|
||||
|
||||
typedef void
|
||||
(*AF_WritingSystem_DoneMetricsFunc)( AF_StyleMetrics metrics );
|
||||
|
||||
typedef void
|
||||
(*AF_WritingSystem_GetStdWidthsFunc)( AF_StyleMetrics metrics,
|
||||
FT_Pos* stdHW,
|
||||
FT_Pos* stdVW );
|
||||
|
||||
|
||||
typedef FT_Error
|
||||
(*AF_WritingSystem_InitHintsFunc)( AF_GlyphHints hints,
|
||||
AF_StyleMetrics metrics );
|
||||
|
||||
typedef FT_Error
|
||||
(*AF_WritingSystem_ApplyHintsFunc)( FT_UInt glyph_index,
|
||||
AF_GlyphHints hints,
|
||||
FT_Outline* outline,
|
||||
AF_StyleMetrics metrics );
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/***** *****/
|
||||
/***** W R I T I N G S Y S T E M S *****/
|
||||
/***** *****/
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
|
||||
/*
|
||||
* For the auto-hinter, a writing system consists of multiple scripts that
|
||||
* can be handled similarly *in a typographical way*; the relationship is
|
||||
* not based on history. For example, both the Greek and the unrelated
|
||||
* Armenian scripts share the same features like ascender, descender,
|
||||
* x-height, etc. Essentially, a writing system is covered by a
|
||||
* submodule of the auto-fitter; it contains
|
||||
*
|
||||
* - a specific global analyzer that computes global metrics specific to
|
||||
* the script (based on script-specific characters to identify ascender
|
||||
* height, x-height, etc.),
|
||||
*
|
||||
* - a specific glyph analyzer that computes segments and edges for each
|
||||
* glyph covered by the script,
|
||||
*
|
||||
* - a specific grid-fitting algorithm that distorts the scaled glyph
|
||||
* outline according to the results of the glyph analyzer.
|
||||
*/
|
||||
|
||||
#define AFWRTSYS_H_ /* don't load header files */
|
||||
#undef WRITING_SYSTEM
|
||||
#define WRITING_SYSTEM( ws, WS ) \
|
||||
AF_WRITING_SYSTEM_ ## WS,
|
||||
|
||||
/* The list of known writing systems. */
|
||||
typedef enum AF_WritingSystem_
|
||||
{
|
||||
|
||||
#include "afwrtsys.h"
|
||||
|
||||
AF_WRITING_SYSTEM_MAX /* do not remove */
|
||||
|
||||
} AF_WritingSystem;
|
||||
|
||||
#undef AFWRTSYS_H_
|
||||
|
||||
|
||||
typedef struct AF_WritingSystemClassRec_
|
||||
{
|
||||
AF_WritingSystem writing_system;
|
||||
|
||||
FT_Offset style_metrics_size;
|
||||
AF_WritingSystem_InitMetricsFunc style_metrics_init;
|
||||
AF_WritingSystem_ScaleMetricsFunc style_metrics_scale;
|
||||
AF_WritingSystem_DoneMetricsFunc style_metrics_done;
|
||||
AF_WritingSystem_GetStdWidthsFunc style_metrics_getstdw;
|
||||
|
||||
AF_WritingSystem_InitHintsFunc style_hints_init;
|
||||
AF_WritingSystem_ApplyHintsFunc style_hints_apply;
|
||||
|
||||
} AF_WritingSystemClassRec;
|
||||
|
||||
typedef const AF_WritingSystemClassRec* AF_WritingSystemClass;
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/***** *****/
|
||||
/***** S C R I P T S *****/
|
||||
/***** *****/
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
|
||||
/*
|
||||
* Each script is associated with two sets of Unicode ranges to test
|
||||
* whether the font face supports the script, and which non-base
|
||||
* characters the script contains.
|
||||
*
|
||||
* We use four-letter script tags from the OpenType specification,
|
||||
* extended by `NONE', which indicates `no script'.
|
||||
*/
|
||||
|
||||
#undef SCRIPT
|
||||
#define SCRIPT( s, S, d, h, H, ss ) \
|
||||
AF_SCRIPT_ ## S,
|
||||
|
||||
/* The list of known scripts. */
|
||||
typedef enum AF_Script_
|
||||
{
|
||||
|
||||
#include "afscript.h"
|
||||
|
||||
AF_SCRIPT_MAX /* do not remove */
|
||||
|
||||
} AF_Script;
|
||||
|
||||
|
||||
typedef struct AF_Script_UniRangeRec_
|
||||
{
|
||||
FT_UInt32 first;
|
||||
FT_UInt32 last;
|
||||
|
||||
} AF_Script_UniRangeRec;
|
||||
|
||||
#define AF_UNIRANGE_REC( a, b ) { (FT_UInt32)(a), (FT_UInt32)(b) }
|
||||
|
||||
typedef const AF_Script_UniRangeRec* AF_Script_UniRange;
|
||||
|
||||
|
||||
typedef struct AF_ScriptClassRec_
|
||||
{
|
||||
AF_Script script;
|
||||
|
||||
/* last element in the ranges must be { 0, 0 } */
|
||||
AF_Script_UniRange script_uni_ranges;
|
||||
AF_Script_UniRange script_uni_nonbase_ranges;
|
||||
|
||||
FT_Bool top_to_bottom_hinting;
|
||||
|
||||
const char* standard_charstring; /* for default width and height */
|
||||
|
||||
} AF_ScriptClassRec;
|
||||
|
||||
typedef const AF_ScriptClassRec* AF_ScriptClass;
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/***** *****/
|
||||
/***** C O V E R A G E S *****/
|
||||
/***** *****/
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
|
||||
/*
|
||||
* Usually, a font contains more glyphs than can be addressed by its
|
||||
* character map.
|
||||
*
|
||||
* In the PostScript font world, encoding vectors specific to a given
|
||||
* task are used to select such glyphs, and these glyphs can be often
|
||||
* recognized by having a suffix in its glyph names. For example, a
|
||||
* superscript glyph `A' might be called `A.sup'. Unfortunately, this
|
||||
* naming scheme is not standardized and thus unusable for us.
|
||||
*
|
||||
* In the OpenType world, a better solution was invented, namely
|
||||
* `features', which cleanly separate a character's input encoding from
|
||||
* the corresponding glyph's appearance, and which don't use glyph names
|
||||
* at all. For our purposes, and slightly generalized, an OpenType
|
||||
* feature is a name of a mapping that maps character codes to
|
||||
* non-standard glyph indices (features get used for other things also).
|
||||
* For example, the `sups' feature provides superscript glyphs, thus
|
||||
* mapping character codes like `A' or `B' to superscript glyph
|
||||
* representation forms. How this mapping happens is completely
|
||||
* uninteresting to us.
|
||||
*
|
||||
* For the auto-hinter, a `coverage' represents all glyphs of an OpenType
|
||||
* feature collected in a set (as listed below) that can be hinted
|
||||
* together. To continue the above example, superscript glyphs must not
|
||||
* be hinted together with normal glyphs because the blue zones
|
||||
* completely differ.
|
||||
*
|
||||
* Note that FreeType itself doesn't compute coverages; it only provides
|
||||
* the glyphs addressable by the default Unicode character map. Instead,
|
||||
* we use the HarfBuzz library (if available), which has many functions
|
||||
* exactly for this purpose.
|
||||
*
|
||||
* AF_COVERAGE_DEFAULT is special: It should cover everything that isn't
|
||||
* listed separately (including the glyphs addressable by the character
|
||||
* map). In case HarfBuzz isn't available, it exactly covers the glyphs
|
||||
* addressable by the character map.
|
||||
*
|
||||
*/
|
||||
|
||||
#undef COVERAGE
|
||||
#define COVERAGE( name, NAME, description, \
|
||||
tag1, tag2, tag3, tag4 ) \
|
||||
AF_COVERAGE_ ## NAME,
|
||||
|
||||
|
||||
typedef enum AF_Coverage_
|
||||
{
|
||||
#include "afcover.h"
|
||||
|
||||
AF_COVERAGE_DEFAULT
|
||||
|
||||
} AF_Coverage;
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/***** *****/
|
||||
/***** S T Y L E S *****/
|
||||
/***** *****/
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
|
||||
/*
|
||||
* The topmost structure for modelling the auto-hinter glyph input data
|
||||
* is a `style class', grouping everything together.
|
||||
*/
|
||||
|
||||
#undef STYLE
|
||||
#define STYLE( s, S, d, ws, sc, ss, c ) \
|
||||
AF_STYLE_ ## S,
|
||||
|
||||
/* The list of known styles. */
|
||||
typedef enum AF_Style_
|
||||
{
|
||||
|
||||
#include "afstyles.h"
|
||||
|
||||
AF_STYLE_MAX /* do not remove */
|
||||
|
||||
} AF_Style;
|
||||
|
||||
|
||||
typedef struct AF_StyleClassRec_
|
||||
{
|
||||
AF_Style style;
|
||||
|
||||
AF_WritingSystem writing_system;
|
||||
AF_Script script;
|
||||
AF_Blue_Stringset blue_stringset;
|
||||
AF_Coverage coverage;
|
||||
|
||||
} AF_StyleClassRec;
|
||||
|
||||
typedef const AF_StyleClassRec* AF_StyleClass;
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/***** *****/
|
||||
/***** S T Y L E M E T R I C S *****/
|
||||
/***** *****/
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
|
||||
typedef struct AF_FaceGlobalsRec_* AF_FaceGlobals;
|
||||
|
||||
/* This is the main structure that combines everything. Autofit modules */
|
||||
/* specific to writing systems derive their structures from it, for */
|
||||
/* example `AF_LatinMetrics'. */
|
||||
|
||||
typedef struct AF_StyleMetricsRec_
|
||||
{
|
||||
AF_StyleClass style_class;
|
||||
AF_ScalerRec scaler;
|
||||
FT_Bool digits_have_same_width;
|
||||
|
||||
AF_FaceGlobals globals; /* to access properties */
|
||||
|
||||
} AF_StyleMetricsRec;
|
||||
|
||||
|
||||
#define AF_HINTING_BOTTOM_TO_TOP 0
|
||||
#define AF_HINTING_TOP_TO_BOTTOM 1
|
||||
|
||||
|
||||
/* Declare and define vtables for classes */
|
||||
#ifndef FT_CONFIG_OPTION_PIC
|
||||
|
||||
#define AF_DECLARE_WRITING_SYSTEM_CLASS( writing_system_class ) \
|
||||
FT_CALLBACK_TABLE const AF_WritingSystemClassRec \
|
||||
writing_system_class;
|
||||
|
||||
#define AF_DEFINE_WRITING_SYSTEM_CLASS( \
|
||||
writing_system_class, \
|
||||
system, \
|
||||
m_size, \
|
||||
m_init, \
|
||||
m_scale, \
|
||||
m_done, \
|
||||
m_stdw, \
|
||||
h_init, \
|
||||
h_apply ) \
|
||||
FT_CALLBACK_TABLE_DEF \
|
||||
const AF_WritingSystemClassRec writing_system_class = \
|
||||
{ \
|
||||
system, \
|
||||
\
|
||||
m_size, \
|
||||
\
|
||||
m_init, \
|
||||
m_scale, \
|
||||
m_done, \
|
||||
m_stdw, \
|
||||
\
|
||||
h_init, \
|
||||
h_apply \
|
||||
};
|
||||
|
||||
|
||||
#define AF_DECLARE_SCRIPT_CLASS( script_class ) \
|
||||
FT_CALLBACK_TABLE const AF_ScriptClassRec \
|
||||
script_class;
|
||||
|
||||
#define AF_DEFINE_SCRIPT_CLASS( \
|
||||
script_class, \
|
||||
script, \
|
||||
ranges, \
|
||||
nonbase_ranges, \
|
||||
top_to_bottom, \
|
||||
std_charstring ) \
|
||||
FT_CALLBACK_TABLE_DEF \
|
||||
const AF_ScriptClassRec script_class = \
|
||||
{ \
|
||||
script, \
|
||||
ranges, \
|
||||
nonbase_ranges, \
|
||||
top_to_bottom, \
|
||||
std_charstring, \
|
||||
};
|
||||
|
||||
|
||||
#define AF_DECLARE_STYLE_CLASS( style_class ) \
|
||||
FT_CALLBACK_TABLE const AF_StyleClassRec \
|
||||
style_class;
|
||||
|
||||
#define AF_DEFINE_STYLE_CLASS( \
|
||||
style_class, \
|
||||
style, \
|
||||
writing_system, \
|
||||
script, \
|
||||
blue_stringset, \
|
||||
coverage ) \
|
||||
FT_CALLBACK_TABLE_DEF \
|
||||
const AF_StyleClassRec style_class = \
|
||||
{ \
|
||||
style, \
|
||||
writing_system, \
|
||||
script, \
|
||||
blue_stringset, \
|
||||
coverage \
|
||||
};
|
||||
|
||||
#else /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
#define AF_DECLARE_WRITING_SYSTEM_CLASS( writing_system_class ) \
|
||||
FT_LOCAL( void ) \
|
||||
FT_Init_Class_ ## writing_system_class( AF_WritingSystemClassRec* ac );
|
||||
|
||||
#define AF_DEFINE_WRITING_SYSTEM_CLASS( \
|
||||
writing_system_class, \
|
||||
system, \
|
||||
m_size, \
|
||||
m_init, \
|
||||
m_scale, \
|
||||
m_done, \
|
||||
m_stdw, \
|
||||
h_init, \
|
||||
h_apply ) \
|
||||
FT_LOCAL_DEF( void ) \
|
||||
FT_Init_Class_ ## writing_system_class( AF_WritingSystemClassRec* ac ) \
|
||||
{ \
|
||||
ac->writing_system = system; \
|
||||
\
|
||||
ac->style_metrics_size = m_size; \
|
||||
\
|
||||
ac->style_metrics_init = m_init; \
|
||||
ac->style_metrics_scale = m_scale; \
|
||||
ac->style_metrics_done = m_done; \
|
||||
ac->style_metrics_getstdw = m_stdw; \
|
||||
\
|
||||
ac->style_hints_init = h_init; \
|
||||
ac->style_hints_apply = h_apply; \
|
||||
}
|
||||
|
||||
|
||||
#define AF_DECLARE_SCRIPT_CLASS( script_class ) \
|
||||
FT_LOCAL( void ) \
|
||||
FT_Init_Class_ ## script_class( AF_ScriptClassRec* ac );
|
||||
|
||||
#define AF_DEFINE_SCRIPT_CLASS( \
|
||||
script_class, \
|
||||
script_, \
|
||||
ranges, \
|
||||
nonbase_ranges, \
|
||||
top_to_bottom, \
|
||||
std_charstring ) \
|
||||
FT_LOCAL_DEF( void ) \
|
||||
FT_Init_Class_ ## script_class( AF_ScriptClassRec* ac ) \
|
||||
{ \
|
||||
ac->script = script_; \
|
||||
ac->script_uni_ranges = ranges; \
|
||||
ac->script_uni_nonbase_ranges = nonbase_ranges; \
|
||||
ac->top_to_bottom_hinting = top_to_bottom; \
|
||||
ac->standard_charstring = std_charstring; \
|
||||
}
|
||||
|
||||
|
||||
#define AF_DECLARE_STYLE_CLASS( style_class ) \
|
||||
FT_LOCAL( void ) \
|
||||
FT_Init_Class_ ## style_class( AF_StyleClassRec* ac );
|
||||
|
||||
#define AF_DEFINE_STYLE_CLASS( \
|
||||
style_class, \
|
||||
style_, \
|
||||
writing_system_, \
|
||||
script_, \
|
||||
blue_stringset_, \
|
||||
coverage_ ) \
|
||||
FT_LOCAL_DEF( void ) \
|
||||
FT_Init_Class_ ## style_class( AF_StyleClassRec* ac ) \
|
||||
{ \
|
||||
ac->style = style_; \
|
||||
ac->writing_system = writing_system_; \
|
||||
ac->script = script_; \
|
||||
ac->blue_stringset = blue_stringset_; \
|
||||
ac->coverage = coverage_; \
|
||||
}
|
||||
|
||||
#endif /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
|
||||
/* */
|
||||
|
||||
FT_END_HEADER
|
||||
|
||||
#endif /* AFTYPES_H_ */
|
||||
|
||||
|
||||
/* END */
|
||||
373
vendor/FreeType2/src/autofit/afwarp.c
vendored
Normal file
373
vendor/FreeType2/src/autofit/afwarp.c
vendored
Normal file
|
|
@ -0,0 +1,373 @@
|
|||
/***************************************************************************/
|
||||
/* */
|
||||
/* afwarp.c */
|
||||
/* */
|
||||
/* Auto-fitter warping algorithm (body). */
|
||||
/* */
|
||||
/* Copyright 2006-2018 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. */
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
|
||||
/*
|
||||
* The idea of the warping code is to slightly scale and shift a glyph
|
||||
* within a single dimension so that as much of its segments are aligned
|
||||
* (more or less) on the grid. To find out the optimal scaling and
|
||||
* shifting value, various parameter combinations are tried and scored.
|
||||
*/
|
||||
|
||||
#include "afwarp.h"
|
||||
|
||||
#ifdef AF_CONFIG_OPTION_USE_WARPER
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* 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_afwarp
|
||||
|
||||
|
||||
/* The weights cover the range 0/64 - 63/64 of a pixel. Obviously, */
|
||||
/* values around a half pixel (which means exactly between two grid */
|
||||
/* lines) gets the worst weight. */
|
||||
#if 1
|
||||
static const AF_WarpScore
|
||||
af_warper_weights[64] =
|
||||
{
|
||||
35, 32, 30, 25, 20, 15, 12, 10, 5, 1, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, -1, -2, -5, -8,-10,-10,-20,-20,-30,-30,
|
||||
|
||||
-30,-30,-20,-20,-10,-10, -8, -5, -2, -1, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 1, 5, 10, 12, 15, 20, 25, 30, 32,
|
||||
};
|
||||
#else
|
||||
static const AF_WarpScore
|
||||
af_warper_weights[64] =
|
||||
{
|
||||
30, 20, 10, 5, 4, 4, 3, 2, 1, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, -1, -2, -2, -5, -5,-10,-10,-15,-20,
|
||||
|
||||
-20,-15,-15,-10,-10, -5, -5, -2, -2, -1, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 4, 5, 10, 20,
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
/* Score segments for a given `scale' and `delta' in the range */
|
||||
/* `xx1' to `xx2', and store the best result in `warper'. If */
|
||||
/* the new best score is equal to the old one, prefer the */
|
||||
/* value with a smaller distortion (around `base_distort'). */
|
||||
|
||||
static void
|
||||
af_warper_compute_line_best( AF_Warper warper,
|
||||
FT_Fixed scale,
|
||||
FT_Pos delta,
|
||||
FT_Pos xx1,
|
||||
FT_Pos xx2,
|
||||
AF_WarpScore base_distort,
|
||||
AF_Segment segments,
|
||||
FT_Int num_segments )
|
||||
{
|
||||
FT_Int idx_min, idx_max, idx0;
|
||||
FT_Int nn;
|
||||
AF_WarpScore scores[65];
|
||||
|
||||
|
||||
for ( nn = 0; nn < 65; nn++ )
|
||||
scores[nn] = 0;
|
||||
|
||||
idx0 = xx1 - warper->t1;
|
||||
|
||||
/* compute minimum and maximum indices */
|
||||
{
|
||||
FT_Pos xx1min = warper->x1min;
|
||||
FT_Pos xx1max = warper->x1max;
|
||||
FT_Pos w = xx2 - xx1;
|
||||
|
||||
|
||||
if ( xx1min + w < warper->x2min )
|
||||
xx1min = warper->x2min - w;
|
||||
|
||||
if ( xx1max + w > warper->x2max )
|
||||
xx1max = warper->x2max - w;
|
||||
|
||||
idx_min = xx1min - warper->t1;
|
||||
idx_max = xx1max - warper->t1;
|
||||
|
||||
if ( idx_min < 0 || idx_min > idx_max || idx_max > 64 )
|
||||
{
|
||||
FT_TRACE5(( "invalid indices:\n"
|
||||
" min=%d max=%d, xx1=%ld xx2=%ld,\n"
|
||||
" x1min=%ld x1max=%ld, x2min=%ld x2max=%ld\n",
|
||||
idx_min, idx_max, xx1, xx2,
|
||||
warper->x1min, warper->x1max,
|
||||
warper->x2min, warper->x2max ));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
for ( nn = 0; nn < num_segments; nn++ )
|
||||
{
|
||||
FT_Pos len = segments[nn].max_coord - segments[nn].min_coord;
|
||||
FT_Pos y0 = FT_MulFix( segments[nn].pos, scale ) + delta;
|
||||
FT_Pos y = y0 + ( idx_min - idx0 );
|
||||
FT_Int idx;
|
||||
|
||||
|
||||
/* score the length of the segments for the given range */
|
||||
for ( idx = idx_min; idx <= idx_max; idx++, y++ )
|
||||
scores[idx] += af_warper_weights[y & 63] * len;
|
||||
}
|
||||
|
||||
/* find best score */
|
||||
{
|
||||
FT_Int idx;
|
||||
|
||||
|
||||
for ( idx = idx_min; idx <= idx_max; idx++ )
|
||||
{
|
||||
AF_WarpScore score = scores[idx];
|
||||
AF_WarpScore distort = base_distort + ( idx - idx0 );
|
||||
|
||||
|
||||
if ( score > warper->best_score ||
|
||||
( score == warper->best_score &&
|
||||
distort < warper->best_distort ) )
|
||||
{
|
||||
warper->best_score = score;
|
||||
warper->best_distort = distort;
|
||||
warper->best_scale = scale;
|
||||
warper->best_delta = delta + ( idx - idx0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Compute optimal scaling and delta values for a given glyph and */
|
||||
/* dimension. */
|
||||
|
||||
FT_LOCAL_DEF( void )
|
||||
af_warper_compute( AF_Warper warper,
|
||||
AF_GlyphHints hints,
|
||||
AF_Dimension dim,
|
||||
FT_Fixed *a_scale,
|
||||
FT_Pos *a_delta )
|
||||
{
|
||||
AF_AxisHints axis;
|
||||
AF_Point points;
|
||||
|
||||
FT_Fixed org_scale;
|
||||
FT_Pos org_delta;
|
||||
|
||||
FT_Int nn, num_points, num_segments;
|
||||
FT_Int X1, X2;
|
||||
FT_Int w;
|
||||
|
||||
AF_WarpScore base_distort;
|
||||
AF_Segment segments;
|
||||
|
||||
|
||||
/* get original scaling transformation */
|
||||
if ( dim == AF_DIMENSION_VERT )
|
||||
{
|
||||
org_scale = hints->y_scale;
|
||||
org_delta = hints->y_delta;
|
||||
}
|
||||
else
|
||||
{
|
||||
org_scale = hints->x_scale;
|
||||
org_delta = hints->x_delta;
|
||||
}
|
||||
|
||||
warper->best_scale = org_scale;
|
||||
warper->best_delta = org_delta;
|
||||
warper->best_score = FT_INT_MIN;
|
||||
warper->best_distort = 0;
|
||||
|
||||
axis = &hints->axis[dim];
|
||||
segments = axis->segments;
|
||||
num_segments = axis->num_segments;
|
||||
points = hints->points;
|
||||
num_points = hints->num_points;
|
||||
|
||||
*a_scale = org_scale;
|
||||
*a_delta = org_delta;
|
||||
|
||||
/* get X1 and X2, minimum and maximum in original coordinates */
|
||||
if ( num_segments < 1 )
|
||||
return;
|
||||
|
||||
#if 1
|
||||
X1 = X2 = points[0].fx;
|
||||
for ( nn = 1; nn < num_points; nn++ )
|
||||
{
|
||||
FT_Int X = points[nn].fx;
|
||||
|
||||
|
||||
if ( X < X1 )
|
||||
X1 = X;
|
||||
if ( X > X2 )
|
||||
X2 = X;
|
||||
}
|
||||
#else
|
||||
X1 = X2 = segments[0].pos;
|
||||
for ( nn = 1; nn < num_segments; nn++ )
|
||||
{
|
||||
FT_Int X = segments[nn].pos;
|
||||
|
||||
|
||||
if ( X < X1 )
|
||||
X1 = X;
|
||||
if ( X > X2 )
|
||||
X2 = X;
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( X1 >= X2 )
|
||||
return;
|
||||
|
||||
warper->x1 = FT_MulFix( X1, org_scale ) + org_delta;
|
||||
warper->x2 = FT_MulFix( X2, org_scale ) + org_delta;
|
||||
|
||||
warper->t1 = AF_WARPER_FLOOR( warper->x1 );
|
||||
warper->t2 = AF_WARPER_CEIL( warper->x2 );
|
||||
|
||||
/* examine a half pixel wide range around the maximum coordinates */
|
||||
warper->x1min = warper->x1 & ~31;
|
||||
warper->x1max = warper->x1min + 32;
|
||||
warper->x2min = warper->x2 & ~31;
|
||||
warper->x2max = warper->x2min + 32;
|
||||
|
||||
if ( warper->x1max > warper->x2 )
|
||||
warper->x1max = warper->x2;
|
||||
|
||||
if ( warper->x2min < warper->x1 )
|
||||
warper->x2min = warper->x1;
|
||||
|
||||
warper->w0 = warper->x2 - warper->x1;
|
||||
|
||||
if ( warper->w0 <= 64 )
|
||||
{
|
||||
warper->x1max = warper->x1;
|
||||
warper->x2min = warper->x2;
|
||||
}
|
||||
|
||||
/* examine (at most) a pixel wide range around the natural width */
|
||||
warper->wmin = warper->x2min - warper->x1max;
|
||||
warper->wmax = warper->x2max - warper->x1min;
|
||||
|
||||
#if 1
|
||||
/* some heuristics to reduce the number of widths to be examined */
|
||||
{
|
||||
int margin = 16;
|
||||
|
||||
|
||||
if ( warper->w0 <= 128 )
|
||||
{
|
||||
margin = 8;
|
||||
if ( warper->w0 <= 96 )
|
||||
margin = 4;
|
||||
}
|
||||
|
||||
if ( warper->wmin < warper->w0 - margin )
|
||||
warper->wmin = warper->w0 - margin;
|
||||
|
||||
if ( warper->wmax > warper->w0 + margin )
|
||||
warper->wmax = warper->w0 + margin;
|
||||
}
|
||||
|
||||
if ( warper->wmin < warper->w0 * 3 / 4 )
|
||||
warper->wmin = warper->w0 * 3 / 4;
|
||||
|
||||
if ( warper->wmax > warper->w0 * 5 / 4 )
|
||||
warper->wmax = warper->w0 * 5 / 4;
|
||||
#else
|
||||
/* no scaling, just translation */
|
||||
warper->wmin = warper->wmax = warper->w0;
|
||||
#endif
|
||||
|
||||
for ( w = warper->wmin; w <= warper->wmax; w++ )
|
||||
{
|
||||
FT_Fixed new_scale;
|
||||
FT_Pos new_delta;
|
||||
FT_Pos xx1, xx2;
|
||||
|
||||
|
||||
/* compute min and max positions for given width, */
|
||||
/* assuring that they stay within the coordinate ranges */
|
||||
xx1 = warper->x1;
|
||||
xx2 = warper->x2;
|
||||
if ( w >= warper->w0 )
|
||||
{
|
||||
xx1 -= w - warper->w0;
|
||||
if ( xx1 < warper->x1min )
|
||||
{
|
||||
xx2 += warper->x1min - xx1;
|
||||
xx1 = warper->x1min;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
xx1 -= w - warper->w0;
|
||||
if ( xx1 > warper->x1max )
|
||||
{
|
||||
xx2 -= xx1 - warper->x1max;
|
||||
xx1 = warper->x1max;
|
||||
}
|
||||
}
|
||||
|
||||
if ( xx1 < warper->x1 )
|
||||
base_distort = warper->x1 - xx1;
|
||||
else
|
||||
base_distort = xx1 - warper->x1;
|
||||
|
||||
if ( xx2 < warper->x2 )
|
||||
base_distort += warper->x2 - xx2;
|
||||
else
|
||||
base_distort += xx2 - warper->x2;
|
||||
|
||||
/* give base distortion a greater weight while scoring */
|
||||
base_distort *= 10;
|
||||
|
||||
new_scale = org_scale + FT_DivFix( w - warper->w0, X2 - X1 );
|
||||
new_delta = xx1 - FT_MulFix( X1, new_scale );
|
||||
|
||||
af_warper_compute_line_best( warper, new_scale, new_delta, xx1, xx2,
|
||||
base_distort,
|
||||
segments, num_segments );
|
||||
}
|
||||
|
||||
{
|
||||
FT_Fixed best_scale = warper->best_scale;
|
||||
FT_Pos best_delta = warper->best_delta;
|
||||
|
||||
|
||||
hints->xmin_delta = FT_MulFix( X1, best_scale - org_scale )
|
||||
+ best_delta;
|
||||
hints->xmax_delta = FT_MulFix( X2, best_scale - org_scale )
|
||||
+ best_delta;
|
||||
|
||||
*a_scale = best_scale;
|
||||
*a_delta = best_delta;
|
||||
}
|
||||
}
|
||||
|
||||
#else /* !AF_CONFIG_OPTION_USE_WARPER */
|
||||
|
||||
/* ANSI C doesn't like empty source files */
|
||||
typedef int _af_warp_dummy;
|
||||
|
||||
#endif /* !AF_CONFIG_OPTION_USE_WARPER */
|
||||
|
||||
/* END */
|
||||
64
vendor/FreeType2/src/autofit/afwarp.h
vendored
Normal file
64
vendor/FreeType2/src/autofit/afwarp.h
vendored
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
/***************************************************************************/
|
||||
/* */
|
||||
/* afwarp.h */
|
||||
/* */
|
||||
/* Auto-fitter warping algorithm (specification). */
|
||||
/* */
|
||||
/* Copyright 2006-2018 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. */
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
|
||||
#ifndef AFWARP_H_
|
||||
#define AFWARP_H_
|
||||
|
||||
#include "afhints.h"
|
||||
|
||||
FT_BEGIN_HEADER
|
||||
|
||||
#define AF_WARPER_SCALE
|
||||
|
||||
#define AF_WARPER_FLOOR( x ) ( (x) & ~FT_TYPEOF( x )63 )
|
||||
#define AF_WARPER_CEIL( x ) AF_WARPER_FLOOR( (x) + 63 )
|
||||
|
||||
|
||||
typedef FT_Int32 AF_WarpScore;
|
||||
|
||||
typedef struct AF_WarperRec_
|
||||
{
|
||||
FT_Pos x1, x2;
|
||||
FT_Pos t1, t2;
|
||||
FT_Pos x1min, x1max;
|
||||
FT_Pos x2min, x2max;
|
||||
FT_Pos w0, wmin, wmax;
|
||||
|
||||
FT_Fixed best_scale;
|
||||
FT_Pos best_delta;
|
||||
AF_WarpScore best_score;
|
||||
AF_WarpScore best_distort;
|
||||
|
||||
} AF_WarperRec, *AF_Warper;
|
||||
|
||||
|
||||
FT_LOCAL( void )
|
||||
af_warper_compute( AF_Warper warper,
|
||||
AF_GlyphHints hints,
|
||||
AF_Dimension dim,
|
||||
FT_Fixed *a_scale,
|
||||
FT_Fixed *a_delta );
|
||||
|
||||
|
||||
FT_END_HEADER
|
||||
|
||||
|
||||
#endif /* AFWARP_H_ */
|
||||
|
||||
|
||||
/* END */
|
||||
52
vendor/FreeType2/src/autofit/afwrtsys.h
vendored
Normal file
52
vendor/FreeType2/src/autofit/afwrtsys.h
vendored
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
/***************************************************************************/
|
||||
/* */
|
||||
/* afwrtsys.h */
|
||||
/* */
|
||||
/* Auto-fitter writing systems (specification only). */
|
||||
/* */
|
||||
/* Copyright 2013-2018 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. */
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
|
||||
#ifndef AFWRTSYS_H_
|
||||
#define AFWRTSYS_H_
|
||||
|
||||
/* Since preprocessor directives can't create other preprocessor */
|
||||
/* directives, we have to include the header files manually. */
|
||||
|
||||
#include "afdummy.h"
|
||||
#include "aflatin.h"
|
||||
#include "afcjk.h"
|
||||
#include "afindic.h"
|
||||
#ifdef FT_OPTION_AUTOFIT2
|
||||
#include "aflatin2.h"
|
||||
#endif
|
||||
|
||||
#endif /* AFWRTSYS_H_ */
|
||||
|
||||
|
||||
/* The following part can be included multiple times. */
|
||||
/* Define `WRITING_SYSTEM' as needed. */
|
||||
|
||||
|
||||
/* Add new writing systems here. The arguments are the writing system */
|
||||
/* name in lowercase and uppercase, respectively. */
|
||||
|
||||
WRITING_SYSTEM( dummy, DUMMY )
|
||||
WRITING_SYSTEM( latin, LATIN )
|
||||
WRITING_SYSTEM( cjk, CJK )
|
||||
WRITING_SYSTEM( indic, INDIC )
|
||||
#ifdef FT_OPTION_AUTOFIT2
|
||||
WRITING_SYSTEM( latin2, LATIN2 )
|
||||
#endif
|
||||
|
||||
|
||||
/* END */
|
||||
39
vendor/FreeType2/src/autofit/autofit.c
vendored
Normal file
39
vendor/FreeType2/src/autofit/autofit.c
vendored
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
/***************************************************************************/
|
||||
/* */
|
||||
/* autofit.c */
|
||||
/* */
|
||||
/* Auto-fitter module (body). */
|
||||
/* */
|
||||
/* Copyright 2003-2018 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. */
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
|
||||
#define FT_MAKE_OPTION_SINGLE_OBJECT
|
||||
#include <ft2build.h>
|
||||
|
||||
#include "afangles.c"
|
||||
#include "afblue.c"
|
||||
#include "afcjk.c"
|
||||
#include "afdummy.c"
|
||||
#include "afglobal.c"
|
||||
#include "afhints.c"
|
||||
#include "afindic.c"
|
||||
#include "aflatin.c"
|
||||
#include "aflatin2.c"
|
||||
#include "afloader.c"
|
||||
#include "afmodule.c"
|
||||
#include "afpic.c"
|
||||
#include "afranges.c"
|
||||
#include "afshaper.c"
|
||||
#include "afwarp.c"
|
||||
|
||||
|
||||
/* END */
|
||||
108
vendor/FreeType2/src/base/basepic.c
vendored
Normal file
108
vendor/FreeType2/src/base/basepic.c
vendored
Normal file
|
|
@ -0,0 +1,108 @@
|
|||
/***************************************************************************/
|
||||
/* */
|
||||
/* basepic.c */
|
||||
/* */
|
||||
/* The FreeType position independent code services for base. */
|
||||
/* */
|
||||
/* Copyright 2009-2018 by */
|
||||
/* Oran Agra and Mickey Gabel. */
|
||||
/* */
|
||||
/* 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_FREETYPE_H
|
||||
#include FT_INTERNAL_OBJECTS_H
|
||||
#include "basepic.h"
|
||||
|
||||
|
||||
#ifdef FT_CONFIG_OPTION_PIC
|
||||
|
||||
/* forward declaration of PIC init functions from ftglyph.c */
|
||||
void
|
||||
FT_Init_Class_ft_outline_glyph_class( FT_Glyph_Class* clazz );
|
||||
|
||||
void
|
||||
FT_Init_Class_ft_bitmap_glyph_class( FT_Glyph_Class* clazz );
|
||||
|
||||
#ifdef FT_CONFIG_OPTION_MAC_FONTS
|
||||
/* forward declaration of PIC init function from ftrfork.c */
|
||||
/* (not modularized) */
|
||||
void
|
||||
FT_Init_Table_ft_raccess_guess_table( ft_raccess_guess_rec* record );
|
||||
#endif
|
||||
|
||||
/* forward declaration of PIC init functions from ftinit.c */
|
||||
FT_Error
|
||||
ft_create_default_module_classes( FT_Library library );
|
||||
|
||||
void
|
||||
ft_destroy_default_module_classes( FT_Library library );
|
||||
|
||||
|
||||
void
|
||||
ft_base_pic_free( FT_Library library )
|
||||
{
|
||||
FT_PIC_Container* pic_container = &library->pic_container;
|
||||
FT_Memory memory = library->memory;
|
||||
|
||||
|
||||
if ( pic_container->base )
|
||||
{
|
||||
/* destroy default module classes */
|
||||
/* (in case FT_Add_Default_Modules was used) */
|
||||
ft_destroy_default_module_classes( library );
|
||||
|
||||
FT_FREE( pic_container->base );
|
||||
pic_container->base = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FT_Error
|
||||
ft_base_pic_init( FT_Library library )
|
||||
{
|
||||
FT_PIC_Container* pic_container = &library->pic_container;
|
||||
FT_Error error = FT_Err_Ok;
|
||||
BasePIC* container = NULL;
|
||||
FT_Memory memory = library->memory;
|
||||
|
||||
|
||||
/* allocate pointer, clear and set global container pointer */
|
||||
if ( FT_ALLOC( container, sizeof ( *container ) ) )
|
||||
return error;
|
||||
FT_MEM_SET( container, 0, sizeof ( *container ) );
|
||||
pic_container->base = container;
|
||||
|
||||
/* initialize default modules list and pointers */
|
||||
error = ft_create_default_module_classes( library );
|
||||
if ( error )
|
||||
goto Exit;
|
||||
|
||||
/* initialize pointer table - */
|
||||
/* this is how the module usually expects this data */
|
||||
FT_Init_Class_ft_outline_glyph_class(
|
||||
&container->ft_outline_glyph_class );
|
||||
FT_Init_Class_ft_bitmap_glyph_class(
|
||||
&container->ft_bitmap_glyph_class );
|
||||
#ifdef FT_CONFIG_OPTION_MAC_FONTS
|
||||
FT_Init_Table_ft_raccess_guess_table(
|
||||
(ft_raccess_guess_rec*)&container->ft_raccess_guess_table );
|
||||
#endif
|
||||
|
||||
Exit:
|
||||
if ( error )
|
||||
ft_base_pic_free( library );
|
||||
return error;
|
||||
}
|
||||
|
||||
#endif /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
|
||||
/* END */
|
||||
91
vendor/FreeType2/src/base/basepic.h
vendored
Normal file
91
vendor/FreeType2/src/base/basepic.h
vendored
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
/***************************************************************************/
|
||||
/* */
|
||||
/* basepic.h */
|
||||
/* */
|
||||
/* The FreeType position independent code services for base. */
|
||||
/* */
|
||||
/* Copyright 2009-2018 by */
|
||||
/* Oran Agra and Mickey Gabel. */
|
||||
/* */
|
||||
/* 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 BASEPIC_H_
|
||||
#define BASEPIC_H_
|
||||
|
||||
|
||||
#include FT_INTERNAL_PIC_H
|
||||
|
||||
|
||||
#ifndef FT_CONFIG_OPTION_PIC
|
||||
|
||||
#define FT_OUTLINE_GLYPH_CLASS_GET &ft_outline_glyph_class
|
||||
#define FT_BITMAP_GLYPH_CLASS_GET &ft_bitmap_glyph_class
|
||||
#define FT_DEFAULT_MODULES_GET ft_default_modules
|
||||
|
||||
#ifdef FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK
|
||||
#define FT_RACCESS_GUESS_TABLE_GET ft_raccess_guess_table
|
||||
#endif
|
||||
|
||||
#else /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
#include FT_GLYPH_H
|
||||
|
||||
#ifdef FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK
|
||||
#include FT_INTERNAL_RFORK_H
|
||||
#endif
|
||||
|
||||
|
||||
FT_BEGIN_HEADER
|
||||
|
||||
typedef struct BasePIC_
|
||||
{
|
||||
FT_Module_Class** default_module_classes;
|
||||
FT_Glyph_Class ft_outline_glyph_class;
|
||||
FT_Glyph_Class ft_bitmap_glyph_class;
|
||||
|
||||
#ifdef FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK
|
||||
ft_raccess_guess_rec ft_raccess_guess_table[FT_RACCESS_N_RULES];
|
||||
#endif
|
||||
|
||||
} BasePIC;
|
||||
|
||||
|
||||
#define GET_PIC( lib ) ( (BasePIC*)( (lib)->pic_container.base ) )
|
||||
|
||||
#define FT_OUTLINE_GLYPH_CLASS_GET \
|
||||
( &GET_PIC( library )->ft_outline_glyph_class )
|
||||
#define FT_BITMAP_GLYPH_CLASS_GET \
|
||||
( &GET_PIC( library )->ft_bitmap_glyph_class )
|
||||
#define FT_DEFAULT_MODULES_GET \
|
||||
( GET_PIC( library )->default_module_classes )
|
||||
|
||||
#ifdef FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK
|
||||
#define FT_RACCESS_GUESS_TABLE_GET \
|
||||
( GET_PIC( library )->ft_raccess_guess_table )
|
||||
#endif
|
||||
|
||||
|
||||
/* see basepic.c for the implementation */
|
||||
void
|
||||
ft_base_pic_free( FT_Library library );
|
||||
|
||||
FT_Error
|
||||
ft_base_pic_init( FT_Library library );
|
||||
|
||||
FT_END_HEADER
|
||||
|
||||
#endif /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
/* */
|
||||
|
||||
#endif /* BASEPIC_H_ */
|
||||
|
||||
|
||||
/* END */
|
||||
175
vendor/FreeType2/src/base/ftadvanc.c
vendored
Normal file
175
vendor/FreeType2/src/base/ftadvanc.c
vendored
Normal file
|
|
@ -0,0 +1,175 @@
|
|||
/***************************************************************************/
|
||||
/* */
|
||||
/* ftadvanc.c */
|
||||
/* */
|
||||
/* Quick computation of advance widths (body). */
|
||||
/* */
|
||||
/* Copyright 2008-2018 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_INTERNAL_DEBUG_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 )
|
||||
return FT_THROW( 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 */
|
||||
/* - if a variations font, it must have an `HVAR' or `VVAR' */
|
||||
/* table (thus the old MM or GX fonts don't qualify; this */
|
||||
/* gets checked by the driver-specific functions) */
|
||||
|
||||
#define LOAD_ADVANCE_FAST_CHECK( face, 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_THROW( Invalid_Face_Handle );
|
||||
|
||||
if ( !padvance )
|
||||
return FT_THROW( Invalid_Argument );
|
||||
|
||||
if ( gindex >= (FT_UInt)face->num_glyphs )
|
||||
return FT_THROW( Invalid_Glyph_Index );
|
||||
|
||||
func = face->driver->clazz->get_advances;
|
||||
if ( func && LOAD_ADVANCE_FAST_CHECK( face, flags ) )
|
||||
{
|
||||
FT_Error error;
|
||||
|
||||
|
||||
error = func( face, gindex, 1, flags, padvance );
|
||||
if ( !error )
|
||||
return _ft_face_scale_advances( face, padvance, 1, flags );
|
||||
|
||||
if ( FT_ERR_NEQ( error, 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_Error error = FT_Err_Ok;
|
||||
|
||||
FT_Face_GetAdvancesFunc func;
|
||||
|
||||
FT_UInt num, end, nn;
|
||||
FT_Int factor;
|
||||
|
||||
|
||||
if ( !face )
|
||||
return FT_THROW( Invalid_Face_Handle );
|
||||
|
||||
if ( !padvances )
|
||||
return FT_THROW( Invalid_Argument );
|
||||
|
||||
num = (FT_UInt)face->num_glyphs;
|
||||
end = start + count;
|
||||
if ( start >= num || end < start || end > num )
|
||||
return FT_THROW( Invalid_Glyph_Index );
|
||||
|
||||
if ( count == 0 )
|
||||
return FT_Err_Ok;
|
||||
|
||||
func = face->driver->clazz->get_advances;
|
||||
if ( func && LOAD_ADVANCE_FAST_CHECK( face, flags ) )
|
||||
{
|
||||
error = func( face, start, count, flags, padvances );
|
||||
if ( !error )
|
||||
return _ft_face_scale_advances( face, padvances, count, flags );
|
||||
|
||||
if ( FT_ERR_NEQ( error, Unimplemented_Feature ) )
|
||||
return error;
|
||||
}
|
||||
|
||||
error = FT_Err_Ok;
|
||||
|
||||
if ( flags & FT_ADVANCE_FLAG_FAST_ONLY )
|
||||
return FT_THROW( Unimplemented_Feature );
|
||||
|
||||
flags |= (FT_UInt32)FT_LOAD_ADVANCE_ONLY;
|
||||
factor = ( flags & FT_LOAD_NO_SCALE ) ? 1 : 1024;
|
||||
for ( nn = 0; nn < count; nn++ )
|
||||
{
|
||||
error = FT_Load_Glyph( face, start + nn, flags );
|
||||
if ( error )
|
||||
break;
|
||||
|
||||
/* scale from 26.6 to 16.16, unless NO_SCALE was requested */
|
||||
padvances[nn] = ( flags & FT_LOAD_VERTICAL_LAYOUT )
|
||||
? face->glyph->advance.y * factor
|
||||
: face->glyph->advance.x * factor;
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
/* END */
|
||||
121
vendor/FreeType2/src/base/ftapi.c
vendored
Normal file
121
vendor/FreeType2/src/base/ftapi.c
vendored
Normal file
|
|
@ -0,0 +1,121 @@
|
|||
/***************************************************************************/
|
||||
/* */
|
||||
/* ftapi.c */
|
||||
/* */
|
||||
/* The FreeType compatibility functions (body). */
|
||||
/* */
|
||||
/* Copyright 2002-2018 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_LIST_H
|
||||
#include FT_OUTLINE_H
|
||||
#include FT_INTERNAL_OBJECTS_H
|
||||
#include FT_INTERNAL_DEBUG_H
|
||||
#include FT_INTERNAL_STREAM_H
|
||||
#include FT_TRUETYPE_TABLES_H
|
||||
#include FT_OUTLINE_H
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/**** ****/
|
||||
/**** ****/
|
||||
/**** C O M P A T I B I L I T Y ****/
|
||||
/**** ****/
|
||||
/**** ****/
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
|
||||
/* backward compatibility API */
|
||||
|
||||
FT_BASE_DEF( void )
|
||||
FT_New_Memory_Stream( FT_Library library,
|
||||
FT_Byte* base,
|
||||
FT_ULong size,
|
||||
FT_Stream stream )
|
||||
{
|
||||
FT_UNUSED( library );
|
||||
|
||||
FT_Stream_OpenMemory( stream, base, size );
|
||||
}
|
||||
|
||||
|
||||
FT_BASE_DEF( FT_Error )
|
||||
FT_Seek_Stream( FT_Stream stream,
|
||||
FT_ULong pos )
|
||||
{
|
||||
return FT_Stream_Seek( stream, pos );
|
||||
}
|
||||
|
||||
|
||||
FT_BASE_DEF( FT_Error )
|
||||
FT_Skip_Stream( FT_Stream stream,
|
||||
FT_Long distance )
|
||||
{
|
||||
return FT_Stream_Skip( stream, distance );
|
||||
}
|
||||
|
||||
|
||||
FT_BASE_DEF( FT_Error )
|
||||
FT_Read_Stream( FT_Stream stream,
|
||||
FT_Byte* buffer,
|
||||
FT_ULong count )
|
||||
{
|
||||
return FT_Stream_Read( stream, buffer, count );
|
||||
}
|
||||
|
||||
|
||||
FT_BASE_DEF( FT_Error )
|
||||
FT_Read_Stream_At( FT_Stream stream,
|
||||
FT_ULong pos,
|
||||
FT_Byte* buffer,
|
||||
FT_ULong count )
|
||||
{
|
||||
return FT_Stream_ReadAt( stream, pos, buffer, count );
|
||||
}
|
||||
|
||||
|
||||
FT_BASE_DEF( FT_Error )
|
||||
FT_Extract_Frame( FT_Stream stream,
|
||||
FT_ULong count,
|
||||
FT_Byte** pbytes )
|
||||
{
|
||||
return FT_Stream_ExtractFrame( stream, count, pbytes );
|
||||
}
|
||||
|
||||
|
||||
FT_BASE_DEF( void )
|
||||
FT_Release_Frame( FT_Stream stream,
|
||||
FT_Byte** pbytes )
|
||||
{
|
||||
FT_Stream_ReleaseFrame( stream, pbytes );
|
||||
}
|
||||
|
||||
FT_BASE_DEF( FT_Error )
|
||||
FT_Access_Frame( FT_Stream stream,
|
||||
FT_ULong count )
|
||||
{
|
||||
return FT_Stream_EnterFrame( stream, count );
|
||||
}
|
||||
|
||||
|
||||
FT_BASE_DEF( void )
|
||||
FT_Forget_Frame( FT_Stream stream )
|
||||
{
|
||||
FT_Stream_ExitFrame( stream );
|
||||
}
|
||||
|
||||
|
||||
/* END */
|
||||
42
vendor/FreeType2/src/base/ftbase.c
vendored
Normal file
42
vendor/FreeType2/src/base/ftbase.c
vendored
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
/***************************************************************************/
|
||||
/* */
|
||||
/* ftbase.c */
|
||||
/* */
|
||||
/* Single object library component (body only). */
|
||||
/* */
|
||||
/* Copyright 1996-2018 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>
|
||||
#define FT_MAKE_OPTION_SINGLE_OBJECT
|
||||
|
||||
#include "basepic.c"
|
||||
#include "ftadvanc.c"
|
||||
#include "ftcalc.c"
|
||||
#include "ftdbgmem.c"
|
||||
#include "ftfntfmt.c"
|
||||
#include "ftgloadr.c"
|
||||
#include "fthash.c"
|
||||
#include "ftlcdfil.c"
|
||||
#include "ftmac.c"
|
||||
#include "ftobjs.c"
|
||||
#include "ftoutln.c"
|
||||
#include "ftpic.c"
|
||||
#include "ftpsprop.c"
|
||||
#include "ftrfork.c"
|
||||
#include "ftsnames.c"
|
||||
#include "ftstream.c"
|
||||
#include "fttrigon.c"
|
||||
#include "ftutil.c"
|
||||
|
||||
|
||||
/* END */
|
||||
78
vendor/FreeType2/src/base/ftbase.h
vendored
Normal file
78
vendor/FreeType2/src/base/ftbase.h
vendored
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
/***************************************************************************/
|
||||
/* */
|
||||
/* ftbase.h */
|
||||
/* */
|
||||
/* Private functions used in the `base' module (specification). */
|
||||
/* */
|
||||
/* Copyright 2008-2018 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
|
||||
|
||||
|
||||
#ifdef FT_CONFIG_OPTION_MAC_FONTS
|
||||
|
||||
/* MacOS resource fork cannot exceed 16MB at least for Carbon code; */
|
||||
/* see https://support.microsoft.com/en-us/kb/130437 */
|
||||
#define FT_MAC_RFORK_MAX_LEN 0x00FFFFFFUL
|
||||
|
||||
|
||||
/* 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( 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( 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 );
|
||||
|
||||
|
||||
#if defined( FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK ) && \
|
||||
!defined( FT_MACINTOSH )
|
||||
/* Mac OS X/Darwin kernel often changes recommended method to access */
|
||||
/* the resource fork and older methods makes the kernel issue the */
|
||||
/* warning of deprecated method. To calm it down, the methods based */
|
||||
/* on Darwin VFS should be grouped and skip the rest methods after */
|
||||
/* the case the resource is opened but found to lack a font in it. */
|
||||
FT_LOCAL( FT_Bool )
|
||||
ft_raccess_rule_by_darwin_vfs( FT_Library library, FT_UInt rule_index );
|
||||
#endif
|
||||
|
||||
#endif /* FT_CONFIG_OPTION_MAC_FONTS */
|
||||
|
||||
|
||||
FT_END_HEADER
|
||||
|
||||
#endif /* FTBASE_H_ */
|
||||
|
||||
|
||||
/* END */
|
||||
515
vendor/FreeType2/src/base/ftbbox.c
vendored
Normal file
515
vendor/FreeType2/src/base/ftbbox.c
vendored
Normal file
|
|
@ -0,0 +1,515 @@
|
|||
/***************************************************************************/
|
||||
/* */
|
||||
/* ftbbox.c */
|
||||
/* */
|
||||
/* FreeType bbox computation (body). */
|
||||
/* */
|
||||
/* Copyright 1996-2018 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. */
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* This component has a _single_ role: to compute exact outline bounding */
|
||||
/* boxes. */
|
||||
/* */
|
||||
/*************************************************************************/
|
||||
|
||||
|
||||
#include <ft2build.h>
|
||||
#include FT_INTERNAL_DEBUG_H
|
||||
|
||||
#include FT_BBOX_H
|
||||
#include FT_IMAGE_H
|
||||
#include FT_OUTLINE_H
|
||||
#include FT_INTERNAL_CALC_H
|
||||
#include FT_INTERNAL_OBJECTS_H
|
||||
|
||||
|
||||
typedef struct TBBox_Rec_
|
||||
{
|
||||
FT_Vector last;
|
||||
FT_BBox bbox;
|
||||
|
||||
} TBBox_Rec;
|
||||
|
||||
|
||||
#define FT_UPDATE_BBOX( p, bbox ) \
|
||||
FT_BEGIN_STMNT \
|
||||
if ( p->x < bbox.xMin ) \
|
||||
bbox.xMin = p->x; \
|
||||
if ( p->x > bbox.xMax ) \
|
||||
bbox.xMax = p->x; \
|
||||
if ( p->y < bbox.yMin ) \
|
||||
bbox.yMin = p->y; \
|
||||
if ( p->y > bbox.yMax ) \
|
||||
bbox.yMax = p->y; \
|
||||
FT_END_STMNT
|
||||
|
||||
#define CHECK_X( p, bbox ) \
|
||||
( p->x < bbox.xMin || p->x > bbox.xMax )
|
||||
|
||||
#define CHECK_Y( p, bbox ) \
|
||||
( p->y < bbox.yMin || p->y > bbox.yMax )
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Function> */
|
||||
/* BBox_Move_To */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* This function is used as a `move_to' emitter during */
|
||||
/* FT_Outline_Decompose(). It simply records the destination point */
|
||||
/* in `user->last'. We also update bbox in case contour starts with */
|
||||
/* an implicit `on' point. */
|
||||
/* */
|
||||
/* <Input> */
|
||||
/* to :: A pointer to the destination vector. */
|
||||
/* */
|
||||
/* <InOut> */
|
||||
/* user :: A pointer to the current walk context. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* Always 0. Needed for the interface only. */
|
||||
/* */
|
||||
static int
|
||||
BBox_Move_To( FT_Vector* to,
|
||||
TBBox_Rec* user )
|
||||
{
|
||||
FT_UPDATE_BBOX( to, user->bbox );
|
||||
|
||||
user->last = *to;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Function> */
|
||||
/* BBox_Line_To */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* This function is used as a `line_to' emitter during */
|
||||
/* FT_Outline_Decompose(). It simply records the destination point */
|
||||
/* in `user->last'; no further computations are necessary because */
|
||||
/* bbox already contains both explicit ends of the line segment. */
|
||||
/* */
|
||||
/* <Input> */
|
||||
/* to :: A pointer to the destination vector. */
|
||||
/* */
|
||||
/* <InOut> */
|
||||
/* user :: A pointer to the current walk context. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* Always 0. Needed for the interface only. */
|
||||
/* */
|
||||
static int
|
||||
BBox_Line_To( FT_Vector* to,
|
||||
TBBox_Rec* user )
|
||||
{
|
||||
user->last = *to;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Function> */
|
||||
/* BBox_Conic_Check */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* Find the extrema of a 1-dimensional conic Bezier curve and update */
|
||||
/* a bounding range. This version uses direct computation, as it */
|
||||
/* doesn't need square roots. */
|
||||
/* */
|
||||
/* <Input> */
|
||||
/* y1 :: The start coordinate. */
|
||||
/* */
|
||||
/* y2 :: The coordinate of the control point. */
|
||||
/* */
|
||||
/* y3 :: The end coordinate. */
|
||||
/* */
|
||||
/* <InOut> */
|
||||
/* min :: The address of the current minimum. */
|
||||
/* */
|
||||
/* max :: The address of the current maximum. */
|
||||
/* */
|
||||
static void
|
||||
BBox_Conic_Check( FT_Pos y1,
|
||||
FT_Pos y2,
|
||||
FT_Pos y3,
|
||||
FT_Pos* min,
|
||||
FT_Pos* max )
|
||||
{
|
||||
/* This function is only called when a control off-point is outside */
|
||||
/* the bbox that contains all on-points. It finds a local extremum */
|
||||
/* within the segment, equal to (y1*y3 - y2*y2)/(y1 - 2*y2 + y3). */
|
||||
/* Or, offsetting from y2, we get */
|
||||
|
||||
y1 -= y2;
|
||||
y3 -= y2;
|
||||
y2 += FT_MulDiv( y1, y3, y1 + y3 );
|
||||
|
||||
if ( y2 < *min )
|
||||
*min = y2;
|
||||
if ( y2 > *max )
|
||||
*max = y2;
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Function> */
|
||||
/* BBox_Conic_To */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* This function is used as a `conic_to' emitter during */
|
||||
/* FT_Outline_Decompose(). It checks a conic Bezier curve with the */
|
||||
/* current bounding box, and computes its extrema if necessary to */
|
||||
/* update it. */
|
||||
/* */
|
||||
/* <Input> */
|
||||
/* control :: A pointer to a control point. */
|
||||
/* */
|
||||
/* to :: A pointer to the destination vector. */
|
||||
/* */
|
||||
/* <InOut> */
|
||||
/* user :: The address of the current walk context. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* Always 0. Needed for the interface only. */
|
||||
/* */
|
||||
/* <Note> */
|
||||
/* In the case of a non-monotonous arc, we compute directly the */
|
||||
/* extremum coordinates, as it is sufficiently fast. */
|
||||
/* */
|
||||
static int
|
||||
BBox_Conic_To( FT_Vector* control,
|
||||
FT_Vector* to,
|
||||
TBBox_Rec* user )
|
||||
{
|
||||
/* in case `to' is implicit and not included in bbox yet */
|
||||
FT_UPDATE_BBOX( to, user->bbox );
|
||||
|
||||
if ( CHECK_X( control, user->bbox ) )
|
||||
BBox_Conic_Check( user->last.x,
|
||||
control->x,
|
||||
to->x,
|
||||
&user->bbox.xMin,
|
||||
&user->bbox.xMax );
|
||||
|
||||
if ( CHECK_Y( control, user->bbox ) )
|
||||
BBox_Conic_Check( user->last.y,
|
||||
control->y,
|
||||
to->y,
|
||||
&user->bbox.yMin,
|
||||
&user->bbox.yMax );
|
||||
|
||||
user->last = *to;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Function> */
|
||||
/* BBox_Cubic_Check */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* Find the extrema of a 1-dimensional cubic Bezier curve and */
|
||||
/* update a bounding range. This version uses iterative splitting */
|
||||
/* because it is faster than the exact solution with square roots. */
|
||||
/* */
|
||||
/* <Input> */
|
||||
/* p1 :: The start coordinate. */
|
||||
/* */
|
||||
/* p2 :: The coordinate of the first control point. */
|
||||
/* */
|
||||
/* p3 :: The coordinate of the second control point. */
|
||||
/* */
|
||||
/* p4 :: The end coordinate. */
|
||||
/* */
|
||||
/* <InOut> */
|
||||
/* min :: The address of the current minimum. */
|
||||
/* */
|
||||
/* max :: The address of the current maximum. */
|
||||
/* */
|
||||
static FT_Pos
|
||||
cubic_peak( FT_Pos q1,
|
||||
FT_Pos q2,
|
||||
FT_Pos q3,
|
||||
FT_Pos q4 )
|
||||
{
|
||||
FT_Pos peak = 0;
|
||||
FT_Int shift;
|
||||
|
||||
|
||||
/* This function finds a peak of a cubic segment if it is above 0 */
|
||||
/* using iterative bisection of the segment, or returns 0. */
|
||||
/* The fixed-point arithmetic of bisection is inherently stable */
|
||||
/* but may loose accuracy in the two lowest bits. To compensate, */
|
||||
/* we upscale the segment if there is room. Large values may need */
|
||||
/* to be downscaled to avoid overflows during bisection. */
|
||||
/* It is called with either q2 or q3 positive, which is necessary */
|
||||
/* for the peak to exist and avoids undefined FT_MSB. */
|
||||
|
||||
shift = 27 - FT_MSB( (FT_UInt32)( FT_ABS( q1 ) |
|
||||
FT_ABS( q2 ) |
|
||||
FT_ABS( q3 ) |
|
||||
FT_ABS( q4 ) ) );
|
||||
|
||||
if ( shift > 0 )
|
||||
{
|
||||
/* upscaling too much just wastes time */
|
||||
if ( shift > 2 )
|
||||
shift = 2;
|
||||
|
||||
q1 <<= shift;
|
||||
q2 <<= shift;
|
||||
q3 <<= shift;
|
||||
q4 <<= shift;
|
||||
}
|
||||
else
|
||||
{
|
||||
q1 >>= -shift;
|
||||
q2 >>= -shift;
|
||||
q3 >>= -shift;
|
||||
q4 >>= -shift;
|
||||
}
|
||||
|
||||
/* for a peak to exist above 0, the cubic segment must have */
|
||||
/* at least one of its control off-points above 0. */
|
||||
while ( q2 > 0 || q3 > 0 )
|
||||
{
|
||||
/* determine which half contains the maximum and split */
|
||||
if ( q1 + q2 > q3 + q4 ) /* first half */
|
||||
{
|
||||
q4 = q4 + q3;
|
||||
q3 = q3 + q2;
|
||||
q2 = q2 + q1;
|
||||
q4 = q4 + q3;
|
||||
q3 = q3 + q2;
|
||||
q4 = ( q4 + q3 ) / 8;
|
||||
q3 = q3 / 4;
|
||||
q2 = q2 / 2;
|
||||
}
|
||||
else /* second half */
|
||||
{
|
||||
q1 = q1 + q2;
|
||||
q2 = q2 + q3;
|
||||
q3 = q3 + q4;
|
||||
q1 = q1 + q2;
|
||||
q2 = q2 + q3;
|
||||
q1 = ( q1 + q2 ) / 8;
|
||||
q2 = q2 / 4;
|
||||
q3 = q3 / 2;
|
||||
}
|
||||
|
||||
/* check whether either end reached the maximum */
|
||||
if ( q1 == q2 && q1 >= q3 )
|
||||
{
|
||||
peak = q1;
|
||||
break;
|
||||
}
|
||||
if ( q3 == q4 && q2 <= q4 )
|
||||
{
|
||||
peak = q4;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( shift > 0 )
|
||||
peak >>= shift;
|
||||
else
|
||||
peak <<= -shift;
|
||||
|
||||
return peak;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
BBox_Cubic_Check( FT_Pos p1,
|
||||
FT_Pos p2,
|
||||
FT_Pos p3,
|
||||
FT_Pos p4,
|
||||
FT_Pos* min,
|
||||
FT_Pos* max )
|
||||
{
|
||||
/* This function is only called when a control off-point is outside */
|
||||
/* the bbox that contains all on-points. So at least one of the */
|
||||
/* conditions below holds and cubic_peak is called with at least one */
|
||||
/* non-zero argument. */
|
||||
|
||||
if ( p2 > *max || p3 > *max )
|
||||
*max += cubic_peak( p1 - *max, p2 - *max, p3 - *max, p4 - *max );
|
||||
|
||||
/* now flip the signs to update the minimum */
|
||||
if ( p2 < *min || p3 < *min )
|
||||
*min -= cubic_peak( *min - p1, *min - p2, *min - p3, *min - p4 );
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Function> */
|
||||
/* BBox_Cubic_To */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* This function is used as a `cubic_to' emitter during */
|
||||
/* FT_Outline_Decompose(). It checks a cubic Bezier curve with the */
|
||||
/* current bounding box, and computes its extrema if necessary to */
|
||||
/* update it. */
|
||||
/* */
|
||||
/* <Input> */
|
||||
/* control1 :: A pointer to the first control point. */
|
||||
/* */
|
||||
/* control2 :: A pointer to the second control point. */
|
||||
/* */
|
||||
/* to :: A pointer to the destination vector. */
|
||||
/* */
|
||||
/* <InOut> */
|
||||
/* user :: The address of the current walk context. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* Always 0. Needed for the interface only. */
|
||||
/* */
|
||||
/* <Note> */
|
||||
/* In the case of a non-monotonous arc, we don't compute directly */
|
||||
/* extremum coordinates, we subdivide instead. */
|
||||
/* */
|
||||
static int
|
||||
BBox_Cubic_To( FT_Vector* control1,
|
||||
FT_Vector* control2,
|
||||
FT_Vector* to,
|
||||
TBBox_Rec* user )
|
||||
{
|
||||
/* We don't need to check `to' since it is always an on-point, */
|
||||
/* thus within the bbox. Only segments with an off-point outside */
|
||||
/* the bbox can possibly reach new extreme values. */
|
||||
|
||||
if ( CHECK_X( control1, user->bbox ) ||
|
||||
CHECK_X( control2, user->bbox ) )
|
||||
BBox_Cubic_Check( user->last.x,
|
||||
control1->x,
|
||||
control2->x,
|
||||
to->x,
|
||||
&user->bbox.xMin,
|
||||
&user->bbox.xMax );
|
||||
|
||||
if ( CHECK_Y( control1, user->bbox ) ||
|
||||
CHECK_Y( control2, user->bbox ) )
|
||||
BBox_Cubic_Check( user->last.y,
|
||||
control1->y,
|
||||
control2->y,
|
||||
to->y,
|
||||
&user->bbox.yMin,
|
||||
&user->bbox.yMax );
|
||||
|
||||
user->last = *to;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
FT_DEFINE_OUTLINE_FUNCS(
|
||||
bbox_interface,
|
||||
|
||||
(FT_Outline_MoveTo_Func) BBox_Move_To, /* move_to */
|
||||
(FT_Outline_LineTo_Func) BBox_Line_To, /* line_to */
|
||||
(FT_Outline_ConicTo_Func)BBox_Conic_To, /* conic_to */
|
||||
(FT_Outline_CubicTo_Func)BBox_Cubic_To, /* cubic_to */
|
||||
0, /* shift */
|
||||
0 /* delta */
|
||||
)
|
||||
|
||||
|
||||
/* documentation is in ftbbox.h */
|
||||
|
||||
FT_EXPORT_DEF( FT_Error )
|
||||
FT_Outline_Get_BBox( FT_Outline* outline,
|
||||
FT_BBox *abbox )
|
||||
{
|
||||
FT_BBox cbox = { 0x7FFFFFFFL, 0x7FFFFFFFL,
|
||||
-0x7FFFFFFFL, -0x7FFFFFFFL };
|
||||
FT_BBox bbox = { 0x7FFFFFFFL, 0x7FFFFFFFL,
|
||||
-0x7FFFFFFFL, -0x7FFFFFFFL };
|
||||
FT_Vector* vec;
|
||||
FT_UShort n;
|
||||
|
||||
|
||||
if ( !abbox )
|
||||
return FT_THROW( Invalid_Argument );
|
||||
|
||||
if ( !outline )
|
||||
return FT_THROW( Invalid_Outline );
|
||||
|
||||
/* if outline is empty, return (0,0,0,0) */
|
||||
if ( outline->n_points == 0 || outline->n_contours <= 0 )
|
||||
{
|
||||
abbox->xMin = abbox->xMax = 0;
|
||||
abbox->yMin = abbox->yMax = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* We compute the control box as well as the bounding box of */
|
||||
/* all `on' points in the outline. Then, if the two boxes */
|
||||
/* coincide, we exit immediately. */
|
||||
|
||||
vec = outline->points;
|
||||
|
||||
for ( n = 0; n < outline->n_points; n++ )
|
||||
{
|
||||
FT_UPDATE_BBOX( vec, cbox );
|
||||
|
||||
if ( FT_CURVE_TAG( outline->tags[n] ) == FT_CURVE_TAG_ON )
|
||||
FT_UPDATE_BBOX( vec, bbox );
|
||||
|
||||
vec++;
|
||||
}
|
||||
|
||||
/* test two boxes for equality */
|
||||
if ( cbox.xMin < bbox.xMin || cbox.xMax > bbox.xMax ||
|
||||
cbox.yMin < bbox.yMin || cbox.yMax > bbox.yMax )
|
||||
{
|
||||
/* the two boxes are different, now walk over the outline to */
|
||||
/* get the Bezier arc extrema. */
|
||||
|
||||
FT_Error error;
|
||||
TBBox_Rec user;
|
||||
|
||||
#ifdef FT_CONFIG_OPTION_PIC
|
||||
FT_Outline_Funcs bbox_interface;
|
||||
|
||||
|
||||
Init_Class_bbox_interface( &bbox_interface );
|
||||
#endif
|
||||
|
||||
user.bbox = bbox;
|
||||
|
||||
error = FT_Outline_Decompose( outline, &bbox_interface, &user );
|
||||
if ( error )
|
||||
return error;
|
||||
|
||||
*abbox = user.bbox;
|
||||
}
|
||||
else
|
||||
*abbox = bbox;
|
||||
|
||||
return FT_Err_Ok;
|
||||
}
|
||||
|
||||
|
||||
/* END */
|
||||
91
vendor/FreeType2/src/base/ftbdf.c
vendored
Normal file
91
vendor/FreeType2/src/base/ftbdf.c
vendored
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
/***************************************************************************/
|
||||
/* */
|
||||
/* ftbdf.c */
|
||||
/* */
|
||||
/* FreeType API for accessing BDF-specific strings (body). */
|
||||
/* */
|
||||
/* Copyright 2002-2018 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_INTERNAL_DEBUG_H
|
||||
|
||||
#include FT_INTERNAL_OBJECTS_H
|
||||
#include FT_SERVICE_BDF_H
|
||||
|
||||
|
||||
/* documentation is in ftbdf.h */
|
||||
|
||||
FT_EXPORT_DEF( FT_Error )
|
||||
FT_Get_BDF_Charset_ID( FT_Face face,
|
||||
const char* *acharset_encoding,
|
||||
const char* *acharset_registry )
|
||||
{
|
||||
FT_Error error;
|
||||
const char* encoding = NULL;
|
||||
const char* registry = NULL;
|
||||
|
||||
FT_Service_BDF service;
|
||||
|
||||
|
||||
if ( !face )
|
||||
return FT_THROW( Invalid_Face_Handle );
|
||||
|
||||
FT_FACE_FIND_SERVICE( face, service, BDF );
|
||||
|
||||
if ( service && service->get_charset_id )
|
||||
error = service->get_charset_id( face, &encoding, ®istry );
|
||||
else
|
||||
error = FT_THROW( Invalid_Argument );
|
||||
|
||||
if ( acharset_encoding )
|
||||
*acharset_encoding = encoding;
|
||||
|
||||
if ( acharset_registry )
|
||||
*acharset_registry = registry;
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
/* documentation is in ftbdf.h */
|
||||
|
||||
FT_EXPORT_DEF( FT_Error )
|
||||
FT_Get_BDF_Property( FT_Face face,
|
||||
const char* prop_name,
|
||||
BDF_PropertyRec *aproperty )
|
||||
{
|
||||
FT_Error error;
|
||||
|
||||
FT_Service_BDF service;
|
||||
|
||||
|
||||
if ( !face )
|
||||
return FT_THROW( Invalid_Face_Handle );
|
||||
|
||||
if ( !aproperty )
|
||||
return FT_THROW( Invalid_Argument );
|
||||
|
||||
aproperty->type = BDF_PROPERTY_TYPE_NONE;
|
||||
|
||||
FT_FACE_FIND_SERVICE( face, service, BDF );
|
||||
|
||||
if ( service && service->get_property )
|
||||
error = service->get_property( face, prop_name, aproperty );
|
||||
else
|
||||
error = FT_THROW( Invalid_Argument );
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
/* END */
|
||||
835
vendor/FreeType2/src/base/ftbitmap.c
vendored
Normal file
835
vendor/FreeType2/src/base/ftbitmap.c
vendored
Normal file
|
|
@ -0,0 +1,835 @@
|
|||
/***************************************************************************/
|
||||
/* */
|
||||
/* ftbitmap.c */
|
||||
/* */
|
||||
/* FreeType utility functions for bitmaps (body). */
|
||||
/* */
|
||||
/* Copyright 2004-2018 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_INTERNAL_DEBUG_H
|
||||
|
||||
#include FT_BITMAP_H
|
||||
#include FT_IMAGE_H
|
||||
#include FT_INTERNAL_OBJECTS_H
|
||||
|
||||
|
||||
static
|
||||
const FT_Bitmap null_bitmap = { 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
|
||||
|
||||
/* documentation is in ftbitmap.h */
|
||||
|
||||
FT_EXPORT_DEF( void )
|
||||
FT_Bitmap_Init( FT_Bitmap *abitmap )
|
||||
{
|
||||
if ( abitmap )
|
||||
*abitmap = null_bitmap;
|
||||
}
|
||||
|
||||
|
||||
/* deprecated function name; retained for ABI compatibility */
|
||||
|
||||
FT_EXPORT_DEF( void )
|
||||
FT_Bitmap_New( FT_Bitmap *abitmap )
|
||||
{
|
||||
if ( abitmap )
|
||||
*abitmap = null_bitmap;
|
||||
}
|
||||
|
||||
|
||||
/* documentation is in ftbitmap.h */
|
||||
|
||||
FT_EXPORT_DEF( FT_Error )
|
||||
FT_Bitmap_Copy( FT_Library library,
|
||||
const FT_Bitmap *source,
|
||||
FT_Bitmap *target)
|
||||
{
|
||||
FT_Memory memory;
|
||||
FT_Error error = FT_Err_Ok;
|
||||
|
||||
FT_Int pitch;
|
||||
FT_ULong size;
|
||||
|
||||
FT_Int source_pitch_sign, target_pitch_sign;
|
||||
|
||||
|
||||
if ( !library )
|
||||
return FT_THROW( Invalid_Library_Handle );
|
||||
|
||||
if ( !source || !target )
|
||||
return FT_THROW( Invalid_Argument );
|
||||
|
||||
if ( source == target )
|
||||
return FT_Err_Ok;
|
||||
|
||||
source_pitch_sign = source->pitch < 0 ? -1 : 1;
|
||||
target_pitch_sign = target->pitch < 0 ? -1 : 1;
|
||||
|
||||
if ( !source->buffer )
|
||||
{
|
||||
*target = *source;
|
||||
if ( source_pitch_sign != target_pitch_sign )
|
||||
target->pitch = -target->pitch;
|
||||
|
||||
return FT_Err_Ok;
|
||||
}
|
||||
|
||||
memory = library->memory;
|
||||
pitch = source->pitch;
|
||||
|
||||
if ( pitch < 0 )
|
||||
pitch = -pitch;
|
||||
size = (FT_ULong)pitch * source->rows;
|
||||
|
||||
if ( target->buffer )
|
||||
{
|
||||
FT_Int target_pitch = target->pitch;
|
||||
FT_ULong target_size;
|
||||
|
||||
|
||||
if ( target_pitch < 0 )
|
||||
target_pitch = -target_pitch;
|
||||
target_size = (FT_ULong)target_pitch * target->rows;
|
||||
|
||||
if ( target_size != size )
|
||||
(void)FT_QREALLOC( target->buffer, target_size, size );
|
||||
}
|
||||
else
|
||||
(void)FT_QALLOC( target->buffer, size );
|
||||
|
||||
if ( !error )
|
||||
{
|
||||
unsigned char *p;
|
||||
|
||||
|
||||
p = target->buffer;
|
||||
*target = *source;
|
||||
target->buffer = p;
|
||||
|
||||
if ( source_pitch_sign == target_pitch_sign )
|
||||
FT_MEM_COPY( target->buffer, source->buffer, size );
|
||||
else
|
||||
{
|
||||
/* take care of bitmap flow */
|
||||
FT_UInt i;
|
||||
FT_Byte* s = source->buffer;
|
||||
FT_Byte* t = target->buffer;
|
||||
|
||||
|
||||
t += (FT_ULong)pitch * ( target->rows - 1 );
|
||||
|
||||
for ( i = target->rows; i > 0; i-- )
|
||||
{
|
||||
FT_ARRAY_COPY( t, s, pitch );
|
||||
|
||||
s += pitch;
|
||||
t -= pitch;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
/* Enlarge `bitmap' horizontally and vertically by `xpixels' */
|
||||
/* and `ypixels', respectively. */
|
||||
|
||||
static FT_Error
|
||||
ft_bitmap_assure_buffer( FT_Memory memory,
|
||||
FT_Bitmap* bitmap,
|
||||
FT_UInt xpixels,
|
||||
FT_UInt ypixels )
|
||||
{
|
||||
FT_Error error;
|
||||
unsigned int pitch;
|
||||
unsigned int new_pitch;
|
||||
FT_UInt bpp;
|
||||
FT_UInt width, height;
|
||||
unsigned char* buffer = NULL;
|
||||
|
||||
|
||||
width = bitmap->width;
|
||||
height = bitmap->rows;
|
||||
pitch = (unsigned int)FT_ABS( bitmap->pitch );
|
||||
|
||||
switch ( bitmap->pixel_mode )
|
||||
{
|
||||
case FT_PIXEL_MODE_MONO:
|
||||
bpp = 1;
|
||||
new_pitch = ( width + xpixels + 7 ) >> 3;
|
||||
break;
|
||||
case FT_PIXEL_MODE_GRAY2:
|
||||
bpp = 2;
|
||||
new_pitch = ( width + xpixels + 3 ) >> 2;
|
||||
break;
|
||||
case FT_PIXEL_MODE_GRAY4:
|
||||
bpp = 4;
|
||||
new_pitch = ( width + xpixels + 1 ) >> 1;
|
||||
break;
|
||||
case FT_PIXEL_MODE_GRAY:
|
||||
case FT_PIXEL_MODE_LCD:
|
||||
case FT_PIXEL_MODE_LCD_V:
|
||||
bpp = 8;
|
||||
new_pitch = width + xpixels;
|
||||
break;
|
||||
default:
|
||||
return FT_THROW( Invalid_Glyph_Format );
|
||||
}
|
||||
|
||||
/* if no need to allocate memory */
|
||||
if ( ypixels == 0 && new_pitch <= pitch )
|
||||
{
|
||||
/* zero the padding */
|
||||
FT_UInt bit_width = pitch * 8;
|
||||
FT_UInt bit_last = ( width + xpixels ) * bpp;
|
||||
|
||||
|
||||
if ( bit_last < bit_width )
|
||||
{
|
||||
FT_Byte* line = bitmap->buffer + ( bit_last >> 3 );
|
||||
FT_Byte* end = bitmap->buffer + pitch;
|
||||
FT_UInt shift = bit_last & 7;
|
||||
FT_UInt mask = 0xFF00U >> shift;
|
||||
FT_UInt count = height;
|
||||
|
||||
|
||||
for ( ; count > 0; count--, line += pitch, end += pitch )
|
||||
{
|
||||
FT_Byte* write = line;
|
||||
|
||||
|
||||
if ( shift > 0 )
|
||||
{
|
||||
write[0] = (FT_Byte)( write[0] & mask );
|
||||
write++;
|
||||
}
|
||||
if ( write < end )
|
||||
FT_MEM_ZERO( write, end - write );
|
||||
}
|
||||
}
|
||||
|
||||
return FT_Err_Ok;
|
||||
}
|
||||
|
||||
/* otherwise allocate new buffer */
|
||||
if ( FT_QALLOC_MULT( buffer, bitmap->rows + ypixels, new_pitch ) )
|
||||
return error;
|
||||
|
||||
/* new rows get added at the top of the bitmap, */
|
||||
/* thus take care of the flow direction */
|
||||
if ( bitmap->pitch > 0 )
|
||||
{
|
||||
FT_UInt len = ( width * bpp + 7 ) >> 3;
|
||||
|
||||
unsigned char* in = bitmap->buffer;
|
||||
unsigned char* out = buffer;
|
||||
|
||||
unsigned char* limit = bitmap->buffer + pitch * bitmap->rows;
|
||||
unsigned int delta = new_pitch - len;
|
||||
|
||||
|
||||
FT_MEM_ZERO( out, new_pitch * ypixels );
|
||||
out += new_pitch * ypixels;
|
||||
|
||||
while ( in < limit )
|
||||
{
|
||||
FT_MEM_COPY( out, in, len );
|
||||
in += pitch;
|
||||
out += len;
|
||||
|
||||
/* we use FT_QALLOC_MULT, which doesn't zero out the buffer; */
|
||||
/* consequently, we have to manually zero out the remaining bytes */
|
||||
FT_MEM_ZERO( out, delta );
|
||||
out += delta;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FT_UInt len = ( width * bpp + 7 ) >> 3;
|
||||
|
||||
unsigned char* in = bitmap->buffer;
|
||||
unsigned char* out = buffer;
|
||||
|
||||
unsigned char* limit = bitmap->buffer + pitch * bitmap->rows;
|
||||
unsigned int delta = new_pitch - len;
|
||||
|
||||
|
||||
while ( in < limit )
|
||||
{
|
||||
FT_MEM_COPY( out, in, len );
|
||||
in += pitch;
|
||||
out += len;
|
||||
|
||||
FT_MEM_ZERO( out, delta );
|
||||
out += delta;
|
||||
}
|
||||
|
||||
FT_MEM_ZERO( out, new_pitch * ypixels );
|
||||
}
|
||||
|
||||
FT_FREE( bitmap->buffer );
|
||||
bitmap->buffer = buffer;
|
||||
|
||||
/* set pitch only, width and height are left untouched */
|
||||
if ( bitmap->pitch < 0 )
|
||||
bitmap->pitch = -(int)new_pitch;
|
||||
else
|
||||
bitmap->pitch = (int)new_pitch;
|
||||
|
||||
return FT_Err_Ok;
|
||||
}
|
||||
|
||||
|
||||
/* documentation is in ftbitmap.h */
|
||||
|
||||
FT_EXPORT_DEF( FT_Error )
|
||||
FT_Bitmap_Embolden( FT_Library library,
|
||||
FT_Bitmap* bitmap,
|
||||
FT_Pos xStrength,
|
||||
FT_Pos yStrength )
|
||||
{
|
||||
FT_Error error;
|
||||
unsigned char* p;
|
||||
FT_Int i, x, pitch;
|
||||
FT_UInt y;
|
||||
FT_Int xstr, ystr;
|
||||
|
||||
|
||||
if ( !library )
|
||||
return FT_THROW( Invalid_Library_Handle );
|
||||
|
||||
if ( !bitmap || !bitmap->buffer )
|
||||
return FT_THROW( Invalid_Argument );
|
||||
|
||||
if ( ( ( FT_PIX_ROUND( xStrength ) >> 6 ) > FT_INT_MAX ) ||
|
||||
( ( FT_PIX_ROUND( yStrength ) >> 6 ) > FT_INT_MAX ) )
|
||||
return FT_THROW( Invalid_Argument );
|
||||
|
||||
xstr = (FT_Int)FT_PIX_ROUND( xStrength ) >> 6;
|
||||
ystr = (FT_Int)FT_PIX_ROUND( yStrength ) >> 6;
|
||||
|
||||
if ( xstr == 0 && ystr == 0 )
|
||||
return FT_Err_Ok;
|
||||
else if ( xstr < 0 || ystr < 0 )
|
||||
return FT_THROW( Invalid_Argument );
|
||||
|
||||
switch ( bitmap->pixel_mode )
|
||||
{
|
||||
case FT_PIXEL_MODE_GRAY2:
|
||||
case FT_PIXEL_MODE_GRAY4:
|
||||
{
|
||||
FT_Bitmap tmp;
|
||||
|
||||
|
||||
/* convert to 8bpp */
|
||||
FT_Bitmap_Init( &tmp );
|
||||
error = FT_Bitmap_Convert( library, bitmap, &tmp, 1 );
|
||||
if ( error )
|
||||
return error;
|
||||
|
||||
FT_Bitmap_Done( library, bitmap );
|
||||
*bitmap = tmp;
|
||||
}
|
||||
break;
|
||||
|
||||
case FT_PIXEL_MODE_MONO:
|
||||
if ( xstr > 8 )
|
||||
xstr = 8;
|
||||
break;
|
||||
|
||||
case FT_PIXEL_MODE_LCD:
|
||||
xstr *= 3;
|
||||
break;
|
||||
|
||||
case FT_PIXEL_MODE_LCD_V:
|
||||
ystr *= 3;
|
||||
break;
|
||||
|
||||
case FT_PIXEL_MODE_BGRA:
|
||||
/* We don't embolden color glyphs. */
|
||||
return FT_Err_Ok;
|
||||
}
|
||||
|
||||
error = ft_bitmap_assure_buffer( library->memory, bitmap,
|
||||
(FT_UInt)xstr, (FT_UInt)ystr );
|
||||
if ( error )
|
||||
return error;
|
||||
|
||||
/* take care of bitmap flow */
|
||||
pitch = bitmap->pitch;
|
||||
if ( pitch > 0 )
|
||||
p = bitmap->buffer + pitch * ystr;
|
||||
else
|
||||
{
|
||||
pitch = -pitch;
|
||||
p = bitmap->buffer + (FT_UInt)pitch * ( bitmap->rows - 1 );
|
||||
}
|
||||
|
||||
/* for each row */
|
||||
for ( y = 0; y < bitmap->rows; y++ )
|
||||
{
|
||||
/*
|
||||
* Horizontally:
|
||||
*
|
||||
* From the last pixel on, make each pixel or'ed with the
|
||||
* `xstr' pixels before it.
|
||||
*/
|
||||
for ( x = pitch - 1; x >= 0; x-- )
|
||||
{
|
||||
unsigned char tmp;
|
||||
|
||||
|
||||
tmp = p[x];
|
||||
for ( i = 1; i <= xstr; i++ )
|
||||
{
|
||||
if ( bitmap->pixel_mode == FT_PIXEL_MODE_MONO )
|
||||
{
|
||||
p[x] |= tmp >> i;
|
||||
|
||||
/* the maximum value of 8 for `xstr' comes from here */
|
||||
if ( x > 0 )
|
||||
p[x] |= p[x - 1] << ( 8 - i );
|
||||
|
||||
#if 0
|
||||
if ( p[x] == 0xFF )
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( x - i >= 0 )
|
||||
{
|
||||
if ( p[x] + p[x - i] > bitmap->num_grays - 1 )
|
||||
{
|
||||
p[x] = (unsigned char)( bitmap->num_grays - 1 );
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
p[x] = (unsigned char)( p[x] + p[x - i] );
|
||||
if ( p[x] == bitmap->num_grays - 1 )
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Vertically:
|
||||
*
|
||||
* Make the above `ystr' rows or'ed with it.
|
||||
*/
|
||||
for ( x = 1; x <= ystr; x++ )
|
||||
{
|
||||
unsigned char* q;
|
||||
|
||||
|
||||
q = p - bitmap->pitch * x;
|
||||
for ( i = 0; i < pitch; i++ )
|
||||
q[i] |= p[i];
|
||||
}
|
||||
|
||||
p += bitmap->pitch;
|
||||
}
|
||||
|
||||
bitmap->width += (FT_UInt)xstr;
|
||||
bitmap->rows += (FT_UInt)ystr;
|
||||
|
||||
return FT_Err_Ok;
|
||||
}
|
||||
|
||||
|
||||
static FT_Byte
|
||||
ft_gray_for_premultiplied_srgb_bgra( const FT_Byte* bgra )
|
||||
{
|
||||
FT_UInt a = bgra[3];
|
||||
FT_UInt l;
|
||||
|
||||
|
||||
/* Short-circuit transparent color to avoid division by zero. */
|
||||
if ( !a )
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* Luminosity for sRGB is defined using ~0.2126,0.7152,0.0722
|
||||
* coefficients for RGB channels *on the linear colors*.
|
||||
* A gamma of 2.2 is fair to assume. And then, we need to
|
||||
* undo the premultiplication too.
|
||||
*
|
||||
* https://accessibility.kde.org/hsl-adjusted.php
|
||||
*
|
||||
* We do the computation with integers only, applying a gamma of 2.0.
|
||||
* We guarantee 32-bit arithmetic to avoid overflow but the resulting
|
||||
* luminosity fits into 16 bits.
|
||||
*
|
||||
*/
|
||||
|
||||
l = ( 4732UL /* 0.0722 * 65536 */ * bgra[0] * bgra[0] +
|
||||
46871UL /* 0.7152 * 65536 */ * bgra[1] * bgra[1] +
|
||||
13933UL /* 0.2126 * 65536 */ * bgra[2] * bgra[2] ) >> 16;
|
||||
|
||||
/*
|
||||
* Final transparency can be determined as follows.
|
||||
*
|
||||
* - If alpha is zero, we want 0.
|
||||
* - If alpha is zero and luminosity is zero, we want 255.
|
||||
* - If alpha is zero and luminosity is one, we want 0.
|
||||
*
|
||||
* So the formula is a * (1 - l) = a - l * a.
|
||||
*
|
||||
* We still need to undo premultiplication by dividing l by a*a.
|
||||
*
|
||||
*/
|
||||
|
||||
return (FT_Byte)( a - l / a );
|
||||
}
|
||||
|
||||
|
||||
/* documentation is in ftbitmap.h */
|
||||
|
||||
FT_EXPORT_DEF( FT_Error )
|
||||
FT_Bitmap_Convert( FT_Library library,
|
||||
const FT_Bitmap *source,
|
||||
FT_Bitmap *target,
|
||||
FT_Int alignment )
|
||||
{
|
||||
FT_Error error = FT_Err_Ok;
|
||||
FT_Memory memory;
|
||||
|
||||
FT_Byte* s;
|
||||
FT_Byte* t;
|
||||
|
||||
|
||||
if ( !library )
|
||||
return FT_THROW( Invalid_Library_Handle );
|
||||
|
||||
if ( !source || !target )
|
||||
return FT_THROW( Invalid_Argument );
|
||||
|
||||
memory = library->memory;
|
||||
|
||||
switch ( source->pixel_mode )
|
||||
{
|
||||
case FT_PIXEL_MODE_MONO:
|
||||
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:
|
||||
case FT_PIXEL_MODE_BGRA:
|
||||
{
|
||||
FT_Int pad, old_target_pitch, target_pitch;
|
||||
FT_ULong old_size;
|
||||
|
||||
|
||||
old_target_pitch = target->pitch;
|
||||
if ( old_target_pitch < 0 )
|
||||
old_target_pitch = -old_target_pitch;
|
||||
|
||||
old_size = target->rows * (FT_UInt)old_target_pitch;
|
||||
|
||||
target->pixel_mode = FT_PIXEL_MODE_GRAY;
|
||||
target->rows = source->rows;
|
||||
target->width = source->width;
|
||||
|
||||
pad = 0;
|
||||
if ( alignment > 0 )
|
||||
{
|
||||
pad = (FT_Int)source->width % alignment;
|
||||
if ( pad != 0 )
|
||||
pad = alignment - pad;
|
||||
}
|
||||
|
||||
target_pitch = (FT_Int)source->width + pad;
|
||||
|
||||
if ( target_pitch > 0 &&
|
||||
(FT_ULong)target->rows > FT_ULONG_MAX / (FT_ULong)target_pitch )
|
||||
return FT_THROW( Invalid_Argument );
|
||||
|
||||
if ( FT_QREALLOC( target->buffer,
|
||||
old_size, target->rows * (FT_UInt)target_pitch ) )
|
||||
return error;
|
||||
|
||||
target->pitch = target->pitch < 0 ? -target_pitch : target_pitch;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
error = FT_THROW( Invalid_Argument );
|
||||
}
|
||||
|
||||
s = source->buffer;
|
||||
t = target->buffer;
|
||||
|
||||
/* take care of bitmap flow */
|
||||
if ( source->pitch < 0 )
|
||||
s -= source->pitch * (FT_Int)( source->rows - 1 );
|
||||
if ( target->pitch < 0 )
|
||||
t -= target->pitch * (FT_Int)( target->rows - 1 );
|
||||
|
||||
switch ( source->pixel_mode )
|
||||
{
|
||||
case FT_PIXEL_MODE_MONO:
|
||||
{
|
||||
FT_UInt i;
|
||||
|
||||
|
||||
target->num_grays = 2;
|
||||
|
||||
for ( i = source->rows; i > 0; i-- )
|
||||
{
|
||||
FT_Byte* ss = s;
|
||||
FT_Byte* tt = t;
|
||||
FT_UInt j;
|
||||
|
||||
|
||||
/* get the full bytes */
|
||||
for ( j = source->width >> 3; j > 0; j-- )
|
||||
{
|
||||
FT_Int val = ss[0]; /* avoid a byte->int cast on each line */
|
||||
|
||||
|
||||
tt[0] = (FT_Byte)( ( val & 0x80 ) >> 7 );
|
||||
tt[1] = (FT_Byte)( ( val & 0x40 ) >> 6 );
|
||||
tt[2] = (FT_Byte)( ( val & 0x20 ) >> 5 );
|
||||
tt[3] = (FT_Byte)( ( val & 0x10 ) >> 4 );
|
||||
tt[4] = (FT_Byte)( ( val & 0x08 ) >> 3 );
|
||||
tt[5] = (FT_Byte)( ( val & 0x04 ) >> 2 );
|
||||
tt[6] = (FT_Byte)( ( val & 0x02 ) >> 1 );
|
||||
tt[7] = (FT_Byte)( val & 0x01 );
|
||||
|
||||
tt += 8;
|
||||
ss += 1;
|
||||
}
|
||||
|
||||
/* get remaining pixels (if any) */
|
||||
j = source->width & 7;
|
||||
if ( j > 0 )
|
||||
{
|
||||
FT_Int val = *ss;
|
||||
|
||||
|
||||
for ( ; j > 0; j-- )
|
||||
{
|
||||
tt[0] = (FT_Byte)( ( val & 0x80 ) >> 7);
|
||||
val <<= 1;
|
||||
tt += 1;
|
||||
}
|
||||
}
|
||||
|
||||
s += source->pitch;
|
||||
t += target->pitch;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case FT_PIXEL_MODE_GRAY:
|
||||
case FT_PIXEL_MODE_LCD:
|
||||
case FT_PIXEL_MODE_LCD_V:
|
||||
{
|
||||
FT_UInt width = source->width;
|
||||
FT_UInt i;
|
||||
|
||||
|
||||
target->num_grays = 256;
|
||||
|
||||
for ( i = source->rows; i > 0; i-- )
|
||||
{
|
||||
FT_ARRAY_COPY( t, s, width );
|
||||
|
||||
s += source->pitch;
|
||||
t += target->pitch;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case FT_PIXEL_MODE_GRAY2:
|
||||
{
|
||||
FT_UInt i;
|
||||
|
||||
|
||||
target->num_grays = 4;
|
||||
|
||||
for ( i = source->rows; i > 0; i-- )
|
||||
{
|
||||
FT_Byte* ss = s;
|
||||
FT_Byte* tt = t;
|
||||
FT_UInt j;
|
||||
|
||||
|
||||
/* get the full bytes */
|
||||
for ( j = source->width >> 2; j > 0; j-- )
|
||||
{
|
||||
FT_Int val = ss[0];
|
||||
|
||||
|
||||
tt[0] = (FT_Byte)( ( val & 0xC0 ) >> 6 );
|
||||
tt[1] = (FT_Byte)( ( val & 0x30 ) >> 4 );
|
||||
tt[2] = (FT_Byte)( ( val & 0x0C ) >> 2 );
|
||||
tt[3] = (FT_Byte)( ( val & 0x03 ) );
|
||||
|
||||
ss += 1;
|
||||
tt += 4;
|
||||
}
|
||||
|
||||
j = source->width & 3;
|
||||
if ( j > 0 )
|
||||
{
|
||||
FT_Int val = ss[0];
|
||||
|
||||
|
||||
for ( ; j > 0; j-- )
|
||||
{
|
||||
tt[0] = (FT_Byte)( ( val & 0xC0 ) >> 6 );
|
||||
val <<= 2;
|
||||
tt += 1;
|
||||
}
|
||||
}
|
||||
|
||||
s += source->pitch;
|
||||
t += target->pitch;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case FT_PIXEL_MODE_GRAY4:
|
||||
{
|
||||
FT_UInt i;
|
||||
|
||||
|
||||
target->num_grays = 16;
|
||||
|
||||
for ( i = source->rows; i > 0; i-- )
|
||||
{
|
||||
FT_Byte* ss = s;
|
||||
FT_Byte* tt = t;
|
||||
FT_UInt j;
|
||||
|
||||
|
||||
/* get the full bytes */
|
||||
for ( j = source->width >> 1; j > 0; j-- )
|
||||
{
|
||||
FT_Int val = ss[0];
|
||||
|
||||
|
||||
tt[0] = (FT_Byte)( ( val & 0xF0 ) >> 4 );
|
||||
tt[1] = (FT_Byte)( ( val & 0x0F ) );
|
||||
|
||||
ss += 1;
|
||||
tt += 2;
|
||||
}
|
||||
|
||||
if ( source->width & 1 )
|
||||
tt[0] = (FT_Byte)( ( ss[0] & 0xF0 ) >> 4 );
|
||||
|
||||
s += source->pitch;
|
||||
t += target->pitch;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case FT_PIXEL_MODE_BGRA:
|
||||
{
|
||||
FT_UInt i;
|
||||
|
||||
|
||||
target->num_grays = 256;
|
||||
|
||||
for ( i = source->rows; i > 0; i-- )
|
||||
{
|
||||
FT_Byte* ss = s;
|
||||
FT_Byte* tt = t;
|
||||
FT_UInt j;
|
||||
|
||||
|
||||
for ( j = source->width; j > 0; j-- )
|
||||
{
|
||||
tt[0] = ft_gray_for_premultiplied_srgb_bgra( ss );
|
||||
|
||||
ss += 4;
|
||||
tt += 1;
|
||||
}
|
||||
|
||||
s += source->pitch;
|
||||
t += target->pitch;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
;
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
/* 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_Init( &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 )
|
||||
{
|
||||
FT_Memory memory;
|
||||
|
||||
|
||||
if ( !library )
|
||||
return FT_THROW( Invalid_Library_Handle );
|
||||
|
||||
if ( !bitmap )
|
||||
return FT_THROW( Invalid_Argument );
|
||||
|
||||
memory = library->memory;
|
||||
|
||||
FT_FREE( bitmap->buffer );
|
||||
*bitmap = null_bitmap;
|
||||
|
||||
return FT_Err_Ok;
|
||||
}
|
||||
|
||||
|
||||
/* END */
|
||||
1017
vendor/FreeType2/src/base/ftcalc.c
vendored
Normal file
1017
vendor/FreeType2/src/base/ftcalc.c
vendored
Normal file
File diff suppressed because it is too large
Load diff
118
vendor/FreeType2/src/base/ftcid.c
vendored
Normal file
118
vendor/FreeType2/src/base/ftcid.c
vendored
Normal file
|
|
@ -0,0 +1,118 @@
|
|||
/***************************************************************************/
|
||||
/* */
|
||||
/* ftcid.c */
|
||||
/* */
|
||||
/* FreeType API for accessing CID font information. */
|
||||
/* */
|
||||
/* Copyright 2007-2018 by */
|
||||
/* Derek Clegg and 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 */
|
||||
/* 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_CID_H
|
||||
#include FT_INTERNAL_OBJECTS_H
|
||||
#include FT_SERVICE_CID_H
|
||||
|
||||
|
||||
/* documentation is in ftcid.h */
|
||||
|
||||
FT_EXPORT_DEF( FT_Error )
|
||||
FT_Get_CID_Registry_Ordering_Supplement( FT_Face face,
|
||||
const char* *registry,
|
||||
const char* *ordering,
|
||||
FT_Int *supplement)
|
||||
{
|
||||
FT_Error error;
|
||||
const char* r = NULL;
|
||||
const char* o = NULL;
|
||||
FT_Int s = 0;
|
||||
|
||||
|
||||
error = FT_ERR( Invalid_Argument );
|
||||
|
||||
if ( face )
|
||||
{
|
||||
FT_Service_CID service;
|
||||
|
||||
|
||||
FT_FACE_FIND_SERVICE( face, service, CID );
|
||||
|
||||
if ( service && service->get_ros )
|
||||
error = service->get_ros( face, &r, &o, &s );
|
||||
}
|
||||
|
||||
if ( registry )
|
||||
*registry = r;
|
||||
|
||||
if ( ordering )
|
||||
*ordering = o;
|
||||
|
||||
if ( supplement )
|
||||
*supplement = s;
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
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 */
|
||||
999
vendor/FreeType2/src/base/ftdbgmem.c
vendored
Normal file
999
vendor/FreeType2/src/base/ftdbgmem.c
vendored
Normal file
|
|
@ -0,0 +1,999 @@
|
|||
/***************************************************************************/
|
||||
/* */
|
||||
/* ftdbgmem.c */
|
||||
/* */
|
||||
/* Memory debugger (body). */
|
||||
/* */
|
||||
/* Copyright 2001-2018 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_CONFIG_CONFIG_H
|
||||
#include FT_INTERNAL_DEBUG_H
|
||||
#include FT_INTERNAL_MEMORY_H
|
||||
#include FT_SYSTEM_H
|
||||
#include FT_ERRORS_H
|
||||
#include FT_TYPES_H
|
||||
|
||||
|
||||
#ifdef FT_DEBUG_MEMORY
|
||||
|
||||
#define KEEPALIVE /* `Keep alive' means that freed blocks aren't released
|
||||
* to the heap. This is useful to detect double-frees
|
||||
* or weird heap corruption, but it uses large amounts of
|
||||
* memory, however.
|
||||
*/
|
||||
|
||||
#include FT_CONFIG_STANDARD_LIBRARY_H
|
||||
|
||||
FT_BASE_DEF( const char* ) _ft_debug_file = NULL;
|
||||
FT_BASE_DEF( long ) _ft_debug_lineno = 0;
|
||||
|
||||
extern void
|
||||
FT_DumpMemory( FT_Memory memory );
|
||||
|
||||
|
||||
typedef struct FT_MemSourceRec_* FT_MemSource;
|
||||
typedef struct FT_MemNodeRec_* FT_MemNode;
|
||||
typedef struct FT_MemTableRec_* FT_MemTable;
|
||||
|
||||
|
||||
#define FT_MEM_VAL( addr ) ( (FT_PtrDist)(FT_Pointer)( addr ) )
|
||||
|
||||
/*
|
||||
* This structure holds statistics for a single allocation/release
|
||||
* site. This is useful to know where memory operations happen the
|
||||
* most.
|
||||
*/
|
||||
typedef struct FT_MemSourceRec_
|
||||
{
|
||||
const char* file_name;
|
||||
long line_no;
|
||||
|
||||
FT_Long cur_blocks; /* current number of allocated blocks */
|
||||
FT_Long max_blocks; /* max. number of allocated blocks */
|
||||
FT_Long all_blocks; /* total number of blocks allocated */
|
||||
|
||||
FT_Long cur_size; /* current cumulative allocated size */
|
||||
FT_Long max_size; /* maximum cumulative allocated size */
|
||||
FT_Long all_size; /* total cumulative allocated size */
|
||||
|
||||
FT_Long cur_max; /* current maximum allocated size */
|
||||
|
||||
FT_UInt32 hash;
|
||||
FT_MemSource link;
|
||||
|
||||
} FT_MemSourceRec;
|
||||
|
||||
|
||||
/*
|
||||
* We don't need a resizable array for the memory sources because
|
||||
* their number is pretty limited within FreeType.
|
||||
*/
|
||||
#define FT_MEM_SOURCE_BUCKETS 128
|
||||
|
||||
/*
|
||||
* This structure holds information related to a single allocated
|
||||
* memory block. If KEEPALIVE is defined, blocks that are freed by
|
||||
* FreeType are never released to the system. Instead, their `size'
|
||||
* field is set to `-size'. This is mainly useful to detect double
|
||||
* frees, at the price of a large memory footprint during execution.
|
||||
*/
|
||||
typedef struct FT_MemNodeRec_
|
||||
{
|
||||
FT_Byte* address;
|
||||
FT_Long size; /* < 0 if the block was freed */
|
||||
|
||||
FT_MemSource source;
|
||||
|
||||
#ifdef KEEPALIVE
|
||||
const char* free_file_name;
|
||||
FT_Long free_line_no;
|
||||
#endif
|
||||
|
||||
FT_MemNode link;
|
||||
|
||||
} FT_MemNodeRec;
|
||||
|
||||
|
||||
/*
|
||||
* The global structure, containing compound statistics and all hash
|
||||
* tables.
|
||||
*/
|
||||
typedef struct FT_MemTableRec_
|
||||
{
|
||||
FT_Long size;
|
||||
FT_Long nodes;
|
||||
FT_MemNode* buckets;
|
||||
|
||||
FT_Long alloc_total;
|
||||
FT_Long alloc_current;
|
||||
FT_Long alloc_max;
|
||||
FT_Long alloc_count;
|
||||
|
||||
FT_Bool bound_total;
|
||||
FT_Long alloc_total_max;
|
||||
|
||||
FT_Bool bound_count;
|
||||
FT_Long alloc_count_max;
|
||||
|
||||
FT_MemSource sources[FT_MEM_SOURCE_BUCKETS];
|
||||
|
||||
FT_Bool keep_alive;
|
||||
|
||||
FT_Memory memory;
|
||||
FT_Pointer memory_user;
|
||||
FT_Alloc_Func alloc;
|
||||
FT_Free_Func free;
|
||||
FT_Realloc_Func realloc;
|
||||
|
||||
} FT_MemTableRec;
|
||||
|
||||
|
||||
#define FT_MEM_SIZE_MIN 7
|
||||
#define FT_MEM_SIZE_MAX 13845163
|
||||
|
||||
#define FT_FILENAME( x ) ( (x) ? (x) : "unknown file" )
|
||||
|
||||
|
||||
/*
|
||||
* Prime numbers are ugly to handle. It would be better to implement
|
||||
* L-Hashing, which is 10% faster and doesn't require divisions.
|
||||
*/
|
||||
static const FT_Int ft_mem_primes[] =
|
||||
{
|
||||
7,
|
||||
11,
|
||||
19,
|
||||
37,
|
||||
73,
|
||||
109,
|
||||
163,
|
||||
251,
|
||||
367,
|
||||
557,
|
||||
823,
|
||||
1237,
|
||||
1861,
|
||||
2777,
|
||||
4177,
|
||||
6247,
|
||||
9371,
|
||||
14057,
|
||||
21089,
|
||||
31627,
|
||||
47431,
|
||||
71143,
|
||||
106721,
|
||||
160073,
|
||||
240101,
|
||||
360163,
|
||||
540217,
|
||||
810343,
|
||||
1215497,
|
||||
1823231,
|
||||
2734867,
|
||||
4102283,
|
||||
6153409,
|
||||
9230113,
|
||||
13845163,
|
||||
};
|
||||
|
||||
|
||||
static FT_Long
|
||||
ft_mem_closest_prime( FT_Long num )
|
||||
{
|
||||
size_t i;
|
||||
|
||||
|
||||
for ( i = 0;
|
||||
i < sizeof ( ft_mem_primes ) / sizeof ( ft_mem_primes[0] ); i++ )
|
||||
if ( ft_mem_primes[i] > num )
|
||||
return ft_mem_primes[i];
|
||||
|
||||
return FT_MEM_SIZE_MAX;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
ft_mem_debug_panic( const char* fmt,
|
||||
... )
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
|
||||
printf( "FreeType.Debug: " );
|
||||
|
||||
va_start( ap, fmt );
|
||||
vprintf( fmt, ap );
|
||||
va_end( ap );
|
||||
|
||||
printf( "\n" );
|
||||
exit( EXIT_FAILURE );
|
||||
}
|
||||
|
||||
|
||||
static FT_Pointer
|
||||
ft_mem_table_alloc( FT_MemTable table,
|
||||
FT_Long size )
|
||||
{
|
||||
FT_Memory memory = table->memory;
|
||||
FT_Pointer block;
|
||||
|
||||
|
||||
memory->user = table->memory_user;
|
||||
block = table->alloc( memory, size );
|
||||
memory->user = table;
|
||||
|
||||
return block;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
ft_mem_table_free( FT_MemTable table,
|
||||
FT_Pointer block )
|
||||
{
|
||||
FT_Memory memory = table->memory;
|
||||
|
||||
|
||||
memory->user = table->memory_user;
|
||||
table->free( memory, block );
|
||||
memory->user = table;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
ft_mem_table_resize( FT_MemTable table )
|
||||
{
|
||||
FT_Long new_size;
|
||||
|
||||
|
||||
new_size = ft_mem_closest_prime( table->nodes );
|
||||
if ( new_size != table->size )
|
||||
{
|
||||
FT_MemNode* new_buckets;
|
||||
FT_Long i;
|
||||
|
||||
|
||||
new_buckets = (FT_MemNode *)
|
||||
ft_mem_table_alloc(
|
||||
table,
|
||||
new_size * (FT_Long)sizeof ( FT_MemNode ) );
|
||||
if ( !new_buckets )
|
||||
return;
|
||||
|
||||
FT_ARRAY_ZERO( new_buckets, new_size );
|
||||
|
||||
for ( i = 0; i < table->size; i++ )
|
||||
{
|
||||
FT_MemNode node, next, *pnode;
|
||||
FT_PtrDist hash;
|
||||
|
||||
|
||||
node = table->buckets[i];
|
||||
while ( node )
|
||||
{
|
||||
next = node->link;
|
||||
hash = FT_MEM_VAL( node->address ) % (FT_PtrDist)new_size;
|
||||
pnode = new_buckets + hash;
|
||||
|
||||
node->link = pnode[0];
|
||||
pnode[0] = node;
|
||||
|
||||
node = next;
|
||||
}
|
||||
}
|
||||
|
||||
if ( table->buckets )
|
||||
ft_mem_table_free( table, table->buckets );
|
||||
|
||||
table->buckets = new_buckets;
|
||||
table->size = new_size;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static FT_MemTable
|
||||
ft_mem_table_new( FT_Memory memory )
|
||||
{
|
||||
FT_MemTable table;
|
||||
|
||||
|
||||
table = (FT_MemTable)memory->alloc( memory, sizeof ( *table ) );
|
||||
if ( !table )
|
||||
goto Exit;
|
||||
|
||||
FT_ZERO( table );
|
||||
|
||||
table->size = FT_MEM_SIZE_MIN;
|
||||
table->nodes = 0;
|
||||
|
||||
table->memory = memory;
|
||||
|
||||
table->memory_user = memory->user;
|
||||
|
||||
table->alloc = memory->alloc;
|
||||
table->realloc = memory->realloc;
|
||||
table->free = memory->free;
|
||||
|
||||
table->buckets = (FT_MemNode *)
|
||||
memory->alloc(
|
||||
memory,
|
||||
table->size * (FT_Long)sizeof ( FT_MemNode ) );
|
||||
if ( table->buckets )
|
||||
FT_ARRAY_ZERO( table->buckets, table->size );
|
||||
else
|
||||
{
|
||||
memory->free( memory, table );
|
||||
table = NULL;
|
||||
}
|
||||
|
||||
Exit:
|
||||
return table;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
ft_mem_table_destroy( FT_MemTable table )
|
||||
{
|
||||
FT_Long i;
|
||||
FT_Long leak_count = 0;
|
||||
FT_Long leaks = 0;
|
||||
|
||||
|
||||
FT_DumpMemory( table->memory );
|
||||
|
||||
/* remove all blocks from the table, revealing leaked ones */
|
||||
for ( i = 0; i < table->size; i++ )
|
||||
{
|
||||
FT_MemNode *pnode = table->buckets + i, next, node = *pnode;
|
||||
|
||||
|
||||
while ( node )
|
||||
{
|
||||
next = node->link;
|
||||
node->link = NULL;
|
||||
|
||||
if ( node->size > 0 )
|
||||
{
|
||||
printf(
|
||||
"leaked memory block at address %p, size %8ld in (%s:%ld)\n",
|
||||
(void*)node->address,
|
||||
node->size,
|
||||
FT_FILENAME( node->source->file_name ),
|
||||
node->source->line_no );
|
||||
|
||||
leak_count++;
|
||||
leaks += node->size;
|
||||
|
||||
ft_mem_table_free( table, node->address );
|
||||
}
|
||||
|
||||
node->address = NULL;
|
||||
node->size = 0;
|
||||
|
||||
ft_mem_table_free( table, node );
|
||||
node = next;
|
||||
}
|
||||
table->buckets[i] = NULL;
|
||||
}
|
||||
|
||||
ft_mem_table_free( table, table->buckets );
|
||||
table->buckets = NULL;
|
||||
|
||||
table->size = 0;
|
||||
table->nodes = 0;
|
||||
|
||||
/* remove all sources */
|
||||
for ( i = 0; i < FT_MEM_SOURCE_BUCKETS; i++ )
|
||||
{
|
||||
FT_MemSource source, next;
|
||||
|
||||
|
||||
for ( source = table->sources[i]; source != NULL; source = next )
|
||||
{
|
||||
next = source->link;
|
||||
ft_mem_table_free( table, source );
|
||||
}
|
||||
|
||||
table->sources[i] = NULL;
|
||||
}
|
||||
|
||||
printf( "FreeType: total memory allocations = %ld\n",
|
||||
table->alloc_total );
|
||||
printf( "FreeType: maximum memory footprint = %ld\n",
|
||||
table->alloc_max );
|
||||
|
||||
ft_mem_table_free( table, table );
|
||||
|
||||
if ( leak_count > 0 )
|
||||
ft_mem_debug_panic(
|
||||
"FreeType: %ld bytes of memory leaked in %ld blocks\n",
|
||||
leaks, leak_count );
|
||||
|
||||
printf( "FreeType: no memory leaks detected\n" );
|
||||
}
|
||||
|
||||
|
||||
static FT_MemNode*
|
||||
ft_mem_table_get_nodep( FT_MemTable table,
|
||||
FT_Byte* address )
|
||||
{
|
||||
FT_PtrDist hash;
|
||||
FT_MemNode *pnode, node;
|
||||
|
||||
|
||||
hash = FT_MEM_VAL( address );
|
||||
pnode = table->buckets + ( hash % (FT_PtrDist)table->size );
|
||||
|
||||
for (;;)
|
||||
{
|
||||
node = pnode[0];
|
||||
if ( !node )
|
||||
break;
|
||||
|
||||
if ( node->address == address )
|
||||
break;
|
||||
|
||||
pnode = &node->link;
|
||||
}
|
||||
return pnode;
|
||||
}
|
||||
|
||||
|
||||
static FT_MemSource
|
||||
ft_mem_table_get_source( FT_MemTable table )
|
||||
{
|
||||
FT_UInt32 hash;
|
||||
FT_MemSource node, *pnode;
|
||||
|
||||
|
||||
/* cast to FT_PtrDist first since void* can be larger */
|
||||
/* than FT_UInt32 and GCC 4.1.1 emits a warning */
|
||||
hash = (FT_UInt32)(FT_PtrDist)(void*)_ft_debug_file +
|
||||
(FT_UInt32)( 5 * _ft_debug_lineno );
|
||||
pnode = &table->sources[hash % FT_MEM_SOURCE_BUCKETS];
|
||||
|
||||
for (;;)
|
||||
{
|
||||
node = *pnode;
|
||||
if ( !node )
|
||||
break;
|
||||
|
||||
if ( node->file_name == _ft_debug_file &&
|
||||
node->line_no == _ft_debug_lineno )
|
||||
goto Exit;
|
||||
|
||||
pnode = &node->link;
|
||||
}
|
||||
|
||||
node = (FT_MemSource)ft_mem_table_alloc( table, sizeof ( *node ) );
|
||||
if ( !node )
|
||||
ft_mem_debug_panic(
|
||||
"not enough memory to perform memory debugging\n" );
|
||||
|
||||
node->file_name = _ft_debug_file;
|
||||
node->line_no = _ft_debug_lineno;
|
||||
|
||||
node->cur_blocks = 0;
|
||||
node->max_blocks = 0;
|
||||
node->all_blocks = 0;
|
||||
|
||||
node->cur_size = 0;
|
||||
node->max_size = 0;
|
||||
node->all_size = 0;
|
||||
|
||||
node->cur_max = 0;
|
||||
|
||||
node->link = NULL;
|
||||
node->hash = hash;
|
||||
*pnode = node;
|
||||
|
||||
Exit:
|
||||
return node;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
ft_mem_table_set( FT_MemTable table,
|
||||
FT_Byte* address,
|
||||
FT_Long size,
|
||||
FT_Long delta )
|
||||
{
|
||||
FT_MemNode *pnode, node;
|
||||
|
||||
|
||||
if ( table )
|
||||
{
|
||||
FT_MemSource source;
|
||||
|
||||
|
||||
pnode = ft_mem_table_get_nodep( table, address );
|
||||
node = *pnode;
|
||||
if ( node )
|
||||
{
|
||||
if ( node->size < 0 )
|
||||
{
|
||||
/* This block was already freed. Our memory is now completely */
|
||||
/* corrupted! */
|
||||
/* This can only happen in keep-alive mode. */
|
||||
ft_mem_debug_panic(
|
||||
"memory heap corrupted (allocating freed block)" );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* This block was already allocated. This means that our memory */
|
||||
/* is also corrupted! */
|
||||
ft_mem_debug_panic(
|
||||
"memory heap corrupted (re-allocating allocated block at"
|
||||
" %p, of size %ld)\n"
|
||||
"org=%s:%d new=%s:%d\n",
|
||||
node->address, node->size,
|
||||
FT_FILENAME( node->source->file_name ), node->source->line_no,
|
||||
FT_FILENAME( _ft_debug_file ), _ft_debug_lineno );
|
||||
}
|
||||
}
|
||||
|
||||
/* we need to create a new node in this table */
|
||||
node = (FT_MemNode)ft_mem_table_alloc( table, sizeof ( *node ) );
|
||||
if ( !node )
|
||||
ft_mem_debug_panic( "not enough memory to run memory tests" );
|
||||
|
||||
node->address = address;
|
||||
node->size = size;
|
||||
node->source = source = ft_mem_table_get_source( table );
|
||||
|
||||
if ( delta == 0 )
|
||||
{
|
||||
/* this is an allocation */
|
||||
source->all_blocks++;
|
||||
source->cur_blocks++;
|
||||
if ( source->cur_blocks > source->max_blocks )
|
||||
source->max_blocks = source->cur_blocks;
|
||||
}
|
||||
|
||||
if ( size > source->cur_max )
|
||||
source->cur_max = size;
|
||||
|
||||
if ( delta != 0 )
|
||||
{
|
||||
/* we are growing or shrinking a reallocated block */
|
||||
source->cur_size += delta;
|
||||
table->alloc_current += delta;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* we are allocating a new block */
|
||||
source->cur_size += size;
|
||||
table->alloc_current += size;
|
||||
}
|
||||
|
||||
source->all_size += size;
|
||||
|
||||
if ( source->cur_size > source->max_size )
|
||||
source->max_size = source->cur_size;
|
||||
|
||||
node->free_file_name = NULL;
|
||||
node->free_line_no = 0;
|
||||
|
||||
node->link = pnode[0];
|
||||
|
||||
pnode[0] = node;
|
||||
table->nodes++;
|
||||
|
||||
table->alloc_total += size;
|
||||
|
||||
if ( table->alloc_current > table->alloc_max )
|
||||
table->alloc_max = table->alloc_current;
|
||||
|
||||
if ( table->nodes * 3 < table->size ||
|
||||
table->size * 3 < table->nodes )
|
||||
ft_mem_table_resize( table );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
ft_mem_table_remove( FT_MemTable table,
|
||||
FT_Byte* address,
|
||||
FT_Long delta )
|
||||
{
|
||||
if ( table )
|
||||
{
|
||||
FT_MemNode *pnode, node;
|
||||
|
||||
|
||||
pnode = ft_mem_table_get_nodep( table, address );
|
||||
node = *pnode;
|
||||
if ( node )
|
||||
{
|
||||
FT_MemSource source;
|
||||
|
||||
|
||||
if ( node->size < 0 )
|
||||
ft_mem_debug_panic(
|
||||
"freeing memory block at %p more than once at (%s:%ld)\n"
|
||||
"block allocated at (%s:%ld) and released at (%s:%ld)",
|
||||
address,
|
||||
FT_FILENAME( _ft_debug_file ), _ft_debug_lineno,
|
||||
FT_FILENAME( node->source->file_name ), node->source->line_no,
|
||||
FT_FILENAME( node->free_file_name ), node->free_line_no );
|
||||
|
||||
/* scramble the node's content for additional safety */
|
||||
FT_MEM_SET( address, 0xF3, node->size );
|
||||
|
||||
if ( delta == 0 )
|
||||
{
|
||||
source = node->source;
|
||||
|
||||
source->cur_blocks--;
|
||||
source->cur_size -= node->size;
|
||||
|
||||
table->alloc_current -= node->size;
|
||||
}
|
||||
|
||||
if ( table->keep_alive )
|
||||
{
|
||||
/* we simply invert the node's size to indicate that the node */
|
||||
/* was freed. */
|
||||
node->size = -node->size;
|
||||
node->free_file_name = _ft_debug_file;
|
||||
node->free_line_no = _ft_debug_lineno;
|
||||
}
|
||||
else
|
||||
{
|
||||
table->nodes--;
|
||||
|
||||
*pnode = node->link;
|
||||
|
||||
node->size = 0;
|
||||
node->source = NULL;
|
||||
|
||||
ft_mem_table_free( table, node );
|
||||
|
||||
if ( table->nodes * 3 < table->size ||
|
||||
table->size * 3 < table->nodes )
|
||||
ft_mem_table_resize( table );
|
||||
}
|
||||
}
|
||||
else
|
||||
ft_mem_debug_panic(
|
||||
"trying to free unknown block at %p in (%s:%ld)\n",
|
||||
address,
|
||||
FT_FILENAME( _ft_debug_file ), _ft_debug_lineno );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static FT_Pointer
|
||||
ft_mem_debug_alloc( FT_Memory memory,
|
||||
FT_Long size )
|
||||
{
|
||||
FT_MemTable table = (FT_MemTable)memory->user;
|
||||
FT_Byte* block;
|
||||
|
||||
|
||||
if ( size <= 0 )
|
||||
ft_mem_debug_panic( "negative block size allocation (%ld)", size );
|
||||
|
||||
/* return NULL if the maximum number of allocations was reached */
|
||||
if ( table->bound_count &&
|
||||
table->alloc_count >= table->alloc_count_max )
|
||||
return NULL;
|
||||
|
||||
/* return NULL if this allocation would overflow the maximum heap size */
|
||||
if ( table->bound_total &&
|
||||
table->alloc_total_max - table->alloc_current > size )
|
||||
return NULL;
|
||||
|
||||
block = (FT_Byte *)ft_mem_table_alloc( table, size );
|
||||
if ( block )
|
||||
{
|
||||
ft_mem_table_set( table, block, size, 0 );
|
||||
|
||||
table->alloc_count++;
|
||||
}
|
||||
|
||||
_ft_debug_file = "<unknown>";
|
||||
_ft_debug_lineno = 0;
|
||||
|
||||
return (FT_Pointer)block;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
ft_mem_debug_free( FT_Memory memory,
|
||||
FT_Pointer block )
|
||||
{
|
||||
FT_MemTable table = (FT_MemTable)memory->user;
|
||||
|
||||
|
||||
if ( !block )
|
||||
ft_mem_debug_panic( "trying to free NULL in (%s:%ld)",
|
||||
FT_FILENAME( _ft_debug_file ),
|
||||
_ft_debug_lineno );
|
||||
|
||||
ft_mem_table_remove( table, (FT_Byte*)block, 0 );
|
||||
|
||||
if ( !table->keep_alive )
|
||||
ft_mem_table_free( table, block );
|
||||
|
||||
table->alloc_count--;
|
||||
|
||||
_ft_debug_file = "<unknown>";
|
||||
_ft_debug_lineno = 0;
|
||||
}
|
||||
|
||||
|
||||
static FT_Pointer
|
||||
ft_mem_debug_realloc( FT_Memory memory,
|
||||
FT_Long cur_size,
|
||||
FT_Long new_size,
|
||||
FT_Pointer block )
|
||||
{
|
||||
FT_MemTable table = (FT_MemTable)memory->user;
|
||||
FT_MemNode node, *pnode;
|
||||
FT_Pointer new_block;
|
||||
FT_Long delta;
|
||||
|
||||
const char* file_name = FT_FILENAME( _ft_debug_file );
|
||||
FT_Long line_no = _ft_debug_lineno;
|
||||
|
||||
|
||||
/* unlikely, but possible */
|
||||
if ( new_size == cur_size )
|
||||
return block;
|
||||
|
||||
/* the following is valid according to ANSI C */
|
||||
#if 0
|
||||
if ( !block || !cur_size )
|
||||
ft_mem_debug_panic( "trying to reallocate NULL in (%s:%ld)",
|
||||
file_name, line_no );
|
||||
#endif
|
||||
|
||||
/* while the following is allowed in ANSI C also, we abort since */
|
||||
/* such case should be handled by FreeType. */
|
||||
if ( new_size <= 0 )
|
||||
ft_mem_debug_panic(
|
||||
"trying to reallocate %p to size 0 (current is %ld) in (%s:%ld)",
|
||||
block, cur_size, file_name, line_no );
|
||||
|
||||
/* check `cur_size' value */
|
||||
pnode = ft_mem_table_get_nodep( table, (FT_Byte*)block );
|
||||
node = *pnode;
|
||||
if ( !node )
|
||||
ft_mem_debug_panic(
|
||||
"trying to reallocate unknown block at %p in (%s:%ld)",
|
||||
block, file_name, line_no );
|
||||
|
||||
if ( node->size <= 0 )
|
||||
ft_mem_debug_panic(
|
||||
"trying to reallocate freed block at %p in (%s:%ld)",
|
||||
block, file_name, line_no );
|
||||
|
||||
if ( node->size != cur_size )
|
||||
ft_mem_debug_panic( "invalid ft_realloc request for %p. cur_size is "
|
||||
"%ld instead of %ld in (%s:%ld)",
|
||||
block, cur_size, node->size, file_name, line_no );
|
||||
|
||||
/* return NULL if the maximum number of allocations was reached */
|
||||
if ( table->bound_count &&
|
||||
table->alloc_count >= table->alloc_count_max )
|
||||
return NULL;
|
||||
|
||||
delta = new_size - cur_size;
|
||||
|
||||
/* return NULL if this allocation would overflow the maximum heap size */
|
||||
if ( delta > 0 &&
|
||||
table->bound_total &&
|
||||
table->alloc_current + delta > table->alloc_total_max )
|
||||
return NULL;
|
||||
|
||||
new_block = (FT_Pointer)ft_mem_table_alloc( table, new_size );
|
||||
if ( !new_block )
|
||||
return NULL;
|
||||
|
||||
ft_mem_table_set( table, (FT_Byte*)new_block, new_size, delta );
|
||||
|
||||
ft_memcpy( new_block, block, cur_size < new_size ? (size_t)cur_size
|
||||
: (size_t)new_size );
|
||||
|
||||
ft_mem_table_remove( table, (FT_Byte*)block, delta );
|
||||
|
||||
_ft_debug_file = "<unknown>";
|
||||
_ft_debug_lineno = 0;
|
||||
|
||||
if ( !table->keep_alive )
|
||||
ft_mem_table_free( table, block );
|
||||
|
||||
return new_block;
|
||||
}
|
||||
|
||||
|
||||
extern FT_Int
|
||||
ft_mem_debug_init( FT_Memory memory )
|
||||
{
|
||||
FT_MemTable table;
|
||||
FT_Int result = 0;
|
||||
|
||||
|
||||
if ( ft_getenv( "FT2_DEBUG_MEMORY" ) )
|
||||
{
|
||||
table = ft_mem_table_new( memory );
|
||||
if ( table )
|
||||
{
|
||||
const char* p;
|
||||
|
||||
|
||||
memory->user = table;
|
||||
memory->alloc = ft_mem_debug_alloc;
|
||||
memory->realloc = ft_mem_debug_realloc;
|
||||
memory->free = ft_mem_debug_free;
|
||||
|
||||
p = ft_getenv( "FT2_ALLOC_TOTAL_MAX" );
|
||||
if ( p )
|
||||
{
|
||||
FT_Long total_max = ft_strtol( p, NULL, 10 );
|
||||
|
||||
|
||||
if ( total_max > 0 )
|
||||
{
|
||||
table->bound_total = 1;
|
||||
table->alloc_total_max = total_max;
|
||||
}
|
||||
}
|
||||
|
||||
p = ft_getenv( "FT2_ALLOC_COUNT_MAX" );
|
||||
if ( p )
|
||||
{
|
||||
FT_Long total_count = ft_strtol( p, NULL, 10 );
|
||||
|
||||
|
||||
if ( total_count > 0 )
|
||||
{
|
||||
table->bound_count = 1;
|
||||
table->alloc_count_max = total_count;
|
||||
}
|
||||
}
|
||||
|
||||
p = ft_getenv( "FT2_KEEP_ALIVE" );
|
||||
if ( p )
|
||||
{
|
||||
FT_Long keep_alive = ft_strtol( p, NULL, 10 );
|
||||
|
||||
|
||||
if ( keep_alive > 0 )
|
||||
table->keep_alive = 1;
|
||||
}
|
||||
|
||||
result = 1;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
extern void
|
||||
ft_mem_debug_done( FT_Memory memory )
|
||||
{
|
||||
FT_MemTable table = (FT_MemTable)memory->user;
|
||||
|
||||
|
||||
if ( table )
|
||||
{
|
||||
memory->free = table->free;
|
||||
memory->realloc = table->realloc;
|
||||
memory->alloc = table->alloc;
|
||||
|
||||
ft_mem_table_destroy( table );
|
||||
memory->user = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
ft_mem_source_compare( const void* p1,
|
||||
const void* p2 )
|
||||
{
|
||||
FT_MemSource s1 = *(FT_MemSource*)p1;
|
||||
FT_MemSource s2 = *(FT_MemSource*)p2;
|
||||
|
||||
|
||||
if ( s2->max_size > s1->max_size )
|
||||
return 1;
|
||||
else if ( s2->max_size < s1->max_size )
|
||||
return -1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
extern void
|
||||
FT_DumpMemory( FT_Memory memory )
|
||||
{
|
||||
FT_MemTable table = (FT_MemTable)memory->user;
|
||||
|
||||
|
||||
if ( table )
|
||||
{
|
||||
FT_MemSource* bucket = table->sources;
|
||||
FT_MemSource* limit = bucket + FT_MEM_SOURCE_BUCKETS;
|
||||
FT_MemSource* sources;
|
||||
FT_Int nn, count;
|
||||
const char* fmt;
|
||||
|
||||
|
||||
count = 0;
|
||||
for ( ; bucket < limit; bucket++ )
|
||||
{
|
||||
FT_MemSource source = *bucket;
|
||||
|
||||
|
||||
for ( ; source; source = source->link )
|
||||
count++;
|
||||
}
|
||||
|
||||
sources = (FT_MemSource*)
|
||||
ft_mem_table_alloc(
|
||||
table, count * (FT_Long)sizeof ( *sources ) );
|
||||
|
||||
count = 0;
|
||||
for ( bucket = table->sources; bucket < limit; bucket++ )
|
||||
{
|
||||
FT_MemSource source = *bucket;
|
||||
|
||||
|
||||
for ( ; source; source = source->link )
|
||||
sources[count++] = source;
|
||||
}
|
||||
|
||||
ft_qsort( sources,
|
||||
(size_t)count,
|
||||
sizeof ( *sources ),
|
||||
ft_mem_source_compare );
|
||||
|
||||
printf( "FreeType Memory Dump: "
|
||||
"current=%ld max=%ld total=%ld count=%ld\n",
|
||||
table->alloc_current, table->alloc_max,
|
||||
table->alloc_total, table->alloc_count );
|
||||
printf( " block block sizes sizes sizes source\n" );
|
||||
printf( " count high sum highsum max location\n" );
|
||||
printf( "-------------------------------------------------\n" );
|
||||
|
||||
fmt = "%6ld %6ld %8ld %8ld %8ld %s:%d\n";
|
||||
|
||||
for ( nn = 0; nn < count; nn++ )
|
||||
{
|
||||
FT_MemSource source = sources[nn];
|
||||
|
||||
|
||||
printf( fmt,
|
||||
source->cur_blocks, source->max_blocks,
|
||||
source->cur_size, source->max_size, source->cur_max,
|
||||
FT_FILENAME( source->file_name ),
|
||||
source->line_no );
|
||||
}
|
||||
printf( "------------------------------------------------\n" );
|
||||
|
||||
ft_mem_table_free( table, sources );
|
||||
}
|
||||
}
|
||||
|
||||
#else /* !FT_DEBUG_MEMORY */
|
||||
|
||||
/* ANSI C doesn't like empty source files */
|
||||
typedef int _debug_mem_dummy;
|
||||
|
||||
#endif /* !FT_DEBUG_MEMORY */
|
||||
|
||||
|
||||
/* END */
|
||||
266
vendor/FreeType2/src/base/ftdebug.c
vendored
Normal file
266
vendor/FreeType2/src/base/ftdebug.c
vendored
Normal file
|
|
@ -0,0 +1,266 @@
|
|||
/***************************************************************************/
|
||||
/* */
|
||||
/* ftdebug.c */
|
||||
/* */
|
||||
/* Debugging and logging component (body). */
|
||||
/* */
|
||||
/* Copyright 1996-2018 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. */
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* This component contains various macros and functions used to ease the */
|
||||
/* debugging of the FreeType engine. Its main purpose is in assertion */
|
||||
/* checking, tracing, and error detection. */
|
||||
/* */
|
||||
/* There are now three debugging modes: */
|
||||
/* */
|
||||
/* - trace mode */
|
||||
/* */
|
||||
/* Error and trace messages are sent to the log file (which can be the */
|
||||
/* standard error output). */
|
||||
/* */
|
||||
/* - error mode */
|
||||
/* */
|
||||
/* Only error messages are generated. */
|
||||
/* */
|
||||
/* - release mode: */
|
||||
/* */
|
||||
/* No error message is sent or generated. The code is free from any */
|
||||
/* debugging parts. */
|
||||
/* */
|
||||
/*************************************************************************/
|
||||
|
||||
|
||||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
#include FT_INTERNAL_DEBUG_H
|
||||
|
||||
|
||||
#ifdef FT_DEBUG_LEVEL_ERROR
|
||||
|
||||
/* documentation is in ftdebug.h */
|
||||
|
||||
FT_BASE_DEF( void )
|
||||
FT_Message( const char* fmt,
|
||||
... )
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
|
||||
va_start( ap, fmt );
|
||||
vfprintf( stderr, fmt, ap );
|
||||
va_end( ap );
|
||||
}
|
||||
|
||||
|
||||
/* documentation is in ftdebug.h */
|
||||
|
||||
FT_BASE_DEF( void )
|
||||
FT_Panic( const char* fmt,
|
||||
... )
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
|
||||
va_start( ap, fmt );
|
||||
vfprintf( stderr, fmt, ap );
|
||||
va_end( ap );
|
||||
|
||||
exit( EXIT_FAILURE );
|
||||
}
|
||||
|
||||
|
||||
/* documentation is in ftdebug.h */
|
||||
|
||||
FT_BASE_DEF( int )
|
||||
FT_Throw( FT_Error error,
|
||||
int line,
|
||||
const char* file )
|
||||
{
|
||||
FT_UNUSED( error );
|
||||
FT_UNUSED( line );
|
||||
FT_UNUSED( file );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* FT_DEBUG_LEVEL_ERROR */
|
||||
|
||||
|
||||
|
||||
#ifdef FT_DEBUG_LEVEL_TRACE
|
||||
|
||||
/* array of trace levels, initialized to 0 */
|
||||
int ft_trace_levels[trace_count];
|
||||
|
||||
|
||||
/* define array of trace toggle names */
|
||||
#define FT_TRACE_DEF( x ) #x ,
|
||||
|
||||
static const char* ft_trace_toggles[trace_count + 1] =
|
||||
{
|
||||
#include FT_INTERNAL_TRACE_H
|
||||
NULL
|
||||
};
|
||||
|
||||
#undef FT_TRACE_DEF
|
||||
|
||||
|
||||
/* documentation is in ftdebug.h */
|
||||
|
||||
FT_BASE_DEF( FT_Int )
|
||||
FT_Trace_Get_Count( void )
|
||||
{
|
||||
return trace_count;
|
||||
}
|
||||
|
||||
|
||||
/* documentation is in ftdebug.h */
|
||||
|
||||
FT_BASE_DEF( const char * )
|
||||
FT_Trace_Get_Name( FT_Int idx )
|
||||
{
|
||||
int max = FT_Trace_Get_Count();
|
||||
|
||||
|
||||
if ( idx < max )
|
||||
return ft_trace_toggles[idx];
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* Initialize the tracing sub-system. This is done by retrieving the */
|
||||
/* value of the `FT2_DEBUG' environment variable. It must be a list of */
|
||||
/* toggles, separated by spaces, `;', or `,'. Example: */
|
||||
/* */
|
||||
/* export FT2_DEBUG="any:3 memory:7 stream:5" */
|
||||
/* */
|
||||
/* This requests that all levels be set to 3, except the trace level for */
|
||||
/* the memory and stream components which are set to 7 and 5, */
|
||||
/* respectively. */
|
||||
/* */
|
||||
/* See the file `include/freetype/internal/fttrace.h' for details of */
|
||||
/* the available toggle names. */
|
||||
/* */
|
||||
/* The level must be between 0 and 7; 0 means quiet (except for serious */
|
||||
/* runtime errors), and 7 means _very_ verbose. */
|
||||
/* */
|
||||
FT_BASE_DEF( void )
|
||||
ft_debug_init( void )
|
||||
{
|
||||
const char* ft2_debug = ft_getenv( "FT2_DEBUG" );
|
||||
|
||||
|
||||
if ( ft2_debug )
|
||||
{
|
||||
const char* p = ft2_debug;
|
||||
const char* q;
|
||||
|
||||
|
||||
for ( ; *p; p++ )
|
||||
{
|
||||
/* skip leading whitespace and separators */
|
||||
if ( *p == ' ' || *p == '\t' || *p == ',' || *p == ';' || *p == '=' )
|
||||
continue;
|
||||
|
||||
/* read toggle name, followed by ':' */
|
||||
q = p;
|
||||
while ( *p && *p != ':' )
|
||||
p++;
|
||||
|
||||
if ( !*p )
|
||||
break;
|
||||
|
||||
if ( *p == ':' && p > q )
|
||||
{
|
||||
FT_Int n, i, len = (FT_Int)( p - q );
|
||||
FT_Int level = -1, found = -1;
|
||||
|
||||
|
||||
for ( n = 0; n < trace_count; n++ )
|
||||
{
|
||||
const char* toggle = ft_trace_toggles[n];
|
||||
|
||||
|
||||
for ( i = 0; i < len; i++ )
|
||||
{
|
||||
if ( toggle[i] != q[i] )
|
||||
break;
|
||||
}
|
||||
|
||||
if ( i == len && toggle[i] == 0 )
|
||||
{
|
||||
found = n;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* read level */
|
||||
p++;
|
||||
if ( *p )
|
||||
{
|
||||
level = *p - '0';
|
||||
if ( level < 0 || level > 7 )
|
||||
level = -1;
|
||||
}
|
||||
|
||||
if ( found >= 0 && level >= 0 )
|
||||
{
|
||||
if ( found == trace_any )
|
||||
{
|
||||
/* special case for `any' */
|
||||
for ( n = 0; n < trace_count; n++ )
|
||||
ft_trace_levels[n] = level;
|
||||
}
|
||||
else
|
||||
ft_trace_levels[found] = level;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#else /* !FT_DEBUG_LEVEL_TRACE */
|
||||
|
||||
|
||||
FT_BASE_DEF( void )
|
||||
ft_debug_init( void )
|
||||
{
|
||||
/* nothing */
|
||||
}
|
||||
|
||||
|
||||
FT_BASE_DEF( FT_Int )
|
||||
FT_Trace_Get_Count( void )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
FT_BASE_DEF( const char * )
|
||||
FT_Trace_Get_Name( FT_Int idx )
|
||||
{
|
||||
FT_UNUSED( idx );
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
#endif /* !FT_DEBUG_LEVEL_TRACE */
|
||||
|
||||
|
||||
/* END */
|
||||
55
vendor/FreeType2/src/base/ftfntfmt.c
vendored
Normal file
55
vendor/FreeType2/src/base/ftfntfmt.c
vendored
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
/***************************************************************************/
|
||||
/* */
|
||||
/* ftfntfmt.c */
|
||||
/* */
|
||||
/* FreeType utility file for font formats (body). */
|
||||
/* */
|
||||
/* Copyright 2002-2018 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_FONT_FORMATS_H
|
||||
#include FT_INTERNAL_OBJECTS_H
|
||||
#include FT_SERVICE_FONT_FORMAT_H
|
||||
|
||||
|
||||
/* documentation is in ftfntfmt.h */
|
||||
|
||||
FT_EXPORT_DEF( const char* )
|
||||
FT_Get_Font_Format( FT_Face face )
|
||||
{
|
||||
const char* result = NULL;
|
||||
|
||||
|
||||
if ( face )
|
||||
FT_FACE_FIND_SERVICE( face, result, FONT_FORMAT );
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/* deprecated function name; retained for ABI compatibility */
|
||||
|
||||
FT_EXPORT_DEF( const char* )
|
||||
FT_Get_X11_Font_Format( FT_Face face )
|
||||
{
|
||||
const char* result = NULL;
|
||||
|
||||
|
||||
if ( face )
|
||||
FT_FACE_FIND_SERVICE( face, result, FONT_FORMAT );
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/* END */
|
||||
62
vendor/FreeType2/src/base/ftfstype.c
vendored
Normal file
62
vendor/FreeType2/src/base/ftfstype.c
vendored
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
/***************************************************************************/
|
||||
/* */
|
||||
/* ftfstype.c */
|
||||
/* */
|
||||
/* FreeType utility file to access FSType data (body). */
|
||||
/* */
|
||||
/* Copyright 2008-2018 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 */
|
||||
61
vendor/FreeType2/src/base/ftgasp.c
vendored
Normal file
61
vendor/FreeType2/src/base/ftgasp.c
vendored
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
/***************************************************************************/
|
||||
/* */
|
||||
/* ftgasp.c */
|
||||
/* */
|
||||
/* Access of TrueType's `gasp' table (body). */
|
||||
/* */
|
||||
/* Copyright 2007-2018 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_GASP_H
|
||||
#include FT_INTERNAL_TRUETYPE_TYPES_H
|
||||
|
||||
|
||||
FT_EXPORT_DEF( FT_Int )
|
||||
FT_Get_Gasp( FT_Face face,
|
||||
FT_UInt ppem )
|
||||
{
|
||||
FT_Int result = FT_GASP_NO_TABLE;
|
||||
|
||||
|
||||
if ( face && FT_IS_SFNT( face ) )
|
||||
{
|
||||
TT_Face ttface = (TT_Face)face;
|
||||
|
||||
|
||||
if ( ttface->gasp.numRanges > 0 )
|
||||
{
|
||||
TT_GaspRange range = ttface->gasp.gaspRanges;
|
||||
TT_GaspRange range_end = range + ttface->gasp.numRanges;
|
||||
|
||||
|
||||
while ( ppem > range->maxPPEM )
|
||||
{
|
||||
range++;
|
||||
if ( range >= range_end )
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
result = range->gaspFlag;
|
||||
|
||||
/* ensure that we don't have spurious bits */
|
||||
if ( ttface->gasp.version == 0 )
|
||||
result &= 3;
|
||||
}
|
||||
}
|
||||
Exit:
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/* END */
|
||||
406
vendor/FreeType2/src/base/ftgloadr.c
vendored
Normal file
406
vendor/FreeType2/src/base/ftgloadr.c
vendored
Normal file
|
|
@ -0,0 +1,406 @@
|
|||
/***************************************************************************/
|
||||
/* */
|
||||
/* ftgloadr.c */
|
||||
/* */
|
||||
/* The FreeType glyph loader (body). */
|
||||
/* */
|
||||
/* Copyright 2002-2018 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_INTERNAL_DEBUG_H
|
||||
#include FT_INTERNAL_GLYPH_LOADER_H
|
||||
#include FT_INTERNAL_MEMORY_H
|
||||
#include FT_INTERNAL_OBJECTS_H
|
||||
|
||||
#undef FT_COMPONENT
|
||||
#define FT_COMPONENT trace_gloader
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/***** *****/
|
||||
/***** *****/
|
||||
/***** G L Y P H L O A D E R *****/
|
||||
/***** *****/
|
||||
/***** *****/
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* The glyph loader is a simple object which is used to load a set of */
|
||||
/* glyphs easily. It is critical for the correct loading of composites. */
|
||||
/* */
|
||||
/* Ideally, one can see it as a stack of abstract `glyph' objects. */
|
||||
/* */
|
||||
/* loader.base Is really the bottom of the stack. It describes a */
|
||||
/* single glyph image made of the juxtaposition of */
|
||||
/* several glyphs (those `in the stack'). */
|
||||
/* */
|
||||
/* loader.current Describes the top of the stack, on which a new */
|
||||
/* glyph can be loaded. */
|
||||
/* */
|
||||
/* Rewind Clears the stack. */
|
||||
/* Prepare Set up `loader.current' for addition of a new glyph */
|
||||
/* image. */
|
||||
/* Add Add the `current' glyph image to the `base' one, */
|
||||
/* and prepare for another one. */
|
||||
/* */
|
||||
/* The glyph loader is now a base object. Each driver used to */
|
||||
/* re-implement it in one way or the other, which wasted code and */
|
||||
/* energy. */
|
||||
/* */
|
||||
/*************************************************************************/
|
||||
|
||||
|
||||
/* create a new glyph loader */
|
||||
FT_BASE_DEF( FT_Error )
|
||||
FT_GlyphLoader_New( FT_Memory memory,
|
||||
FT_GlyphLoader *aloader )
|
||||
{
|
||||
FT_GlyphLoader loader = NULL;
|
||||
FT_Error error;
|
||||
|
||||
|
||||
if ( !FT_NEW( loader ) )
|
||||
{
|
||||
loader->memory = memory;
|
||||
*aloader = loader;
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
/* rewind the glyph loader - reset counters to 0 */
|
||||
FT_BASE_DEF( void )
|
||||
FT_GlyphLoader_Rewind( FT_GlyphLoader loader )
|
||||
{
|
||||
FT_GlyphLoad base = &loader->base;
|
||||
FT_GlyphLoad current = &loader->current;
|
||||
|
||||
|
||||
base->outline.n_points = 0;
|
||||
base->outline.n_contours = 0;
|
||||
base->num_subglyphs = 0;
|
||||
|
||||
*current = *base;
|
||||
}
|
||||
|
||||
|
||||
/* reset the glyph loader, frees all allocated tables */
|
||||
/* and starts from zero */
|
||||
FT_BASE_DEF( void )
|
||||
FT_GlyphLoader_Reset( FT_GlyphLoader loader )
|
||||
{
|
||||
FT_Memory memory = loader->memory;
|
||||
|
||||
|
||||
FT_FREE( loader->base.outline.points );
|
||||
FT_FREE( loader->base.outline.tags );
|
||||
FT_FREE( loader->base.outline.contours );
|
||||
FT_FREE( loader->base.extra_points );
|
||||
FT_FREE( loader->base.subglyphs );
|
||||
|
||||
loader->base.extra_points2 = NULL;
|
||||
|
||||
loader->max_points = 0;
|
||||
loader->max_contours = 0;
|
||||
loader->max_subglyphs = 0;
|
||||
|
||||
FT_GlyphLoader_Rewind( loader );
|
||||
}
|
||||
|
||||
|
||||
/* delete a glyph loader */
|
||||
FT_BASE_DEF( void )
|
||||
FT_GlyphLoader_Done( FT_GlyphLoader loader )
|
||||
{
|
||||
if ( loader )
|
||||
{
|
||||
FT_Memory memory = loader->memory;
|
||||
|
||||
|
||||
FT_GlyphLoader_Reset( loader );
|
||||
FT_FREE( loader );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* re-adjust the `current' outline fields */
|
||||
static void
|
||||
FT_GlyphLoader_Adjust_Points( FT_GlyphLoader loader )
|
||||
{
|
||||
FT_Outline* base = &loader->base.outline;
|
||||
FT_Outline* current = &loader->current.outline;
|
||||
|
||||
|
||||
current->points = base->points + base->n_points;
|
||||
current->tags = base->tags + base->n_points;
|
||||
current->contours = base->contours + base->n_contours;
|
||||
|
||||
/* handle extra points table - if any */
|
||||
if ( loader->use_extra )
|
||||
{
|
||||
loader->current.extra_points = loader->base.extra_points +
|
||||
base->n_points;
|
||||
|
||||
loader->current.extra_points2 = loader->base.extra_points2 +
|
||||
base->n_points;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FT_BASE_DEF( FT_Error )
|
||||
FT_GlyphLoader_CreateExtra( FT_GlyphLoader loader )
|
||||
{
|
||||
FT_Error error;
|
||||
FT_Memory memory = loader->memory;
|
||||
|
||||
|
||||
if ( !FT_NEW_ARRAY( loader->base.extra_points, 2 * loader->max_points ) )
|
||||
{
|
||||
loader->use_extra = 1;
|
||||
loader->base.extra_points2 = loader->base.extra_points +
|
||||
loader->max_points;
|
||||
|
||||
FT_GlyphLoader_Adjust_Points( loader );
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
/* re-adjust the `current' subglyphs field */
|
||||
static void
|
||||
FT_GlyphLoader_Adjust_Subglyphs( FT_GlyphLoader loader )
|
||||
{
|
||||
FT_GlyphLoad base = &loader->base;
|
||||
FT_GlyphLoad current = &loader->current;
|
||||
|
||||
|
||||
current->subglyphs = base->subglyphs + base->num_subglyphs;
|
||||
}
|
||||
|
||||
|
||||
/* Ensure that we can add `n_points' and `n_contours' to our glyph. */
|
||||
/* This function reallocates its outline tables if necessary. Note that */
|
||||
/* it DOESN'T change the number of points within the loader! */
|
||||
/* */
|
||||
FT_BASE_DEF( FT_Error )
|
||||
FT_GlyphLoader_CheckPoints( FT_GlyphLoader loader,
|
||||
FT_UInt n_points,
|
||||
FT_UInt n_contours )
|
||||
{
|
||||
FT_Memory memory = loader->memory;
|
||||
FT_Error error = FT_Err_Ok;
|
||||
FT_Outline* base = &loader->base.outline;
|
||||
FT_Outline* current = &loader->current.outline;
|
||||
FT_Bool adjust = 0;
|
||||
|
||||
FT_UInt new_max, old_max;
|
||||
|
||||
|
||||
/* check points & tags */
|
||||
new_max = (FT_UInt)base->n_points + (FT_UInt)current->n_points +
|
||||
n_points;
|
||||
old_max = loader->max_points;
|
||||
|
||||
if ( new_max > old_max )
|
||||
{
|
||||
new_max = FT_PAD_CEIL( new_max, 8 );
|
||||
|
||||
if ( new_max > FT_OUTLINE_POINTS_MAX )
|
||||
return FT_THROW( Array_Too_Large );
|
||||
|
||||
if ( FT_RENEW_ARRAY( base->points, old_max, new_max ) ||
|
||||
FT_RENEW_ARRAY( base->tags, old_max, new_max ) )
|
||||
goto Exit;
|
||||
|
||||
if ( loader->use_extra )
|
||||
{
|
||||
if ( FT_RENEW_ARRAY( loader->base.extra_points,
|
||||
old_max * 2, new_max * 2 ) )
|
||||
goto Exit;
|
||||
|
||||
FT_ARRAY_MOVE( loader->base.extra_points + new_max,
|
||||
loader->base.extra_points + old_max,
|
||||
old_max );
|
||||
|
||||
loader->base.extra_points2 = loader->base.extra_points + new_max;
|
||||
}
|
||||
|
||||
adjust = 1;
|
||||
loader->max_points = new_max;
|
||||
}
|
||||
|
||||
/* check contours */
|
||||
old_max = loader->max_contours;
|
||||
new_max = (FT_UInt)base->n_contours + (FT_UInt)current->n_contours +
|
||||
n_contours;
|
||||
if ( new_max > old_max )
|
||||
{
|
||||
new_max = FT_PAD_CEIL( new_max, 4 );
|
||||
|
||||
if ( new_max > FT_OUTLINE_CONTOURS_MAX )
|
||||
return FT_THROW( Array_Too_Large );
|
||||
|
||||
if ( FT_RENEW_ARRAY( base->contours, old_max, new_max ) )
|
||||
goto Exit;
|
||||
|
||||
adjust = 1;
|
||||
loader->max_contours = new_max;
|
||||
}
|
||||
|
||||
if ( adjust )
|
||||
FT_GlyphLoader_Adjust_Points( loader );
|
||||
|
||||
Exit:
|
||||
if ( error )
|
||||
FT_GlyphLoader_Reset( loader );
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
/* Ensure that we can add `n_subglyphs' to our glyph. this function */
|
||||
/* reallocates its subglyphs table if necessary. Note that it DOES */
|
||||
/* NOT change the number of subglyphs within the loader! */
|
||||
/* */
|
||||
FT_BASE_DEF( FT_Error )
|
||||
FT_GlyphLoader_CheckSubGlyphs( FT_GlyphLoader loader,
|
||||
FT_UInt n_subs )
|
||||
{
|
||||
FT_Memory memory = loader->memory;
|
||||
FT_Error error = FT_Err_Ok;
|
||||
FT_UInt new_max, old_max;
|
||||
|
||||
FT_GlyphLoad base = &loader->base;
|
||||
FT_GlyphLoad current = &loader->current;
|
||||
|
||||
|
||||
new_max = base->num_subglyphs + current->num_subglyphs + n_subs;
|
||||
old_max = loader->max_subglyphs;
|
||||
if ( new_max > old_max )
|
||||
{
|
||||
new_max = FT_PAD_CEIL( new_max, 2 );
|
||||
if ( FT_RENEW_ARRAY( base->subglyphs, old_max, new_max ) )
|
||||
goto Exit;
|
||||
|
||||
loader->max_subglyphs = new_max;
|
||||
|
||||
FT_GlyphLoader_Adjust_Subglyphs( loader );
|
||||
}
|
||||
|
||||
Exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
/* prepare loader for the addition of a new glyph on top of the base one */
|
||||
FT_BASE_DEF( void )
|
||||
FT_GlyphLoader_Prepare( FT_GlyphLoader loader )
|
||||
{
|
||||
FT_GlyphLoad current = &loader->current;
|
||||
|
||||
|
||||
current->outline.n_points = 0;
|
||||
current->outline.n_contours = 0;
|
||||
current->num_subglyphs = 0;
|
||||
|
||||
FT_GlyphLoader_Adjust_Points ( loader );
|
||||
FT_GlyphLoader_Adjust_Subglyphs( loader );
|
||||
}
|
||||
|
||||
|
||||
/* add current glyph to the base image -- and prepare for another */
|
||||
FT_BASE_DEF( void )
|
||||
FT_GlyphLoader_Add( FT_GlyphLoader loader )
|
||||
{
|
||||
FT_GlyphLoad base;
|
||||
FT_GlyphLoad current;
|
||||
|
||||
FT_Int n_curr_contours;
|
||||
FT_Int n_base_points;
|
||||
FT_Int n;
|
||||
|
||||
|
||||
if ( !loader )
|
||||
return;
|
||||
|
||||
base = &loader->base;
|
||||
current = &loader->current;
|
||||
|
||||
n_curr_contours = current->outline.n_contours;
|
||||
n_base_points = base->outline.n_points;
|
||||
|
||||
base->outline.n_points =
|
||||
(short)( base->outline.n_points + current->outline.n_points );
|
||||
base->outline.n_contours =
|
||||
(short)( base->outline.n_contours + current->outline.n_contours );
|
||||
|
||||
base->num_subglyphs += current->num_subglyphs;
|
||||
|
||||
/* adjust contours count in newest outline */
|
||||
for ( n = 0; n < n_curr_contours; n++ )
|
||||
current->outline.contours[n] =
|
||||
(short)( current->outline.contours[n] + n_base_points );
|
||||
|
||||
/* prepare for another new glyph image */
|
||||
FT_GlyphLoader_Prepare( loader );
|
||||
}
|
||||
|
||||
|
||||
FT_BASE_DEF( FT_Error )
|
||||
FT_GlyphLoader_CopyPoints( FT_GlyphLoader target,
|
||||
FT_GlyphLoader source )
|
||||
{
|
||||
FT_Error error;
|
||||
FT_UInt num_points = (FT_UInt)source->base.outline.n_points;
|
||||
FT_UInt num_contours = (FT_UInt)source->base.outline.n_contours;
|
||||
|
||||
|
||||
error = FT_GlyphLoader_CheckPoints( target, num_points, num_contours );
|
||||
if ( !error )
|
||||
{
|
||||
FT_Outline* out = &target->base.outline;
|
||||
FT_Outline* in = &source->base.outline;
|
||||
|
||||
|
||||
FT_ARRAY_COPY( out->points, in->points,
|
||||
num_points );
|
||||
FT_ARRAY_COPY( out->tags, in->tags,
|
||||
num_points );
|
||||
FT_ARRAY_COPY( out->contours, in->contours,
|
||||
num_contours );
|
||||
|
||||
/* do we need to copy the extra points? */
|
||||
if ( target->use_extra && source->use_extra )
|
||||
{
|
||||
FT_ARRAY_COPY( target->base.extra_points, source->base.extra_points,
|
||||
num_points );
|
||||
FT_ARRAY_COPY( target->base.extra_points2, source->base.extra_points2,
|
||||
num_points );
|
||||
}
|
||||
|
||||
out->n_points = (short)num_points;
|
||||
out->n_contours = (short)num_contours;
|
||||
|
||||
FT_GlyphLoader_Adjust_Points( target );
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
/* END */
|
||||
649
vendor/FreeType2/src/base/ftglyph.c
vendored
Normal file
649
vendor/FreeType2/src/base/ftglyph.c
vendored
Normal file
|
|
@ -0,0 +1,649 @@
|
|||
/***************************************************************************/
|
||||
/* */
|
||||
/* ftglyph.c */
|
||||
/* */
|
||||
/* FreeType convenience functions to handle glyphs (body). */
|
||||
/* */
|
||||
/* Copyright 1996-2018 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. */
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* This file contains the definition of several convenience functions */
|
||||
/* that can be used by client applications to easily retrieve glyph */
|
||||
/* bitmaps and outlines from a given face. */
|
||||
/* */
|
||||
/* These functions should be optional if you are writing a font server */
|
||||
/* or text layout engine on top of FreeType. However, they are pretty */
|
||||
/* handy for many other simple uses of the library. */
|
||||
/* */
|
||||
/*************************************************************************/
|
||||
|
||||
|
||||
#include <ft2build.h>
|
||||
#include FT_INTERNAL_DEBUG_H
|
||||
|
||||
#include FT_GLYPH_H
|
||||
#include FT_OUTLINE_H
|
||||
#include FT_BITMAP_H
|
||||
#include FT_INTERNAL_OBJECTS_H
|
||||
|
||||
#include "basepic.h"
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* 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_glyph
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/**** ****/
|
||||
/**** FT_BitmapGlyph support ****/
|
||||
/**** ****/
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
|
||||
FT_CALLBACK_DEF( FT_Error )
|
||||
ft_bitmap_glyph_init( FT_Glyph bitmap_glyph,
|
||||
FT_GlyphSlot slot )
|
||||
{
|
||||
FT_BitmapGlyph glyph = (FT_BitmapGlyph)bitmap_glyph;
|
||||
FT_Error error = FT_Err_Ok;
|
||||
FT_Library library = FT_GLYPH( glyph )->library;
|
||||
|
||||
|
||||
if ( slot->format != FT_GLYPH_FORMAT_BITMAP )
|
||||
{
|
||||
error = FT_THROW( Invalid_Glyph_Format );
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
glyph->left = slot->bitmap_left;
|
||||
glyph->top = slot->bitmap_top;
|
||||
|
||||
/* do lazy copying whenever possible */
|
||||
if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP )
|
||||
{
|
||||
glyph->bitmap = slot->bitmap;
|
||||
slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP;
|
||||
}
|
||||
else
|
||||
{
|
||||
FT_Bitmap_Init( &glyph->bitmap );
|
||||
error = FT_Bitmap_Copy( library, &slot->bitmap, &glyph->bitmap );
|
||||
}
|
||||
|
||||
Exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
FT_CALLBACK_DEF( FT_Error )
|
||||
ft_bitmap_glyph_copy( FT_Glyph bitmap_source,
|
||||
FT_Glyph bitmap_target )
|
||||
{
|
||||
FT_Library library = bitmap_source->library;
|
||||
FT_BitmapGlyph source = (FT_BitmapGlyph)bitmap_source;
|
||||
FT_BitmapGlyph target = (FT_BitmapGlyph)bitmap_target;
|
||||
|
||||
|
||||
target->left = source->left;
|
||||
target->top = source->top;
|
||||
|
||||
return FT_Bitmap_Copy( library, &source->bitmap, &target->bitmap );
|
||||
}
|
||||
|
||||
|
||||
FT_CALLBACK_DEF( void )
|
||||
ft_bitmap_glyph_done( FT_Glyph bitmap_glyph )
|
||||
{
|
||||
FT_BitmapGlyph glyph = (FT_BitmapGlyph)bitmap_glyph;
|
||||
FT_Library library = FT_GLYPH( glyph )->library;
|
||||
|
||||
|
||||
FT_Bitmap_Done( library, &glyph->bitmap );
|
||||
}
|
||||
|
||||
|
||||
FT_CALLBACK_DEF( void )
|
||||
ft_bitmap_glyph_bbox( FT_Glyph bitmap_glyph,
|
||||
FT_BBox* cbox )
|
||||
{
|
||||
FT_BitmapGlyph glyph = (FT_BitmapGlyph)bitmap_glyph;
|
||||
|
||||
|
||||
cbox->xMin = glyph->left * 64;
|
||||
cbox->xMax = cbox->xMin + (FT_Pos)( glyph->bitmap.width * 64 );
|
||||
cbox->yMax = glyph->top * 64;
|
||||
cbox->yMin = cbox->yMax - (FT_Pos)( glyph->bitmap.rows * 64 );
|
||||
}
|
||||
|
||||
|
||||
FT_DEFINE_GLYPH(
|
||||
ft_bitmap_glyph_class,
|
||||
|
||||
sizeof ( FT_BitmapGlyphRec ),
|
||||
FT_GLYPH_FORMAT_BITMAP,
|
||||
|
||||
ft_bitmap_glyph_init, /* FT_Glyph_InitFunc glyph_init */
|
||||
ft_bitmap_glyph_done, /* FT_Glyph_DoneFunc glyph_done */
|
||||
ft_bitmap_glyph_copy, /* FT_Glyph_CopyFunc glyph_copy */
|
||||
NULL, /* FT_Glyph_TransformFunc glyph_transform */
|
||||
ft_bitmap_glyph_bbox, /* FT_Glyph_GetBBoxFunc glyph_bbox */
|
||||
NULL /* FT_Glyph_PrepareFunc glyph_prepare */
|
||||
)
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/**** ****/
|
||||
/**** FT_OutlineGlyph support ****/
|
||||
/**** ****/
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
|
||||
|
||||
FT_CALLBACK_DEF( FT_Error )
|
||||
ft_outline_glyph_init( FT_Glyph outline_glyph,
|
||||
FT_GlyphSlot slot )
|
||||
{
|
||||
FT_OutlineGlyph glyph = (FT_OutlineGlyph)outline_glyph;
|
||||
FT_Error error = FT_Err_Ok;
|
||||
FT_Library library = FT_GLYPH( glyph )->library;
|
||||
FT_Outline* source = &slot->outline;
|
||||
FT_Outline* target = &glyph->outline;
|
||||
|
||||
|
||||
/* check format in glyph slot */
|
||||
if ( slot->format != FT_GLYPH_FORMAT_OUTLINE )
|
||||
{
|
||||
error = FT_THROW( Invalid_Glyph_Format );
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
/* allocate new outline */
|
||||
error = FT_Outline_New( library,
|
||||
(FT_UInt)source->n_points,
|
||||
source->n_contours,
|
||||
&glyph->outline );
|
||||
if ( error )
|
||||
goto Exit;
|
||||
|
||||
FT_Outline_Copy( source, target );
|
||||
|
||||
Exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
FT_CALLBACK_DEF( void )
|
||||
ft_outline_glyph_done( FT_Glyph outline_glyph )
|
||||
{
|
||||
FT_OutlineGlyph glyph = (FT_OutlineGlyph)outline_glyph;
|
||||
|
||||
|
||||
FT_Outline_Done( FT_GLYPH( glyph )->library, &glyph->outline );
|
||||
}
|
||||
|
||||
|
||||
FT_CALLBACK_DEF( FT_Error )
|
||||
ft_outline_glyph_copy( FT_Glyph outline_source,
|
||||
FT_Glyph outline_target )
|
||||
{
|
||||
FT_OutlineGlyph source = (FT_OutlineGlyph)outline_source;
|
||||
FT_OutlineGlyph target = (FT_OutlineGlyph)outline_target;
|
||||
FT_Error error;
|
||||
FT_Library library = FT_GLYPH( source )->library;
|
||||
|
||||
|
||||
error = FT_Outline_New( library,
|
||||
(FT_UInt)source->outline.n_points,
|
||||
source->outline.n_contours,
|
||||
&target->outline );
|
||||
if ( !error )
|
||||
FT_Outline_Copy( &source->outline, &target->outline );
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
FT_CALLBACK_DEF( void )
|
||||
ft_outline_glyph_transform( FT_Glyph outline_glyph,
|
||||
const FT_Matrix* matrix,
|
||||
const FT_Vector* delta )
|
||||
{
|
||||
FT_OutlineGlyph glyph = (FT_OutlineGlyph)outline_glyph;
|
||||
|
||||
|
||||
if ( matrix )
|
||||
FT_Outline_Transform( &glyph->outline, matrix );
|
||||
|
||||
if ( delta )
|
||||
FT_Outline_Translate( &glyph->outline, delta->x, delta->y );
|
||||
}
|
||||
|
||||
|
||||
FT_CALLBACK_DEF( void )
|
||||
ft_outline_glyph_bbox( FT_Glyph outline_glyph,
|
||||
FT_BBox* bbox )
|
||||
{
|
||||
FT_OutlineGlyph glyph = (FT_OutlineGlyph)outline_glyph;
|
||||
|
||||
|
||||
FT_Outline_Get_CBox( &glyph->outline, bbox );
|
||||
}
|
||||
|
||||
|
||||
FT_CALLBACK_DEF( FT_Error )
|
||||
ft_outline_glyph_prepare( FT_Glyph outline_glyph,
|
||||
FT_GlyphSlot slot )
|
||||
{
|
||||
FT_OutlineGlyph glyph = (FT_OutlineGlyph)outline_glyph;
|
||||
|
||||
|
||||
slot->format = FT_GLYPH_FORMAT_OUTLINE;
|
||||
slot->outline = glyph->outline;
|
||||
slot->outline.flags &= ~FT_OUTLINE_OWNER;
|
||||
|
||||
return FT_Err_Ok;
|
||||
}
|
||||
|
||||
|
||||
FT_DEFINE_GLYPH(
|
||||
ft_outline_glyph_class,
|
||||
|
||||
sizeof ( FT_OutlineGlyphRec ),
|
||||
FT_GLYPH_FORMAT_OUTLINE,
|
||||
|
||||
ft_outline_glyph_init, /* FT_Glyph_InitFunc glyph_init */
|
||||
ft_outline_glyph_done, /* FT_Glyph_DoneFunc glyph_done */
|
||||
ft_outline_glyph_copy, /* FT_Glyph_CopyFunc glyph_copy */
|
||||
ft_outline_glyph_transform, /* FT_Glyph_TransformFunc glyph_transform */
|
||||
ft_outline_glyph_bbox, /* FT_Glyph_GetBBoxFunc glyph_bbox */
|
||||
ft_outline_glyph_prepare /* FT_Glyph_PrepareFunc glyph_prepare */
|
||||
)
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/**** ****/
|
||||
/**** FT_Glyph class and API ****/
|
||||
/**** ****/
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
|
||||
static FT_Error
|
||||
ft_new_glyph( FT_Library library,
|
||||
const FT_Glyph_Class* clazz,
|
||||
FT_Glyph* aglyph )
|
||||
{
|
||||
FT_Memory memory = library->memory;
|
||||
FT_Error error;
|
||||
FT_Glyph glyph = NULL;
|
||||
|
||||
|
||||
*aglyph = NULL;
|
||||
|
||||
if ( !FT_ALLOC( glyph, clazz->glyph_size ) )
|
||||
{
|
||||
glyph->library = library;
|
||||
glyph->clazz = clazz;
|
||||
glyph->format = clazz->glyph_format;
|
||||
|
||||
*aglyph = glyph;
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
/* documentation is in ftglyph.h */
|
||||
|
||||
FT_EXPORT_DEF( FT_Error )
|
||||
FT_Glyph_Copy( FT_Glyph source,
|
||||
FT_Glyph *target )
|
||||
{
|
||||
FT_Glyph copy;
|
||||
FT_Error error;
|
||||
const FT_Glyph_Class* clazz;
|
||||
|
||||
|
||||
/* check arguments */
|
||||
if ( !target || !source || !source->clazz )
|
||||
{
|
||||
error = FT_THROW( Invalid_Argument );
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
*target = NULL;
|
||||
|
||||
if ( !source || !source->clazz )
|
||||
{
|
||||
error = FT_THROW( Invalid_Argument );
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
clazz = source->clazz;
|
||||
error = ft_new_glyph( source->library, clazz, © );
|
||||
if ( error )
|
||||
goto Exit;
|
||||
|
||||
copy->advance = source->advance;
|
||||
copy->format = source->format;
|
||||
|
||||
if ( clazz->glyph_copy )
|
||||
error = clazz->glyph_copy( source, copy );
|
||||
|
||||
if ( error )
|
||||
FT_Done_Glyph( copy );
|
||||
else
|
||||
*target = copy;
|
||||
|
||||
Exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
/* documentation is in ftglyph.h */
|
||||
|
||||
FT_EXPORT_DEF( FT_Error )
|
||||
FT_Get_Glyph( FT_GlyphSlot slot,
|
||||
FT_Glyph *aglyph )
|
||||
{
|
||||
FT_Library library;
|
||||
FT_Error error;
|
||||
FT_Glyph glyph;
|
||||
|
||||
const FT_Glyph_Class* clazz = NULL;
|
||||
|
||||
|
||||
if ( !slot )
|
||||
return FT_THROW( Invalid_Slot_Handle );
|
||||
|
||||
library = slot->library;
|
||||
|
||||
if ( !aglyph )
|
||||
return FT_THROW( Invalid_Argument );
|
||||
|
||||
/* if it is a bitmap, that's easy :-) */
|
||||
if ( slot->format == FT_GLYPH_FORMAT_BITMAP )
|
||||
clazz = FT_BITMAP_GLYPH_CLASS_GET;
|
||||
|
||||
/* if it is an outline */
|
||||
else if ( slot->format == FT_GLYPH_FORMAT_OUTLINE )
|
||||
clazz = FT_OUTLINE_GLYPH_CLASS_GET;
|
||||
|
||||
else
|
||||
{
|
||||
/* try to find a renderer that supports the glyph image format */
|
||||
FT_Renderer render = FT_Lookup_Renderer( library, slot->format, 0 );
|
||||
|
||||
|
||||
if ( render )
|
||||
clazz = &render->glyph_class;
|
||||
}
|
||||
|
||||
if ( !clazz )
|
||||
{
|
||||
error = FT_THROW( Invalid_Glyph_Format );
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
/* create FT_Glyph object */
|
||||
error = ft_new_glyph( library, clazz, &glyph );
|
||||
if ( error )
|
||||
goto Exit;
|
||||
|
||||
/* copy advance while converting 26.6 to 16.16 format */
|
||||
if ( slot->advance.x >= 0x8000L * 64 ||
|
||||
slot->advance.x <= -0x8000L * 64 )
|
||||
{
|
||||
FT_ERROR(( "FT_Get_Glyph: advance width too large\n" ));
|
||||
error = FT_THROW( Invalid_Argument );
|
||||
goto Exit2;
|
||||
}
|
||||
if ( slot->advance.y >= 0x8000L * 64 ||
|
||||
slot->advance.y <= -0x8000L * 64 )
|
||||
{
|
||||
FT_ERROR(( "FT_Get_Glyph: advance height too large\n" ));
|
||||
error = FT_THROW( Invalid_Argument );
|
||||
goto Exit2;
|
||||
}
|
||||
|
||||
glyph->advance.x = slot->advance.x * 1024;
|
||||
glyph->advance.y = slot->advance.y * 1024;
|
||||
|
||||
/* now import the image from the glyph slot */
|
||||
error = clazz->glyph_init( glyph, slot );
|
||||
|
||||
Exit2:
|
||||
/* if an error occurred, destroy the glyph */
|
||||
if ( error )
|
||||
FT_Done_Glyph( glyph );
|
||||
else
|
||||
*aglyph = glyph;
|
||||
|
||||
Exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
/* documentation is in ftglyph.h */
|
||||
|
||||
FT_EXPORT_DEF( FT_Error )
|
||||
FT_Glyph_Transform( FT_Glyph glyph,
|
||||
FT_Matrix* matrix,
|
||||
FT_Vector* delta )
|
||||
{
|
||||
FT_Error error = FT_Err_Ok;
|
||||
|
||||
|
||||
if ( !glyph || !glyph->clazz )
|
||||
error = FT_THROW( Invalid_Argument );
|
||||
else
|
||||
{
|
||||
const FT_Glyph_Class* clazz = glyph->clazz;
|
||||
|
||||
|
||||
if ( clazz->glyph_transform )
|
||||
{
|
||||
/* transform glyph image */
|
||||
clazz->glyph_transform( glyph, matrix, delta );
|
||||
|
||||
/* transform advance vector */
|
||||
if ( matrix )
|
||||
FT_Vector_Transform( &glyph->advance, matrix );
|
||||
}
|
||||
else
|
||||
error = FT_THROW( Invalid_Glyph_Format );
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
/* documentation is in ftglyph.h */
|
||||
|
||||
FT_EXPORT_DEF( void )
|
||||
FT_Glyph_Get_CBox( FT_Glyph glyph,
|
||||
FT_UInt bbox_mode,
|
||||
FT_BBox *acbox )
|
||||
{
|
||||
const FT_Glyph_Class* clazz;
|
||||
|
||||
|
||||
if ( !acbox )
|
||||
return;
|
||||
|
||||
acbox->xMin = acbox->yMin = acbox->xMax = acbox->yMax = 0;
|
||||
|
||||
if ( !glyph || !glyph->clazz )
|
||||
return;
|
||||
|
||||
clazz = glyph->clazz;
|
||||
if ( !clazz->glyph_bbox )
|
||||
return;
|
||||
|
||||
/* retrieve bbox in 26.6 coordinates */
|
||||
clazz->glyph_bbox( glyph, acbox );
|
||||
|
||||
/* perform grid fitting if needed */
|
||||
if ( bbox_mode == FT_GLYPH_BBOX_GRIDFIT ||
|
||||
bbox_mode == FT_GLYPH_BBOX_PIXELS )
|
||||
{
|
||||
acbox->xMin = FT_PIX_FLOOR( acbox->xMin );
|
||||
acbox->yMin = FT_PIX_FLOOR( acbox->yMin );
|
||||
acbox->xMax = FT_PIX_CEIL( acbox->xMax );
|
||||
acbox->yMax = FT_PIX_CEIL( acbox->yMax );
|
||||
}
|
||||
|
||||
/* convert to integer pixels if needed */
|
||||
if ( bbox_mode == FT_GLYPH_BBOX_TRUNCATE ||
|
||||
bbox_mode == FT_GLYPH_BBOX_PIXELS )
|
||||
{
|
||||
acbox->xMin >>= 6;
|
||||
acbox->yMin >>= 6;
|
||||
acbox->xMax >>= 6;
|
||||
acbox->yMax >>= 6;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* documentation is in ftglyph.h */
|
||||
|
||||
FT_EXPORT_DEF( FT_Error )
|
||||
FT_Glyph_To_Bitmap( FT_Glyph* the_glyph,
|
||||
FT_Render_Mode render_mode,
|
||||
FT_Vector* origin,
|
||||
FT_Bool destroy )
|
||||
{
|
||||
FT_GlyphSlotRec dummy;
|
||||
FT_GlyphSlot_InternalRec dummy_internal;
|
||||
FT_Error error = FT_Err_Ok;
|
||||
FT_Glyph b, glyph;
|
||||
FT_BitmapGlyph bitmap = NULL;
|
||||
const FT_Glyph_Class* clazz;
|
||||
|
||||
/* FT_BITMAP_GLYPH_CLASS_GET dereferences `library' in PIC mode */
|
||||
FT_Library library;
|
||||
|
||||
|
||||
/* check argument */
|
||||
if ( !the_glyph )
|
||||
goto Bad;
|
||||
glyph = *the_glyph;
|
||||
if ( !glyph )
|
||||
goto Bad;
|
||||
|
||||
clazz = glyph->clazz;
|
||||
library = glyph->library;
|
||||
if ( !library || !clazz )
|
||||
goto Bad;
|
||||
|
||||
/* when called with a bitmap glyph, do nothing and return successfully */
|
||||
if ( clazz == FT_BITMAP_GLYPH_CLASS_GET )
|
||||
goto Exit;
|
||||
|
||||
if ( !clazz->glyph_prepare )
|
||||
goto Bad;
|
||||
|
||||
/* we render the glyph into a glyph bitmap using a `dummy' glyph slot */
|
||||
/* then calling FT_Render_Glyph_Internal() */
|
||||
|
||||
FT_ZERO( &dummy );
|
||||
FT_ZERO( &dummy_internal );
|
||||
dummy.internal = &dummy_internal;
|
||||
dummy.library = library;
|
||||
dummy.format = clazz->glyph_format;
|
||||
|
||||
/* create result bitmap glyph */
|
||||
error = ft_new_glyph( library, FT_BITMAP_GLYPH_CLASS_GET, &b );
|
||||
if ( error )
|
||||
goto Exit;
|
||||
bitmap = (FT_BitmapGlyph)b;
|
||||
|
||||
#if 1
|
||||
/* if `origin' is set, translate the glyph image */
|
||||
if ( origin )
|
||||
FT_Glyph_Transform( glyph, 0, origin );
|
||||
#else
|
||||
FT_UNUSED( origin );
|
||||
#endif
|
||||
|
||||
/* prepare dummy slot for rendering */
|
||||
error = clazz->glyph_prepare( glyph, &dummy );
|
||||
if ( !error )
|
||||
error = FT_Render_Glyph_Internal( glyph->library, &dummy, render_mode );
|
||||
|
||||
#if 1
|
||||
if ( !destroy && origin )
|
||||
{
|
||||
FT_Vector v;
|
||||
|
||||
|
||||
v.x = -origin->x;
|
||||
v.y = -origin->y;
|
||||
FT_Glyph_Transform( glyph, 0, &v );
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( error )
|
||||
goto Exit;
|
||||
|
||||
/* in case of success, copy the bitmap to the glyph bitmap */
|
||||
error = ft_bitmap_glyph_init( (FT_Glyph)bitmap, &dummy );
|
||||
if ( error )
|
||||
goto Exit;
|
||||
|
||||
/* copy advance */
|
||||
bitmap->root.advance = glyph->advance;
|
||||
|
||||
if ( destroy )
|
||||
FT_Done_Glyph( glyph );
|
||||
|
||||
*the_glyph = FT_GLYPH( bitmap );
|
||||
|
||||
Exit:
|
||||
if ( error && bitmap )
|
||||
FT_Done_Glyph( FT_GLYPH( bitmap ) );
|
||||
|
||||
return error;
|
||||
|
||||
Bad:
|
||||
error = FT_THROW( Invalid_Argument );
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
|
||||
/* documentation is in ftglyph.h */
|
||||
|
||||
FT_EXPORT_DEF( void )
|
||||
FT_Done_Glyph( FT_Glyph glyph )
|
||||
{
|
||||
if ( glyph )
|
||||
{
|
||||
FT_Memory memory = glyph->library->memory;
|
||||
const FT_Glyph_Class* clazz = glyph->clazz;
|
||||
|
||||
|
||||
if ( clazz->glyph_done )
|
||||
clazz->glyph_done( glyph );
|
||||
|
||||
FT_FREE( glyph );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* END */
|
||||
142
vendor/FreeType2/src/base/ftgxval.c
vendored
Normal file
142
vendor/FreeType2/src/base/ftgxval.c
vendored
Normal file
|
|
@ -0,0 +1,142 @@
|
|||
/***************************************************************************/
|
||||
/* */
|
||||
/* ftgxval.c */
|
||||
/* */
|
||||
/* FreeType API for validating TrueTypeGX/AAT tables (body). */
|
||||
/* */
|
||||
/* Copyright 2004-2018 by */
|
||||
/* Masatake YAMATO, Redhat K.K, */
|
||||
/* 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. */
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
/***************************************************************************/
|
||||
/* */
|
||||
/* gxvalid is derived from both gxlayout module and otvalid module. */
|
||||
/* Development of gxlayout is supported by the Information-technology */
|
||||
/* Promotion Agency(IPA), Japan. */
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
|
||||
#include <ft2build.h>
|
||||
#include FT_INTERNAL_DEBUG_H
|
||||
|
||||
#include FT_INTERNAL_OBJECTS_H
|
||||
#include FT_SERVICE_GX_VALIDATE_H
|
||||
|
||||
|
||||
/* documentation is in ftgxval.h */
|
||||
|
||||
FT_EXPORT_DEF( FT_Error )
|
||||
FT_TrueTypeGX_Validate( FT_Face face,
|
||||
FT_UInt validation_flags,
|
||||
FT_Bytes tables[FT_VALIDATE_GX_LENGTH],
|
||||
FT_UInt table_length )
|
||||
{
|
||||
FT_Service_GXvalidate service;
|
||||
FT_Error error;
|
||||
|
||||
|
||||
if ( !face )
|
||||
{
|
||||
error = FT_THROW( Invalid_Face_Handle );
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
if ( !tables )
|
||||
{
|
||||
error = FT_THROW( Invalid_Argument );
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
FT_FACE_FIND_GLOBAL_SERVICE( face, service, GX_VALIDATE );
|
||||
|
||||
if ( service )
|
||||
error = service->validate( face,
|
||||
validation_flags,
|
||||
tables,
|
||||
table_length );
|
||||
else
|
||||
error = FT_THROW( Unimplemented_Feature );
|
||||
|
||||
Exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
FT_EXPORT_DEF( void )
|
||||
FT_TrueTypeGX_Free( FT_Face face,
|
||||
FT_Bytes table )
|
||||
{
|
||||
FT_Memory memory;
|
||||
|
||||
|
||||
if ( !face )
|
||||
return;
|
||||
|
||||
memory = FT_FACE_MEMORY( face );
|
||||
|
||||
FT_FREE( table );
|
||||
}
|
||||
|
||||
|
||||
FT_EXPORT_DEF( FT_Error )
|
||||
FT_ClassicKern_Validate( FT_Face face,
|
||||
FT_UInt validation_flags,
|
||||
FT_Bytes *ckern_table )
|
||||
{
|
||||
FT_Service_CKERNvalidate service;
|
||||
FT_Error error;
|
||||
|
||||
|
||||
if ( !face )
|
||||
{
|
||||
error = FT_THROW( Invalid_Face_Handle );
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
if ( !ckern_table )
|
||||
{
|
||||
error = FT_THROW( Invalid_Argument );
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
FT_FACE_FIND_GLOBAL_SERVICE( face, service, CLASSICKERN_VALIDATE );
|
||||
|
||||
if ( service )
|
||||
error = service->validate( face,
|
||||
validation_flags,
|
||||
ckern_table );
|
||||
else
|
||||
error = FT_THROW( Unimplemented_Feature );
|
||||
|
||||
Exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
FT_EXPORT_DEF( void )
|
||||
FT_ClassicKern_Free( FT_Face face,
|
||||
FT_Bytes table )
|
||||
{
|
||||
FT_Memory memory;
|
||||
|
||||
|
||||
if ( !face )
|
||||
return;
|
||||
|
||||
memory = FT_FACE_MEMORY( face );
|
||||
|
||||
|
||||
FT_FREE( table );
|
||||
}
|
||||
|
||||
|
||||
/* END */
|
||||
339
vendor/FreeType2/src/base/fthash.c
vendored
Normal file
339
vendor/FreeType2/src/base/fthash.c
vendored
Normal file
|
|
@ -0,0 +1,339 @@
|
|||
/***************************************************************************/
|
||||
/* */
|
||||
/* fthash.c */
|
||||
/* */
|
||||
/* Hashing functions (body). */
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright 2000 Computing Research Labs, New Mexico State University
|
||||
* Copyright 2001-2015
|
||||
* Francesco Zappa Nardelli
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COMPUTING RESEARCH LAB OR NEW MEXICO STATE UNIVERSITY BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
|
||||
* OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
|
||||
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* This file is based on code from bdf.c,v 1.22 2000/03/16 20:08:50 */
|
||||
/* */
|
||||
/* taken from Mark Leisher's xmbdfed package */
|
||||
/* */
|
||||
/*************************************************************************/
|
||||
|
||||
|
||||
#include <ft2build.h>
|
||||
#include FT_INTERNAL_HASH_H
|
||||
#include FT_INTERNAL_MEMORY_H
|
||||
|
||||
|
||||
#define INITIAL_HT_SIZE 241
|
||||
|
||||
|
||||
static FT_ULong
|
||||
hash_str_lookup( FT_Hashkey* key )
|
||||
{
|
||||
const char* kp = key->str;
|
||||
FT_ULong res = 0;
|
||||
|
||||
|
||||
/* Mocklisp hash function. */
|
||||
while ( *kp )
|
||||
res = ( res << 5 ) - res + (FT_ULong)*kp++;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
static FT_ULong
|
||||
hash_num_lookup( FT_Hashkey* key )
|
||||
{
|
||||
FT_ULong num = (FT_ULong)key->num;
|
||||
FT_ULong res;
|
||||
|
||||
|
||||
/* Mocklisp hash function. */
|
||||
res = num & 0xFF;
|
||||
res = ( res << 5 ) - res + ( ( num >> 8 ) & 0xFF );
|
||||
res = ( res << 5 ) - res + ( ( num >> 16 ) & 0xFF );
|
||||
res = ( res << 5 ) - res + ( ( num >> 24 ) & 0xFF );
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
static FT_Bool
|
||||
hash_str_compare( FT_Hashkey* a,
|
||||
FT_Hashkey* b )
|
||||
{
|
||||
if ( a->str[0] == b->str[0] &&
|
||||
ft_strcmp( a->str, b->str ) == 0 )
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static FT_Bool
|
||||
hash_num_compare( FT_Hashkey* a,
|
||||
FT_Hashkey* b )
|
||||
{
|
||||
if ( a->num == b->num )
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static FT_Hashnode*
|
||||
hash_bucket( FT_Hashkey key,
|
||||
FT_Hash hash )
|
||||
{
|
||||
FT_ULong res = 0;
|
||||
FT_Hashnode* bp = hash->table;
|
||||
FT_Hashnode* ndp;
|
||||
|
||||
|
||||
res = (hash->lookup)( &key );
|
||||
|
||||
ndp = bp + ( res % hash->size );
|
||||
while ( *ndp )
|
||||
{
|
||||
if ( (hash->compare)( &(*ndp)->key, &key ) )
|
||||
break;
|
||||
|
||||
ndp--;
|
||||
if ( ndp < bp )
|
||||
ndp = bp + ( hash->size - 1 );
|
||||
}
|
||||
|
||||
return ndp;
|
||||
}
|
||||
|
||||
|
||||
static FT_Error
|
||||
hash_rehash( FT_Hash hash,
|
||||
FT_Memory memory )
|
||||
{
|
||||
FT_Hashnode* obp = hash->table;
|
||||
FT_Hashnode* bp;
|
||||
FT_Hashnode* nbp;
|
||||
|
||||
FT_UInt i, sz = hash->size;
|
||||
FT_Error error = FT_Err_Ok;
|
||||
|
||||
|
||||
hash->size <<= 1;
|
||||
hash->limit = hash->size / 3;
|
||||
|
||||
if ( FT_NEW_ARRAY( hash->table, hash->size ) )
|
||||
goto Exit;
|
||||
|
||||
for ( i = 0, bp = obp; i < sz; i++, bp++ )
|
||||
{
|
||||
if ( *bp )
|
||||
{
|
||||
nbp = hash_bucket( (*bp)->key, hash );
|
||||
*nbp = *bp;
|
||||
}
|
||||
}
|
||||
|
||||
FT_FREE( obp );
|
||||
|
||||
Exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
static FT_Error
|
||||
hash_init( FT_Hash hash,
|
||||
FT_Bool is_num,
|
||||
FT_Memory memory )
|
||||
{
|
||||
FT_UInt sz = INITIAL_HT_SIZE;
|
||||
FT_Error error;
|
||||
|
||||
|
||||
hash->size = sz;
|
||||
hash->limit = sz / 3;
|
||||
hash->used = 0;
|
||||
|
||||
if ( is_num )
|
||||
{
|
||||
hash->lookup = hash_num_lookup;
|
||||
hash->compare = hash_num_compare;
|
||||
}
|
||||
else
|
||||
{
|
||||
hash->lookup = hash_str_lookup;
|
||||
hash->compare = hash_str_compare;
|
||||
}
|
||||
|
||||
FT_MEM_NEW_ARRAY( hash->table, sz );
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
FT_Error
|
||||
ft_hash_str_init( FT_Hash hash,
|
||||
FT_Memory memory )
|
||||
{
|
||||
return hash_init( hash, 0, memory );
|
||||
}
|
||||
|
||||
|
||||
FT_Error
|
||||
ft_hash_num_init( FT_Hash hash,
|
||||
FT_Memory memory )
|
||||
{
|
||||
return hash_init( hash, 1, memory );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ft_hash_str_free( FT_Hash hash,
|
||||
FT_Memory memory )
|
||||
{
|
||||
if ( hash )
|
||||
{
|
||||
FT_UInt sz = hash->size;
|
||||
FT_Hashnode* bp = hash->table;
|
||||
FT_UInt i;
|
||||
|
||||
|
||||
for ( i = 0; i < sz; i++, bp++ )
|
||||
FT_FREE( *bp );
|
||||
|
||||
FT_FREE( hash->table );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* `ft_hash_num_free' is the same as `ft_hash_str_free' */
|
||||
|
||||
|
||||
static FT_Error
|
||||
hash_insert( FT_Hashkey key,
|
||||
size_t data,
|
||||
FT_Hash hash,
|
||||
FT_Memory memory )
|
||||
{
|
||||
FT_Hashnode nn;
|
||||
FT_Hashnode* bp = hash_bucket( key, hash );
|
||||
FT_Error error = FT_Err_Ok;
|
||||
|
||||
|
||||
nn = *bp;
|
||||
if ( !nn )
|
||||
{
|
||||
if ( FT_NEW( nn ) )
|
||||
goto Exit;
|
||||
*bp = nn;
|
||||
|
||||
nn->key = key;
|
||||
nn->data = data;
|
||||
|
||||
if ( hash->used >= hash->limit )
|
||||
{
|
||||
error = hash_rehash( hash, memory );
|
||||
if ( error )
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
hash->used++;
|
||||
}
|
||||
else
|
||||
nn->data = data;
|
||||
|
||||
Exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
FT_Error
|
||||
ft_hash_str_insert( const char* key,
|
||||
size_t data,
|
||||
FT_Hash hash,
|
||||
FT_Memory memory )
|
||||
{
|
||||
FT_Hashkey hk;
|
||||
|
||||
|
||||
hk.str = key;
|
||||
|
||||
return hash_insert( hk, data, hash, memory );
|
||||
}
|
||||
|
||||
|
||||
FT_Error
|
||||
ft_hash_num_insert( FT_Int num,
|
||||
size_t data,
|
||||
FT_Hash hash,
|
||||
FT_Memory memory )
|
||||
{
|
||||
FT_Hashkey hk;
|
||||
|
||||
|
||||
hk.num = num;
|
||||
|
||||
return hash_insert( hk, data, hash, memory );
|
||||
}
|
||||
|
||||
|
||||
static size_t*
|
||||
hash_lookup( FT_Hashkey key,
|
||||
FT_Hash hash )
|
||||
{
|
||||
FT_Hashnode* np = hash_bucket( key, hash );
|
||||
|
||||
|
||||
return (*np) ? &(*np)->data
|
||||
: NULL;
|
||||
}
|
||||
|
||||
|
||||
size_t*
|
||||
ft_hash_str_lookup( const char* key,
|
||||
FT_Hash hash )
|
||||
{
|
||||
FT_Hashkey hk;
|
||||
|
||||
|
||||
hk.str = key;
|
||||
|
||||
return hash_lookup( hk, hash );
|
||||
}
|
||||
|
||||
|
||||
size_t*
|
||||
ft_hash_num_lookup( FT_Int num,
|
||||
FT_Hash hash )
|
||||
{
|
||||
FT_Hashkey hk;
|
||||
|
||||
|
||||
hk.num = num;
|
||||
|
||||
return hash_lookup( hk, hash );
|
||||
}
|
||||
|
||||
|
||||
/* END */
|
||||
376
vendor/FreeType2/src/base/ftinit.c
vendored
Normal file
376
vendor/FreeType2/src/base/ftinit.c
vendored
Normal file
|
|
@ -0,0 +1,376 @@
|
|||
/***************************************************************************/
|
||||
/* */
|
||||
/* ftinit.c */
|
||||
/* */
|
||||
/* FreeType initialization layer (body). */
|
||||
/* */
|
||||
/* Copyright 1996-2018 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. */
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* The purpose of this file is to implement the following two */
|
||||
/* functions: */
|
||||
/* */
|
||||
/* FT_Add_Default_Modules(): */
|
||||
/* This function is used to add the set of default modules to a */
|
||||
/* fresh new library object. The set is taken from the header file */
|
||||
/* `freetype/config/ftmodule.h'. See the document `FreeType 2.0 */
|
||||
/* Build System' for more information. */
|
||||
/* */
|
||||
/* FT_Init_FreeType(): */
|
||||
/* This function creates a system object for the current platform, */
|
||||
/* builds a library out of it, then calls FT_Default_Drivers(). */
|
||||
/* */
|
||||
/* Note that even if FT_Init_FreeType() uses the implementation of the */
|
||||
/* system object defined at build time, client applications are still */
|
||||
/* able to provide their own `ftsystem.c'. */
|
||||
/* */
|
||||
/*************************************************************************/
|
||||
|
||||
|
||||
#include <ft2build.h>
|
||||
#include FT_CONFIG_CONFIG_H
|
||||
#include FT_INTERNAL_OBJECTS_H
|
||||
#include FT_INTERNAL_DEBUG_H
|
||||
#include FT_MODULE_H
|
||||
#include "basepic.h"
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* 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_init
|
||||
|
||||
|
||||
#ifndef FT_CONFIG_OPTION_PIC
|
||||
|
||||
|
||||
#undef FT_USE_MODULE
|
||||
#ifdef __cplusplus
|
||||
#define FT_USE_MODULE( type, x ) extern "C" const type x;
|
||||
#else
|
||||
#define FT_USE_MODULE( type, x ) extern const type x;
|
||||
#endif
|
||||
|
||||
#include FT_CONFIG_MODULES_H
|
||||
|
||||
#undef FT_USE_MODULE
|
||||
#define FT_USE_MODULE( type, x ) (const FT_Module_Class*)&(x),
|
||||
|
||||
static
|
||||
const FT_Module_Class* const ft_default_modules[] =
|
||||
{
|
||||
#include FT_CONFIG_MODULES_H
|
||||
0
|
||||
};
|
||||
|
||||
|
||||
#else /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define FT_EXTERNC extern "C"
|
||||
#else
|
||||
#define FT_EXTERNC extern
|
||||
#endif
|
||||
|
||||
/* declare the module's class creation/destruction functions */
|
||||
#undef FT_USE_MODULE
|
||||
#define FT_USE_MODULE( type, x ) \
|
||||
FT_EXTERNC FT_Error \
|
||||
FT_Create_Class_ ## x( FT_Library library, \
|
||||
FT_Module_Class* *output_class ); \
|
||||
FT_EXTERNC void \
|
||||
FT_Destroy_Class_ ## x( FT_Library library, \
|
||||
FT_Module_Class* clazz );
|
||||
|
||||
#include FT_CONFIG_MODULES_H
|
||||
|
||||
/* count all module classes */
|
||||
#undef FT_USE_MODULE
|
||||
#define FT_USE_MODULE( type, x ) MODULE_CLASS_ ## x,
|
||||
|
||||
enum
|
||||
{
|
||||
#include FT_CONFIG_MODULES_H
|
||||
FT_NUM_MODULE_CLASSES
|
||||
};
|
||||
|
||||
/* destroy all module classes */
|
||||
#undef FT_USE_MODULE
|
||||
#define FT_USE_MODULE( type, x ) \
|
||||
if ( classes[i] ) \
|
||||
{ \
|
||||
FT_Destroy_Class_ ## x( library, classes[i] ); \
|
||||
} \
|
||||
i++;
|
||||
|
||||
|
||||
FT_BASE_DEF( void )
|
||||
ft_destroy_default_module_classes( FT_Library library )
|
||||
{
|
||||
FT_Module_Class* *classes;
|
||||
FT_Memory memory;
|
||||
FT_UInt i;
|
||||
BasePIC* pic_container = (BasePIC*)library->pic_container.base;
|
||||
|
||||
|
||||
if ( !pic_container->default_module_classes )
|
||||
return;
|
||||
|
||||
memory = library->memory;
|
||||
classes = pic_container->default_module_classes;
|
||||
i = 0;
|
||||
|
||||
#include FT_CONFIG_MODULES_H
|
||||
|
||||
FT_FREE( classes );
|
||||
pic_container->default_module_classes = NULL;
|
||||
}
|
||||
|
||||
|
||||
/* initialize all module classes and the pointer table */
|
||||
#undef FT_USE_MODULE
|
||||
#define FT_USE_MODULE( type, x ) \
|
||||
error = FT_Create_Class_ ## x( library, &clazz ); \
|
||||
if ( error ) \
|
||||
goto Exit; \
|
||||
classes[i++] = clazz;
|
||||
|
||||
|
||||
FT_BASE_DEF( FT_Error )
|
||||
ft_create_default_module_classes( FT_Library library )
|
||||
{
|
||||
FT_Error error;
|
||||
FT_Memory memory;
|
||||
FT_Module_Class* *classes = NULL;
|
||||
FT_Module_Class* clazz;
|
||||
FT_UInt i;
|
||||
BasePIC* pic_container = (BasePIC*)library->pic_container.base;
|
||||
|
||||
|
||||
memory = library->memory;
|
||||
|
||||
pic_container->default_module_classes = NULL;
|
||||
|
||||
if ( FT_ALLOC( classes, sizeof ( FT_Module_Class* ) *
|
||||
( FT_NUM_MODULE_CLASSES + 1 ) ) )
|
||||
return error;
|
||||
|
||||
/* initialize all pointers to 0, especially the last one */
|
||||
for ( i = 0; i < FT_NUM_MODULE_CLASSES; i++ )
|
||||
classes[i] = NULL;
|
||||
classes[FT_NUM_MODULE_CLASSES] = NULL;
|
||||
|
||||
i = 0;
|
||||
|
||||
#include FT_CONFIG_MODULES_H
|
||||
|
||||
Exit:
|
||||
if ( error )
|
||||
ft_destroy_default_module_classes( library );
|
||||
else
|
||||
pic_container->default_module_classes = classes;
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
#endif /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
|
||||
/* documentation is in ftmodapi.h */
|
||||
|
||||
FT_EXPORT_DEF( void )
|
||||
FT_Add_Default_Modules( FT_Library library )
|
||||
{
|
||||
FT_Error error;
|
||||
const FT_Module_Class* const* cur;
|
||||
|
||||
|
||||
/* FT_DEFAULT_MODULES_GET dereferences `library' in PIC mode */
|
||||
#ifdef FT_CONFIG_OPTION_PIC
|
||||
if ( !library )
|
||||
return;
|
||||
#endif
|
||||
|
||||
/* GCC 4.6 warns the type difference:
|
||||
* FT_Module_Class** != const FT_Module_Class* const*
|
||||
*/
|
||||
cur = (const FT_Module_Class* const*)FT_DEFAULT_MODULES_GET;
|
||||
|
||||
/* test for valid `library' delayed to FT_Add_Module() */
|
||||
while ( *cur )
|
||||
{
|
||||
error = FT_Add_Module( library, *cur );
|
||||
/* notify errors, but don't stop */
|
||||
if ( error )
|
||||
FT_TRACE0(( "FT_Add_Default_Module:"
|
||||
" Cannot install `%s', error = 0x%x\n",
|
||||
(*cur)->module_name, error ));
|
||||
cur++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
|
||||
|
||||
#define MAX_LENGTH 128
|
||||
|
||||
/* documentation is in ftmodapi.h */
|
||||
|
||||
FT_EXPORT_DEF( void )
|
||||
FT_Set_Default_Properties( FT_Library library )
|
||||
{
|
||||
const char* env;
|
||||
const char* p;
|
||||
const char* q;
|
||||
|
||||
char module_name[MAX_LENGTH + 1];
|
||||
char property_name[MAX_LENGTH + 1];
|
||||
char property_value[MAX_LENGTH + 1];
|
||||
|
||||
int i;
|
||||
|
||||
|
||||
env = ft_getenv( "FREETYPE_PROPERTIES" );
|
||||
if ( !env )
|
||||
return;
|
||||
|
||||
for ( p = env; *p; p++ )
|
||||
{
|
||||
/* skip leading whitespace and separators */
|
||||
if ( *p == ' ' || *p == '\t' )
|
||||
continue;
|
||||
|
||||
/* read module name, followed by `:' */
|
||||
q = p;
|
||||
for ( i = 0; i < MAX_LENGTH; i++ )
|
||||
{
|
||||
if ( !*p || *p == ':' )
|
||||
break;
|
||||
module_name[i] = *p++;
|
||||
}
|
||||
module_name[i] = '\0';
|
||||
|
||||
if ( !*p || *p != ':' || p == q )
|
||||
break;
|
||||
|
||||
/* read property name, followed by `=' */
|
||||
q = ++p;
|
||||
for ( i = 0; i < MAX_LENGTH; i++ )
|
||||
{
|
||||
if ( !*p || *p == '=' )
|
||||
break;
|
||||
property_name[i] = *p++;
|
||||
}
|
||||
property_name[i] = '\0';
|
||||
|
||||
if ( !*p || *p != '=' || p == q )
|
||||
break;
|
||||
|
||||
/* read property value, followed by whitespace (if any) */
|
||||
q = ++p;
|
||||
for ( i = 0; i < MAX_LENGTH; i++ )
|
||||
{
|
||||
if ( !*p || *p == ' ' || *p == '\t' )
|
||||
break;
|
||||
property_value[i] = *p++;
|
||||
}
|
||||
property_value[i] = '\0';
|
||||
|
||||
if ( !( *p == '\0' || *p == ' ' || *p == '\t' ) || p == q )
|
||||
break;
|
||||
|
||||
/* we completely ignore errors */
|
||||
ft_property_string_set( library,
|
||||
module_name,
|
||||
property_name,
|
||||
property_value );
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
FT_EXPORT_DEF( void )
|
||||
FT_Set_Default_Properties( FT_Library library )
|
||||
{
|
||||
FT_UNUSED( library );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* documentation is in freetype.h */
|
||||
|
||||
FT_EXPORT_DEF( FT_Error )
|
||||
FT_Init_FreeType( FT_Library *alibrary )
|
||||
{
|
||||
FT_Error error;
|
||||
FT_Memory memory;
|
||||
|
||||
|
||||
/* check of `alibrary' delayed to `FT_New_Library' */
|
||||
|
||||
/* First of all, allocate a new system object -- this function is part */
|
||||
/* of the system-specific component, i.e. `ftsystem.c'. */
|
||||
|
||||
memory = FT_New_Memory();
|
||||
if ( !memory )
|
||||
{
|
||||
FT_ERROR(( "FT_Init_FreeType: cannot find memory manager\n" ));
|
||||
return FT_THROW( Unimplemented_Feature );
|
||||
}
|
||||
|
||||
/* build a library out of it, then fill it with the set of */
|
||||
/* default drivers. */
|
||||
|
||||
error = FT_New_Library( memory, alibrary );
|
||||
if ( error )
|
||||
FT_Done_Memory( memory );
|
||||
else
|
||||
FT_Add_Default_Modules( *alibrary );
|
||||
|
||||
FT_Set_Default_Properties( *alibrary );
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
/* documentation is in freetype.h */
|
||||
|
||||
FT_EXPORT_DEF( FT_Error )
|
||||
FT_Done_FreeType( FT_Library library )
|
||||
{
|
||||
FT_Memory memory;
|
||||
|
||||
|
||||
if ( !library )
|
||||
return FT_THROW( Invalid_Library_Handle );
|
||||
|
||||
memory = library->memory;
|
||||
|
||||
/* Discard the library object */
|
||||
FT_Done_Library( library );
|
||||
|
||||
/* discard memory manager */
|
||||
FT_Done_Memory( memory );
|
||||
|
||||
return FT_Err_Ok;
|
||||
}
|
||||
|
||||
|
||||
/* END */
|
||||
383
vendor/FreeType2/src/base/ftlcdfil.c
vendored
Normal file
383
vendor/FreeType2/src/base/ftlcdfil.c
vendored
Normal file
|
|
@ -0,0 +1,383 @@
|
|||
/***************************************************************************/
|
||||
/* */
|
||||
/* ftlcdfil.c */
|
||||
/* */
|
||||
/* FreeType API for color filtering of subpixel bitmap glyphs (body). */
|
||||
/* */
|
||||
/* Copyright 2006-2018 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_INTERNAL_DEBUG_H
|
||||
|
||||
#include FT_LCD_FILTER_H
|
||||
#include FT_IMAGE_H
|
||||
#include FT_INTERNAL_OBJECTS_H
|
||||
|
||||
|
||||
#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
|
||||
|
||||
/* define USE_LEGACY to implement the legacy filter */
|
||||
#define USE_LEGACY
|
||||
|
||||
#define FT_SHIFTCLAMP( x ) ( x >>= 8, (FT_Byte)( x > 255 ? 255 : x ) )
|
||||
|
||||
|
||||
/* add padding according to filter weights */
|
||||
FT_BASE_DEF (void)
|
||||
ft_lcd_padding( FT_Pos* Min,
|
||||
FT_Pos* Max,
|
||||
FT_GlyphSlot slot )
|
||||
{
|
||||
FT_Byte* lcd_weights;
|
||||
FT_Bitmap_LcdFilterFunc lcd_filter_func;
|
||||
|
||||
|
||||
/* Per-face LCD filtering takes priority if set up. */
|
||||
if ( slot->face && slot->face->internal->lcd_filter_func )
|
||||
{
|
||||
lcd_weights = slot->face->internal->lcd_weights;
|
||||
lcd_filter_func = slot->face->internal->lcd_filter_func;
|
||||
}
|
||||
else
|
||||
{
|
||||
lcd_weights = slot->library->lcd_weights;
|
||||
lcd_filter_func = slot->library->lcd_filter_func;
|
||||
}
|
||||
|
||||
if ( lcd_filter_func == ft_lcd_filter_fir )
|
||||
{
|
||||
*Min -= lcd_weights[0] ? 43 :
|
||||
lcd_weights[1] ? 22 : 0;
|
||||
*Max += lcd_weights[4] ? 43 :
|
||||
lcd_weights[3] ? 22 : 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* FIR filter used by the default and light filters */
|
||||
FT_BASE_DEF( void )
|
||||
ft_lcd_filter_fir( FT_Bitmap* bitmap,
|
||||
FT_Render_Mode mode,
|
||||
FT_LcdFiveTapFilter weights )
|
||||
{
|
||||
FT_UInt width = (FT_UInt)bitmap->width;
|
||||
FT_UInt height = (FT_UInt)bitmap->rows;
|
||||
FT_Int pitch = bitmap->pitch;
|
||||
FT_Byte* origin = bitmap->buffer;
|
||||
|
||||
|
||||
/* take care of bitmap flow */
|
||||
if ( pitch > 0 && height > 0 )
|
||||
origin += pitch * (FT_Int)( height - 1 );
|
||||
|
||||
/* horizontal in-place FIR filter */
|
||||
if ( mode == FT_RENDER_MODE_LCD && width >= 2 )
|
||||
{
|
||||
FT_Byte* line = origin;
|
||||
|
||||
|
||||
/* `fir' must be at least 32 bit wide, since the sum of */
|
||||
/* the values in `weights' can exceed 0xFF */
|
||||
|
||||
for ( ; height > 0; height--, line -= pitch )
|
||||
{
|
||||
FT_UInt fir[5];
|
||||
FT_UInt val, xx;
|
||||
|
||||
|
||||
val = line[0];
|
||||
fir[2] = weights[2] * val;
|
||||
fir[3] = weights[3] * val;
|
||||
fir[4] = weights[4] * val;
|
||||
|
||||
val = line[1];
|
||||
fir[1] = fir[2] + weights[1] * val;
|
||||
fir[2] = fir[3] + weights[2] * val;
|
||||
fir[3] = fir[4] + weights[3] * val;
|
||||
fir[4] = weights[4] * val;
|
||||
|
||||
for ( xx = 2; xx < width; xx++ )
|
||||
{
|
||||
val = line[xx];
|
||||
fir[0] = fir[1] + weights[0] * val;
|
||||
fir[1] = fir[2] + weights[1] * val;
|
||||
fir[2] = fir[3] + weights[2] * val;
|
||||
fir[3] = fir[4] + weights[3] * val;
|
||||
fir[4] = weights[4] * val;
|
||||
|
||||
line[xx - 2] = FT_SHIFTCLAMP( fir[0] );
|
||||
}
|
||||
|
||||
line[xx - 2] = FT_SHIFTCLAMP( fir[1] );
|
||||
line[xx - 1] = FT_SHIFTCLAMP( fir[2] );
|
||||
}
|
||||
}
|
||||
|
||||
/* vertical in-place FIR filter */
|
||||
else if ( mode == FT_RENDER_MODE_LCD_V && height >= 2 )
|
||||
{
|
||||
FT_Byte* column = origin;
|
||||
|
||||
|
||||
for ( ; width > 0; width--, column++ )
|
||||
{
|
||||
FT_Byte* col = column;
|
||||
FT_UInt fir[5];
|
||||
FT_UInt val, yy;
|
||||
|
||||
|
||||
val = col[0];
|
||||
fir[2] = weights[2] * val;
|
||||
fir[3] = weights[3] * val;
|
||||
fir[4] = weights[4] * val;
|
||||
col -= pitch;
|
||||
|
||||
val = col[0];
|
||||
fir[1] = fir[2] + weights[1] * val;
|
||||
fir[2] = fir[3] + weights[2] * val;
|
||||
fir[3] = fir[4] + weights[3] * val;
|
||||
fir[4] = weights[4] * val;
|
||||
col -= pitch;
|
||||
|
||||
for ( yy = 2; yy < height; yy++, col -= pitch )
|
||||
{
|
||||
val = col[0];
|
||||
fir[0] = fir[1] + weights[0] * val;
|
||||
fir[1] = fir[2] + weights[1] * val;
|
||||
fir[2] = fir[3] + weights[2] * val;
|
||||
fir[3] = fir[4] + weights[3] * val;
|
||||
fir[4] = weights[4] * val;
|
||||
|
||||
col[pitch * 2] = FT_SHIFTCLAMP( fir[0] );
|
||||
}
|
||||
|
||||
col[pitch * 2] = FT_SHIFTCLAMP( fir[1] );
|
||||
col[pitch] = FT_SHIFTCLAMP( fir[2] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef USE_LEGACY
|
||||
|
||||
/* intra-pixel filter used by the legacy filter */
|
||||
static void
|
||||
_ft_lcd_filter_legacy( FT_Bitmap* bitmap,
|
||||
FT_Render_Mode mode,
|
||||
FT_Byte* weights )
|
||||
{
|
||||
FT_UInt width = (FT_UInt)bitmap->width;
|
||||
FT_UInt height = (FT_UInt)bitmap->rows;
|
||||
FT_Int pitch = bitmap->pitch;
|
||||
FT_Byte* origin = bitmap->buffer;
|
||||
|
||||
static const unsigned int filters[3][3] =
|
||||
{
|
||||
{ 65538 * 9/13, 65538 * 1/6, 65538 * 1/13 },
|
||||
{ 65538 * 3/13, 65538 * 4/6, 65538 * 3/13 },
|
||||
{ 65538 * 1/13, 65538 * 1/6, 65538 * 9/13 }
|
||||
};
|
||||
|
||||
FT_UNUSED( weights );
|
||||
|
||||
|
||||
/* take care of bitmap flow */
|
||||
if ( pitch > 0 && height > 0 )
|
||||
origin += pitch * (FT_Int)( height - 1 );
|
||||
|
||||
/* horizontal in-place intra-pixel filter */
|
||||
if ( mode == FT_RENDER_MODE_LCD && width >= 3 )
|
||||
{
|
||||
FT_Byte* line = origin;
|
||||
|
||||
|
||||
for ( ; height > 0; height--, line -= pitch )
|
||||
{
|
||||
FT_UInt xx;
|
||||
|
||||
|
||||
for ( xx = 0; xx < width; xx += 3 )
|
||||
{
|
||||
FT_UInt r, g, b;
|
||||
FT_UInt p;
|
||||
|
||||
|
||||
p = line[xx];
|
||||
r = filters[0][0] * p;
|
||||
g = filters[0][1] * p;
|
||||
b = filters[0][2] * p;
|
||||
|
||||
p = line[xx + 1];
|
||||
r += filters[1][0] * p;
|
||||
g += filters[1][1] * p;
|
||||
b += filters[1][2] * p;
|
||||
|
||||
p = line[xx + 2];
|
||||
r += filters[2][0] * p;
|
||||
g += filters[2][1] * p;
|
||||
b += filters[2][2] * p;
|
||||
|
||||
line[xx] = (FT_Byte)( r / 65536 );
|
||||
line[xx + 1] = (FT_Byte)( g / 65536 );
|
||||
line[xx + 2] = (FT_Byte)( b / 65536 );
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( mode == FT_RENDER_MODE_LCD_V && height >= 3 )
|
||||
{
|
||||
FT_Byte* column = origin;
|
||||
|
||||
|
||||
for ( ; width > 0; width--, column++ )
|
||||
{
|
||||
FT_Byte* col = column - 2 * pitch;
|
||||
|
||||
|
||||
for ( ; height > 0; height -= 3, col -= 3 * pitch )
|
||||
{
|
||||
FT_UInt r, g, b;
|
||||
FT_UInt p;
|
||||
|
||||
|
||||
p = col[0];
|
||||
r = filters[0][0] * p;
|
||||
g = filters[0][1] * p;
|
||||
b = filters[0][2] * p;
|
||||
|
||||
p = col[pitch];
|
||||
r += filters[1][0] * p;
|
||||
g += filters[1][1] * p;
|
||||
b += filters[1][2] * p;
|
||||
|
||||
p = col[pitch * 2];
|
||||
r += filters[2][0] * p;
|
||||
g += filters[2][1] * p;
|
||||
b += filters[2][2] * p;
|
||||
|
||||
col[0] = (FT_Byte)( r / 65536 );
|
||||
col[pitch] = (FT_Byte)( g / 65536 );
|
||||
col[pitch * 2] = (FT_Byte)( b / 65536 );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* USE_LEGACY */
|
||||
|
||||
|
||||
FT_EXPORT_DEF( FT_Error )
|
||||
FT_Library_SetLcdFilterWeights( FT_Library library,
|
||||
unsigned char *weights )
|
||||
{
|
||||
if ( !library )
|
||||
return FT_THROW( Invalid_Library_Handle );
|
||||
|
||||
if ( !weights )
|
||||
return FT_THROW( Invalid_Argument );
|
||||
|
||||
ft_memcpy( library->lcd_weights, weights, FT_LCD_FILTER_FIVE_TAPS );
|
||||
library->lcd_filter_func = ft_lcd_filter_fir;
|
||||
|
||||
return FT_Err_Ok;
|
||||
}
|
||||
|
||||
|
||||
FT_EXPORT_DEF( FT_Error )
|
||||
FT_Library_SetLcdFilter( FT_Library library,
|
||||
FT_LcdFilter filter )
|
||||
{
|
||||
static const FT_LcdFiveTapFilter default_weights =
|
||||
{ 0x08, 0x4d, 0x56, 0x4d, 0x08 };
|
||||
static const FT_LcdFiveTapFilter light_weights =
|
||||
{ 0x00, 0x55, 0x56, 0x55, 0x00 };
|
||||
|
||||
|
||||
if ( !library )
|
||||
return FT_THROW( Invalid_Library_Handle );
|
||||
|
||||
switch ( filter )
|
||||
{
|
||||
case FT_LCD_FILTER_NONE:
|
||||
library->lcd_filter_func = NULL;
|
||||
break;
|
||||
|
||||
case FT_LCD_FILTER_DEFAULT:
|
||||
ft_memcpy( library->lcd_weights,
|
||||
default_weights,
|
||||
FT_LCD_FILTER_FIVE_TAPS );
|
||||
library->lcd_filter_func = ft_lcd_filter_fir;
|
||||
break;
|
||||
|
||||
case FT_LCD_FILTER_LIGHT:
|
||||
ft_memcpy( library->lcd_weights,
|
||||
light_weights,
|
||||
FT_LCD_FILTER_FIVE_TAPS );
|
||||
library->lcd_filter_func = ft_lcd_filter_fir;
|
||||
break;
|
||||
|
||||
#ifdef USE_LEGACY
|
||||
|
||||
case FT_LCD_FILTER_LEGACY:
|
||||
case FT_LCD_FILTER_LEGACY1:
|
||||
library->lcd_filter_func = _ft_lcd_filter_legacy;
|
||||
break;
|
||||
|
||||
#endif
|
||||
|
||||
default:
|
||||
return FT_THROW( Invalid_Argument );
|
||||
}
|
||||
|
||||
return FT_Err_Ok;
|
||||
}
|
||||
|
||||
#else /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
|
||||
|
||||
/* add padding according to accommodate outline shifts */
|
||||
FT_BASE_DEF (void)
|
||||
ft_lcd_padding( FT_Pos* Min,
|
||||
FT_Pos* Max,
|
||||
FT_GlyphSlot slot )
|
||||
{
|
||||
FT_UNUSED( slot );
|
||||
|
||||
*Min -= 21;
|
||||
*Max += 21;
|
||||
}
|
||||
|
||||
|
||||
FT_EXPORT_DEF( FT_Error )
|
||||
FT_Library_SetLcdFilterWeights( FT_Library library,
|
||||
unsigned char *weights )
|
||||
{
|
||||
FT_UNUSED( library );
|
||||
FT_UNUSED( weights );
|
||||
|
||||
return FT_THROW( Unimplemented_Feature );
|
||||
}
|
||||
|
||||
|
||||
FT_EXPORT_DEF( FT_Error )
|
||||
FT_Library_SetLcdFilter( FT_Library library,
|
||||
FT_LcdFilter filter )
|
||||
{
|
||||
FT_UNUSED( library );
|
||||
FT_UNUSED( filter );
|
||||
|
||||
return FT_THROW( Unimplemented_Feature );
|
||||
}
|
||||
|
||||
#endif /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
|
||||
|
||||
|
||||
/* END */
|
||||
1088
vendor/FreeType2/src/base/ftmac.c
vendored
Normal file
1088
vendor/FreeType2/src/base/ftmac.c
vendored
Normal file
File diff suppressed because it is too large
Load diff
508
vendor/FreeType2/src/base/ftmm.c
vendored
Normal file
508
vendor/FreeType2/src/base/ftmm.c
vendored
Normal file
|
|
@ -0,0 +1,508 @@
|
|||
/***************************************************************************/
|
||||
/* */
|
||||
/* ftmm.c */
|
||||
/* */
|
||||
/* Multiple Master font support (body). */
|
||||
/* */
|
||||
/* Copyright 1996-2018 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_INTERNAL_DEBUG_H
|
||||
|
||||
#include FT_MULTIPLE_MASTERS_H
|
||||
#include FT_INTERNAL_OBJECTS_H
|
||||
#include FT_SERVICE_MULTIPLE_MASTERS_H
|
||||
#include FT_SERVICE_METRICS_VARIATIONS_H
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* 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_mm
|
||||
|
||||
|
||||
static FT_Error
|
||||
ft_face_get_mm_service( FT_Face face,
|
||||
FT_Service_MultiMasters *aservice )
|
||||
{
|
||||
FT_Error error;
|
||||
|
||||
|
||||
*aservice = NULL;
|
||||
|
||||
if ( !face )
|
||||
return FT_THROW( Invalid_Face_Handle );
|
||||
|
||||
error = FT_ERR( Invalid_Argument );
|
||||
|
||||
if ( FT_HAS_MULTIPLE_MASTERS( face ) )
|
||||
{
|
||||
FT_FACE_LOOKUP_SERVICE( face,
|
||||
*aservice,
|
||||
MULTI_MASTERS );
|
||||
|
||||
if ( *aservice )
|
||||
error = FT_Err_Ok;
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
static FT_Error
|
||||
ft_face_get_mvar_service( FT_Face face,
|
||||
FT_Service_MetricsVariations *aservice )
|
||||
{
|
||||
FT_Error error;
|
||||
|
||||
|
||||
*aservice = NULL;
|
||||
|
||||
if ( !face )
|
||||
return FT_THROW( Invalid_Face_Handle );
|
||||
|
||||
error = FT_ERR( Invalid_Argument );
|
||||
|
||||
if ( FT_HAS_MULTIPLE_MASTERS( face ) )
|
||||
{
|
||||
FT_FACE_LOOKUP_SERVICE( face,
|
||||
*aservice,
|
||||
METRICS_VARIATIONS );
|
||||
|
||||
if ( *aservice )
|
||||
error = FT_Err_Ok;
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
/* documentation is in ftmm.h */
|
||||
|
||||
FT_EXPORT_DEF( FT_Error )
|
||||
FT_Get_Multi_Master( FT_Face face,
|
||||
FT_Multi_Master *amaster )
|
||||
{
|
||||
FT_Error error;
|
||||
FT_Service_MultiMasters service;
|
||||
|
||||
|
||||
/* check of `face' delayed to `ft_face_get_mm_service' */
|
||||
|
||||
if ( !amaster )
|
||||
return FT_THROW( Invalid_Argument );
|
||||
|
||||
error = ft_face_get_mm_service( face, &service );
|
||||
if ( !error )
|
||||
{
|
||||
error = FT_ERR( Invalid_Argument );
|
||||
if ( service->get_mm )
|
||||
error = service->get_mm( face, amaster );
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
/* documentation is in ftmm.h */
|
||||
|
||||
FT_EXPORT_DEF( FT_Error )
|
||||
FT_Get_MM_Var( FT_Face face,
|
||||
FT_MM_Var* *amaster )
|
||||
{
|
||||
FT_Error error;
|
||||
FT_Service_MultiMasters service;
|
||||
|
||||
|
||||
/* check of `face' delayed to `ft_face_get_mm_service' */
|
||||
|
||||
if ( !amaster )
|
||||
return FT_THROW( Invalid_Argument );
|
||||
|
||||
error = ft_face_get_mm_service( face, &service );
|
||||
if ( !error )
|
||||
{
|
||||
error = FT_ERR( Invalid_Argument );
|
||||
if ( service->get_mm_var )
|
||||
error = service->get_mm_var( face, amaster );
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
/* documentation is in ftmm.h */
|
||||
|
||||
FT_EXPORT_DEF( FT_Error )
|
||||
FT_Done_MM_Var( FT_Library library,
|
||||
FT_MM_Var* amaster )
|
||||
{
|
||||
FT_Memory memory;
|
||||
|
||||
|
||||
if ( !library )
|
||||
return FT_THROW( Invalid_Library_Handle );
|
||||
|
||||
memory = library->memory;
|
||||
FT_FREE( amaster );
|
||||
|
||||
return FT_Err_Ok;
|
||||
}
|
||||
|
||||
|
||||
/* documentation is in ftmm.h */
|
||||
|
||||
FT_EXPORT_DEF( FT_Error )
|
||||
FT_Set_MM_Design_Coordinates( FT_Face face,
|
||||
FT_UInt num_coords,
|
||||
FT_Long* coords )
|
||||
{
|
||||
FT_Error error;
|
||||
FT_Service_MultiMasters service;
|
||||
|
||||
|
||||
/* check of `face' delayed to `ft_face_get_mm_service' */
|
||||
|
||||
if ( num_coords && !coords )
|
||||
return FT_THROW( Invalid_Argument );
|
||||
|
||||
error = ft_face_get_mm_service( face, &service );
|
||||
if ( !error )
|
||||
{
|
||||
error = FT_ERR( Invalid_Argument );
|
||||
if ( service->set_mm_design )
|
||||
error = service->set_mm_design( face, num_coords, coords );
|
||||
}
|
||||
|
||||
/* enforce recomputation of auto-hinting data */
|
||||
if ( !error && face->autohint.finalizer )
|
||||
{
|
||||
face->autohint.finalizer( face->autohint.data );
|
||||
face->autohint.data = NULL;
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
/* documentation is in ftmm.h */
|
||||
|
||||
FT_EXPORT_DEF( FT_Error )
|
||||
FT_Set_Var_Design_Coordinates( FT_Face face,
|
||||
FT_UInt num_coords,
|
||||
FT_Fixed* coords )
|
||||
{
|
||||
FT_Error error;
|
||||
FT_Service_MultiMasters service_mm = NULL;
|
||||
FT_Service_MetricsVariations service_mvar = NULL;
|
||||
|
||||
|
||||
/* check of `face' delayed to `ft_face_get_mm_service' */
|
||||
|
||||
if ( num_coords && !coords )
|
||||
return FT_THROW( Invalid_Argument );
|
||||
|
||||
error = ft_face_get_mm_service( face, &service_mm );
|
||||
if ( !error )
|
||||
{
|
||||
error = FT_ERR( Invalid_Argument );
|
||||
if ( service_mm->set_var_design )
|
||||
error = service_mm->set_var_design( face, num_coords, coords );
|
||||
|
||||
/* internal error code -1 means `no change'; we can exit immediately */
|
||||
if ( error == -1 )
|
||||
return FT_Err_Ok;
|
||||
}
|
||||
|
||||
if ( !error )
|
||||
{
|
||||
(void)ft_face_get_mvar_service( face, &service_mvar );
|
||||
|
||||
if ( service_mvar && service_mvar->metrics_adjust )
|
||||
service_mvar->metrics_adjust( face );
|
||||
}
|
||||
|
||||
/* enforce recomputation of auto-hinting data */
|
||||
if ( !error && face->autohint.finalizer )
|
||||
{
|
||||
face->autohint.finalizer( face->autohint.data );
|
||||
face->autohint.data = NULL;
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
/* documentation is in ftmm.h */
|
||||
|
||||
FT_EXPORT_DEF( FT_Error )
|
||||
FT_Get_Var_Design_Coordinates( FT_Face face,
|
||||
FT_UInt num_coords,
|
||||
FT_Fixed* coords )
|
||||
{
|
||||
FT_Error error;
|
||||
FT_Service_MultiMasters service;
|
||||
|
||||
|
||||
/* check of `face' delayed to `ft_face_get_mm_service' */
|
||||
|
||||
if ( !coords )
|
||||
return FT_THROW( Invalid_Argument );
|
||||
|
||||
error = ft_face_get_mm_service( face, &service );
|
||||
if ( !error )
|
||||
{
|
||||
error = FT_ERR( Invalid_Argument );
|
||||
if ( service->get_var_design )
|
||||
error = service->get_var_design( face, num_coords, coords );
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
/* documentation is in ftmm.h */
|
||||
|
||||
FT_EXPORT_DEF( FT_Error )
|
||||
FT_Set_MM_Blend_Coordinates( FT_Face face,
|
||||
FT_UInt num_coords,
|
||||
FT_Fixed* coords )
|
||||
{
|
||||
FT_Error error;
|
||||
FT_Service_MultiMasters service_mm = NULL;
|
||||
FT_Service_MetricsVariations service_mvar = NULL;
|
||||
|
||||
|
||||
/* check of `face' delayed to `ft_face_get_mm_service' */
|
||||
|
||||
if ( num_coords && !coords )
|
||||
return FT_THROW( Invalid_Argument );
|
||||
|
||||
error = ft_face_get_mm_service( face, &service_mm );
|
||||
if ( !error )
|
||||
{
|
||||
error = FT_ERR( Invalid_Argument );
|
||||
if ( service_mm->set_mm_blend )
|
||||
error = service_mm->set_mm_blend( face, num_coords, coords );
|
||||
|
||||
/* internal error code -1 means `no change'; we can exit immediately */
|
||||
if ( error == -1 )
|
||||
return FT_Err_Ok;
|
||||
}
|
||||
|
||||
if ( !error )
|
||||
{
|
||||
(void)ft_face_get_mvar_service( face, &service_mvar );
|
||||
|
||||
if ( service_mvar && service_mvar->metrics_adjust )
|
||||
service_mvar->metrics_adjust( face );
|
||||
}
|
||||
|
||||
/* enforce recomputation of auto-hinting data */
|
||||
if ( !error && face->autohint.finalizer )
|
||||
{
|
||||
face->autohint.finalizer( face->autohint.data );
|
||||
face->autohint.data = NULL;
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
/* documentation is in ftmm.h */
|
||||
|
||||
/* This is exactly the same as the previous function. It exists for */
|
||||
/* orthogonality. */
|
||||
|
||||
FT_EXPORT_DEF( FT_Error )
|
||||
FT_Set_Var_Blend_Coordinates( FT_Face face,
|
||||
FT_UInt num_coords,
|
||||
FT_Fixed* coords )
|
||||
{
|
||||
FT_Error error;
|
||||
FT_Service_MultiMasters service_mm = NULL;
|
||||
FT_Service_MetricsVariations service_mvar = NULL;
|
||||
|
||||
|
||||
/* check of `face' delayed to `ft_face_get_mm_service' */
|
||||
|
||||
if ( num_coords && !coords )
|
||||
return FT_THROW( Invalid_Argument );
|
||||
|
||||
error = ft_face_get_mm_service( face, &service_mm );
|
||||
if ( !error )
|
||||
{
|
||||
error = FT_ERR( Invalid_Argument );
|
||||
if ( service_mm->set_mm_blend )
|
||||
error = service_mm->set_mm_blend( face, num_coords, coords );
|
||||
|
||||
/* internal error code -1 means `no change'; we can exit immediately */
|
||||
if ( error == -1 )
|
||||
return FT_Err_Ok;
|
||||
}
|
||||
|
||||
if ( !error )
|
||||
{
|
||||
(void)ft_face_get_mvar_service( face, &service_mvar );
|
||||
|
||||
if ( service_mvar && service_mvar->metrics_adjust )
|
||||
service_mvar->metrics_adjust( face );
|
||||
}
|
||||
|
||||
/* enforce recomputation of auto-hinting data */
|
||||
if ( !error && face->autohint.finalizer )
|
||||
{
|
||||
face->autohint.finalizer( face->autohint.data );
|
||||
face->autohint.data = NULL;
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
/* documentation is in ftmm.h */
|
||||
|
||||
FT_EXPORT_DEF( FT_Error )
|
||||
FT_Get_MM_Blend_Coordinates( FT_Face face,
|
||||
FT_UInt num_coords,
|
||||
FT_Fixed* coords )
|
||||
{
|
||||
FT_Error error;
|
||||
FT_Service_MultiMasters service;
|
||||
|
||||
|
||||
/* check of `face' delayed to `ft_face_get_mm_service' */
|
||||
|
||||
if ( !coords )
|
||||
return FT_THROW( Invalid_Argument );
|
||||
|
||||
error = ft_face_get_mm_service( face, &service );
|
||||
if ( !error )
|
||||
{
|
||||
error = FT_ERR( Invalid_Argument );
|
||||
if ( service->get_mm_blend )
|
||||
error = service->get_mm_blend( face, num_coords, coords );
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
/* documentation is in ftmm.h */
|
||||
|
||||
/* This is exactly the same as the previous function. It exists for */
|
||||
/* orthogonality. */
|
||||
|
||||
FT_EXPORT_DEF( FT_Error )
|
||||
FT_Get_Var_Blend_Coordinates( FT_Face face,
|
||||
FT_UInt num_coords,
|
||||
FT_Fixed* coords )
|
||||
{
|
||||
FT_Error error;
|
||||
FT_Service_MultiMasters service;
|
||||
|
||||
|
||||
/* check of `face' delayed to `ft_face_get_mm_service' */
|
||||
|
||||
if ( !coords )
|
||||
return FT_THROW( Invalid_Argument );
|
||||
|
||||
error = ft_face_get_mm_service( face, &service );
|
||||
if ( !error )
|
||||
{
|
||||
error = FT_ERR( Invalid_Argument );
|
||||
if ( service->get_mm_blend )
|
||||
error = service->get_mm_blend( face, num_coords, coords );
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
/* documentation is in ftmm.h */
|
||||
|
||||
FT_EXPORT_DEF( FT_Error )
|
||||
FT_Get_Var_Axis_Flags( FT_MM_Var* master,
|
||||
FT_UInt axis_index,
|
||||
FT_UInt* flags )
|
||||
{
|
||||
FT_UShort* axis_flags;
|
||||
|
||||
|
||||
if ( !master || !flags )
|
||||
return FT_THROW( Invalid_Argument );
|
||||
|
||||
if ( axis_index >= master->num_axis )
|
||||
return FT_THROW( Invalid_Argument );
|
||||
|
||||
/* the axis flags array immediately follows the data of `master' */
|
||||
axis_flags = (FT_UShort*)&( master[1] );
|
||||
*flags = axis_flags[axis_index];
|
||||
|
||||
return FT_Err_Ok;
|
||||
}
|
||||
|
||||
|
||||
/* documentation is in ftmm.h */
|
||||
|
||||
FT_EXPORT_DEF( FT_Error )
|
||||
FT_Set_Named_Instance( FT_Face face,
|
||||
FT_UInt instance_index )
|
||||
{
|
||||
FT_Error error;
|
||||
|
||||
FT_Service_MultiMasters service_mm = NULL;
|
||||
FT_Service_MetricsVariations service_mvar = NULL;
|
||||
|
||||
|
||||
/* check of `face' delayed to `ft_face_get_mm_service' */
|
||||
|
||||
error = ft_face_get_mm_service( face, &service_mm );
|
||||
if ( !error )
|
||||
{
|
||||
error = FT_ERR( Invalid_Argument );
|
||||
if ( service_mm->set_instance )
|
||||
error = service_mm->set_instance( face, instance_index );
|
||||
}
|
||||
|
||||
if ( !error )
|
||||
{
|
||||
(void)ft_face_get_mvar_service( face, &service_mvar );
|
||||
|
||||
if ( service_mvar && service_mvar->metrics_adjust )
|
||||
service_mvar->metrics_adjust( face );
|
||||
}
|
||||
|
||||
/* enforce recomputation of auto-hinting data */
|
||||
if ( !error && face->autohint.finalizer )
|
||||
{
|
||||
face->autohint.finalizer( face->autohint.data );
|
||||
face->autohint.data = NULL;
|
||||
}
|
||||
|
||||
if ( !error )
|
||||
{
|
||||
face->face_index = ( instance_index << 16 ) |
|
||||
( face->face_index & 0xFFFFL );
|
||||
face->face_flags &= ~FT_FACE_FLAG_VARIATION;
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
/* END */
|
||||
5405
vendor/FreeType2/src/base/ftobjs.c
vendored
Normal file
5405
vendor/FreeType2/src/base/ftobjs.c
vendored
Normal file
File diff suppressed because it is too large
Load diff
91
vendor/FreeType2/src/base/ftotval.c
vendored
Normal file
91
vendor/FreeType2/src/base/ftotval.c
vendored
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
/***************************************************************************/
|
||||
/* */
|
||||
/* ftotval.c */
|
||||
/* */
|
||||
/* FreeType API for validating OpenType tables (body). */
|
||||
/* */
|
||||
/* Copyright 2004-2018 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_INTERNAL_DEBUG_H
|
||||
|
||||
#include FT_INTERNAL_OBJECTS_H
|
||||
#include FT_SERVICE_OPENTYPE_VALIDATE_H
|
||||
#include FT_OPENTYPE_VALIDATE_H
|
||||
|
||||
|
||||
/* documentation is in ftotval.h */
|
||||
|
||||
FT_EXPORT_DEF( FT_Error )
|
||||
FT_OpenType_Validate( FT_Face face,
|
||||
FT_UInt validation_flags,
|
||||
FT_Bytes *BASE_table,
|
||||
FT_Bytes *GDEF_table,
|
||||
FT_Bytes *GPOS_table,
|
||||
FT_Bytes *GSUB_table,
|
||||
FT_Bytes *JSTF_table )
|
||||
{
|
||||
FT_Service_OTvalidate service;
|
||||
FT_Error error;
|
||||
|
||||
|
||||
if ( !face )
|
||||
{
|
||||
error = FT_THROW( Invalid_Face_Handle );
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
if ( !( BASE_table &&
|
||||
GDEF_table &&
|
||||
GPOS_table &&
|
||||
GSUB_table &&
|
||||
JSTF_table ) )
|
||||
{
|
||||
error = FT_THROW( Invalid_Argument );
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
FT_FACE_FIND_GLOBAL_SERVICE( face, service, OPENTYPE_VALIDATE );
|
||||
|
||||
if ( service )
|
||||
error = service->validate( face,
|
||||
validation_flags,
|
||||
BASE_table,
|
||||
GDEF_table,
|
||||
GPOS_table,
|
||||
GSUB_table,
|
||||
JSTF_table );
|
||||
else
|
||||
error = FT_THROW( Unimplemented_Feature );
|
||||
|
||||
Exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
FT_EXPORT_DEF( void )
|
||||
FT_OpenType_Free( FT_Face face,
|
||||
FT_Bytes table )
|
||||
{
|
||||
FT_Memory memory;
|
||||
|
||||
|
||||
if ( !face )
|
||||
return;
|
||||
|
||||
memory = FT_FACE_MEMORY( face );
|
||||
|
||||
FT_FREE( table );
|
||||
}
|
||||
|
||||
|
||||
/* END */
|
||||
1110
vendor/FreeType2/src/base/ftoutln.c
vendored
Normal file
1110
vendor/FreeType2/src/base/ftoutln.c
vendored
Normal file
File diff suppressed because it is too large
Load diff
51
vendor/FreeType2/src/base/ftpatent.c
vendored
Normal file
51
vendor/FreeType2/src/base/ftpatent.c
vendored
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
/***************************************************************************/
|
||||
/* */
|
||||
/* ftpatent.c */
|
||||
/* */
|
||||
/* FreeType API for checking patented TrueType bytecode instructions */
|
||||
/* (body). Obsolete, retained for backward compatibility. */
|
||||
/* */
|
||||
/* Copyright 2007-2018 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 */
|
||||
/* 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_FREETYPE_H
|
||||
#include FT_TRUETYPE_TAGS_H
|
||||
#include FT_INTERNAL_OBJECTS_H
|
||||
#include FT_INTERNAL_STREAM_H
|
||||
#include FT_SERVICE_SFNT_H
|
||||
#include FT_SERVICE_TRUETYPE_GLYF_H
|
||||
|
||||
|
||||
/* documentation is in freetype.h */
|
||||
|
||||
FT_EXPORT_DEF( FT_Bool )
|
||||
FT_Face_CheckTrueTypePatents( FT_Face face )
|
||||
{
|
||||
FT_UNUSED( face );
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/* documentation is in freetype.h */
|
||||
|
||||
FT_EXPORT_DEF( FT_Bool )
|
||||
FT_Face_SetUnpatentedHinting( FT_Face face,
|
||||
FT_Bool value )
|
||||
{
|
||||
FT_UNUSED( face );
|
||||
FT_UNUSED( value );
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* END */
|
||||
153
vendor/FreeType2/src/base/ftpfr.c
vendored
Normal file
153
vendor/FreeType2/src/base/ftpfr.c
vendored
Normal file
|
|
@ -0,0 +1,153 @@
|
|||
/***************************************************************************/
|
||||
/* */
|
||||
/* ftpfr.c */
|
||||
/* */
|
||||
/* FreeType API for accessing PFR-specific data (body). */
|
||||
/* */
|
||||
/* Copyright 2002-2018 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_INTERNAL_DEBUG_H
|
||||
|
||||
#include FT_INTERNAL_OBJECTS_H
|
||||
#include FT_SERVICE_PFR_H
|
||||
|
||||
|
||||
/* check the format */
|
||||
static FT_Service_PfrMetrics
|
||||
ft_pfr_check( FT_Face face )
|
||||
{
|
||||
FT_Service_PfrMetrics service = NULL;
|
||||
|
||||
|
||||
if ( face )
|
||||
FT_FACE_LOOKUP_SERVICE( face, service, PFR_METRICS );
|
||||
|
||||
return service;
|
||||
}
|
||||
|
||||
|
||||
/* documentation is in ftpfr.h */
|
||||
|
||||
FT_EXPORT_DEF( FT_Error )
|
||||
FT_Get_PFR_Metrics( FT_Face face,
|
||||
FT_UInt *aoutline_resolution,
|
||||
FT_UInt *ametrics_resolution,
|
||||
FT_Fixed *ametrics_x_scale,
|
||||
FT_Fixed *ametrics_y_scale )
|
||||
{
|
||||
FT_Error error = FT_Err_Ok;
|
||||
FT_Service_PfrMetrics service;
|
||||
|
||||
|
||||
if ( !face )
|
||||
return FT_THROW( Invalid_Face_Handle );
|
||||
|
||||
service = ft_pfr_check( face );
|
||||
if ( service )
|
||||
{
|
||||
error = service->get_metrics( face,
|
||||
aoutline_resolution,
|
||||
ametrics_resolution,
|
||||
ametrics_x_scale,
|
||||
ametrics_y_scale );
|
||||
}
|
||||
else
|
||||
{
|
||||
FT_Fixed x_scale, y_scale;
|
||||
|
||||
|
||||
/* this is not a PFR font */
|
||||
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 )
|
||||
{
|
||||
x_scale = face->size->metrics.x_scale;
|
||||
y_scale = face->size->metrics.y_scale;
|
||||
}
|
||||
|
||||
if ( ametrics_x_scale )
|
||||
*ametrics_x_scale = x_scale;
|
||||
|
||||
if ( ametrics_y_scale )
|
||||
*ametrics_y_scale = y_scale;
|
||||
|
||||
error = FT_THROW( Unknown_File_Format );
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
/* documentation is in ftpfr.h */
|
||||
|
||||
FT_EXPORT_DEF( FT_Error )
|
||||
FT_Get_PFR_Kerning( FT_Face face,
|
||||
FT_UInt left,
|
||||
FT_UInt right,
|
||||
FT_Vector *avector )
|
||||
{
|
||||
FT_Error error;
|
||||
FT_Service_PfrMetrics service;
|
||||
|
||||
|
||||
if ( !face )
|
||||
return FT_THROW( Invalid_Face_Handle );
|
||||
|
||||
if ( !avector )
|
||||
return FT_THROW( Invalid_Argument );
|
||||
|
||||
service = ft_pfr_check( face );
|
||||
if ( service )
|
||||
error = service->get_kerning( face, left, right, avector );
|
||||
else
|
||||
error = FT_Get_Kerning( face, left, right,
|
||||
FT_KERNING_UNSCALED, avector );
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
/* documentation is in ftpfr.h */
|
||||
|
||||
FT_EXPORT_DEF( FT_Error )
|
||||
FT_Get_PFR_Advance( FT_Face face,
|
||||
FT_UInt gindex,
|
||||
FT_Pos *aadvance )
|
||||
{
|
||||
FT_Error error;
|
||||
FT_Service_PfrMetrics service;
|
||||
|
||||
|
||||
if ( !face )
|
||||
return FT_THROW( Invalid_Face_Handle );
|
||||
|
||||
if ( !aadvance )
|
||||
return FT_THROW( Invalid_Argument );
|
||||
|
||||
service = ft_pfr_check( face );
|
||||
if ( service )
|
||||
error = service->get_advance( face, gindex, aadvance );
|
||||
else
|
||||
/* XXX: TODO: PROVIDE ADVANCE-LOADING METHOD TO ALL FONT DRIVERS */
|
||||
error = FT_THROW( Invalid_Argument );
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
/* END */
|
||||
55
vendor/FreeType2/src/base/ftpic.c
vendored
Normal file
55
vendor/FreeType2/src/base/ftpic.c
vendored
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
/***************************************************************************/
|
||||
/* */
|
||||
/* ftpic.c */
|
||||
/* */
|
||||
/* The FreeType position independent code services (body). */
|
||||
/* */
|
||||
/* Copyright 2009-2018 by */
|
||||
/* Oran Agra and Mickey Gabel. */
|
||||
/* */
|
||||
/* 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_FREETYPE_H
|
||||
#include FT_INTERNAL_OBJECTS_H
|
||||
#include "basepic.h"
|
||||
|
||||
#ifdef FT_CONFIG_OPTION_PIC
|
||||
|
||||
/* documentation is in ftpic.h */
|
||||
|
||||
FT_BASE_DEF( FT_Error )
|
||||
ft_pic_container_init( FT_Library library )
|
||||
{
|
||||
FT_PIC_Container* pic_container = &library->pic_container;
|
||||
FT_Error error;
|
||||
|
||||
|
||||
FT_MEM_SET( pic_container, 0, sizeof ( *pic_container ) );
|
||||
|
||||
error = ft_base_pic_init( library );
|
||||
if ( error )
|
||||
return error;
|
||||
|
||||
return FT_Err_Ok;
|
||||
}
|
||||
|
||||
|
||||
/* Destroy the contents of the container. */
|
||||
FT_BASE_DEF( void )
|
||||
ft_pic_container_destroy( FT_Library library )
|
||||
{
|
||||
ft_base_pic_free( library );
|
||||
}
|
||||
|
||||
#endif /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
|
||||
/* END */
|
||||
285
vendor/FreeType2/src/base/ftpsprop.c
vendored
Normal file
285
vendor/FreeType2/src/base/ftpsprop.c
vendored
Normal file
|
|
@ -0,0 +1,285 @@
|
|||
/***************************************************************************/
|
||||
/* */
|
||||
/* ftpsprop.c */
|
||||
/* */
|
||||
/* Get and set properties of PostScript drivers (body). */
|
||||
/* See `ftdriver.h' for available properties. */
|
||||
/* */
|
||||
/* Copyright 2017-2018 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_DRIVER_H
|
||||
#include FT_INTERNAL_DEBUG_H
|
||||
#include FT_INTERNAL_POSTSCRIPT_AUX_H
|
||||
#include FT_INTERNAL_OBJECTS_H
|
||||
#include FT_INTERNAL_POSTSCRIPT_PROPS_H
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* 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_psprops
|
||||
|
||||
|
||||
FT_BASE_CALLBACK_DEF( FT_Error )
|
||||
ps_property_set( FT_Module module, /* PS_Driver */
|
||||
const char* property_name,
|
||||
const void* value,
|
||||
FT_Bool value_is_string )
|
||||
{
|
||||
FT_Error error = FT_Err_Ok;
|
||||
PS_Driver driver = (PS_Driver)module;
|
||||
|
||||
#ifndef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
|
||||
FT_UNUSED( value_is_string );
|
||||
#endif
|
||||
|
||||
|
||||
if ( !ft_strcmp( property_name, "darkening-parameters" ) )
|
||||
{
|
||||
FT_Int* darken_params;
|
||||
FT_Int x1, y1, x2, y2, x3, y3, x4, y4;
|
||||
|
||||
#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
|
||||
FT_Int dp[8];
|
||||
|
||||
|
||||
if ( value_is_string )
|
||||
{
|
||||
const char* s = (const char*)value;
|
||||
char* ep;
|
||||
int i;
|
||||
|
||||
|
||||
/* eight comma-separated numbers */
|
||||
for ( i = 0; i < 7; i++ )
|
||||
{
|
||||
dp[i] = (FT_Int)ft_strtol( s, &ep, 10 );
|
||||
if ( *ep != ',' || s == ep )
|
||||
return FT_THROW( Invalid_Argument );
|
||||
|
||||
s = ep + 1;
|
||||
}
|
||||
|
||||
dp[7] = (FT_Int)ft_strtol( s, &ep, 10 );
|
||||
if ( !( *ep == '\0' || *ep == ' ' ) || s == ep )
|
||||
return FT_THROW( Invalid_Argument );
|
||||
|
||||
darken_params = dp;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
darken_params = (FT_Int*)value;
|
||||
|
||||
x1 = darken_params[0];
|
||||
y1 = darken_params[1];
|
||||
x2 = darken_params[2];
|
||||
y2 = darken_params[3];
|
||||
x3 = darken_params[4];
|
||||
y3 = darken_params[5];
|
||||
x4 = darken_params[6];
|
||||
y4 = darken_params[7];
|
||||
|
||||
if ( x1 < 0 || x2 < 0 || x3 < 0 || x4 < 0 ||
|
||||
y1 < 0 || y2 < 0 || y3 < 0 || y4 < 0 ||
|
||||
x1 > x2 || x2 > x3 || x3 > x4 ||
|
||||
y1 > 500 || y2 > 500 || y3 > 500 || y4 > 500 )
|
||||
return FT_THROW( Invalid_Argument );
|
||||
|
||||
driver->darken_params[0] = x1;
|
||||
driver->darken_params[1] = y1;
|
||||
driver->darken_params[2] = x2;
|
||||
driver->darken_params[3] = y2;
|
||||
driver->darken_params[4] = x3;
|
||||
driver->darken_params[5] = y3;
|
||||
driver->darken_params[6] = x4;
|
||||
driver->darken_params[7] = y4;
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
else if ( !ft_strcmp( property_name, "hinting-engine" ) )
|
||||
{
|
||||
#if defined( CFF_CONFIG_OPTION_OLD_ENGINE ) || \
|
||||
defined( T1_CONFIG_OPTION_OLD_ENGINE )
|
||||
const char* module_name = module->clazz->module_name;
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
|
||||
if ( value_is_string )
|
||||
{
|
||||
const char* s = (const char*)value;
|
||||
|
||||
|
||||
if ( !ft_strcmp( s, "adobe" ) )
|
||||
driver->hinting_engine = FT_HINTING_ADOBE;
|
||||
|
||||
#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
|
||||
else if ( !ft_strcmp( module_name, "cff" ) &&
|
||||
!ft_strcmp( s, "freetype" ) )
|
||||
driver->hinting_engine = FT_HINTING_FREETYPE;
|
||||
#endif
|
||||
|
||||
#ifdef T1_CONFIG_OPTION_OLD_ENGINE
|
||||
else if ( ( !ft_strcmp( module_name, "type1" ) ||
|
||||
!ft_strcmp( module_name, "t1cid" ) ) &&
|
||||
!ft_strcmp( s, "freetype" ) )
|
||||
driver->hinting_engine = FT_HINTING_FREETYPE;
|
||||
#endif
|
||||
|
||||
else
|
||||
return FT_THROW( Invalid_Argument );
|
||||
}
|
||||
else
|
||||
#endif /* FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES */
|
||||
{
|
||||
FT_UInt* hinting_engine = (FT_UInt*)value;
|
||||
|
||||
|
||||
if ( *hinting_engine == FT_HINTING_ADOBE
|
||||
#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
|
||||
|| ( *hinting_engine == FT_HINTING_FREETYPE &&
|
||||
!ft_strcmp( module_name, "cff" ) )
|
||||
#endif
|
||||
#ifdef T1_CONFIG_OPTION_OLD_ENGINE
|
||||
|| ( *hinting_engine == FT_HINTING_FREETYPE &&
|
||||
( !ft_strcmp( module_name, "type1" ) ||
|
||||
!ft_strcmp( module_name, "t1cid" ) ) )
|
||||
#endif
|
||||
)
|
||||
driver->hinting_engine = *hinting_engine;
|
||||
else
|
||||
error = FT_ERR( Unimplemented_Feature );
|
||||
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
else if ( !ft_strcmp( property_name, "no-stem-darkening" ) )
|
||||
{
|
||||
#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
|
||||
if ( value_is_string )
|
||||
{
|
||||
const char* s = (const char*)value;
|
||||
long nsd = ft_strtol( s, NULL, 10 );
|
||||
|
||||
|
||||
if ( !nsd )
|
||||
driver->no_stem_darkening = FALSE;
|
||||
else
|
||||
driver->no_stem_darkening = TRUE;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
FT_Bool* no_stem_darkening = (FT_Bool*)value;
|
||||
|
||||
|
||||
driver->no_stem_darkening = *no_stem_darkening;
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
else if ( !ft_strcmp( property_name, "random-seed" ) )
|
||||
{
|
||||
FT_Int32 random_seed;
|
||||
|
||||
|
||||
#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
|
||||
if ( value_is_string )
|
||||
{
|
||||
const char* s = (const char*)value;
|
||||
|
||||
|
||||
random_seed = (FT_Int32)ft_strtol( s, NULL, 10 );
|
||||
}
|
||||
else
|
||||
#endif
|
||||
random_seed = *(FT_Int32*)value;
|
||||
|
||||
if ( random_seed < 0 )
|
||||
random_seed = 0;
|
||||
|
||||
driver->random_seed = random_seed;
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
FT_TRACE0(( "ps_property_set: missing property `%s'\n",
|
||||
property_name ));
|
||||
return FT_THROW( Missing_Property );
|
||||
}
|
||||
|
||||
|
||||
FT_BASE_CALLBACK_DEF( FT_Error )
|
||||
ps_property_get( FT_Module module, /* PS_Driver */
|
||||
const char* property_name,
|
||||
void* value )
|
||||
{
|
||||
FT_Error error = FT_Err_Ok;
|
||||
PS_Driver driver = (PS_Driver)module;
|
||||
|
||||
|
||||
if ( !ft_strcmp( property_name, "darkening-parameters" ) )
|
||||
{
|
||||
FT_Int* darken_params = driver->darken_params;
|
||||
FT_Int* val = (FT_Int*)value;
|
||||
|
||||
|
||||
val[0] = darken_params[0];
|
||||
val[1] = darken_params[1];
|
||||
val[2] = darken_params[2];
|
||||
val[3] = darken_params[3];
|
||||
val[4] = darken_params[4];
|
||||
val[5] = darken_params[5];
|
||||
val[6] = darken_params[6];
|
||||
val[7] = darken_params[7];
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
else if ( !ft_strcmp( property_name, "hinting-engine" ) )
|
||||
{
|
||||
FT_UInt hinting_engine = driver->hinting_engine;
|
||||
FT_UInt* val = (FT_UInt*)value;
|
||||
|
||||
|
||||
*val = hinting_engine;
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
else if ( !ft_strcmp( property_name, "no-stem-darkening" ) )
|
||||
{
|
||||
FT_Bool no_stem_darkening = driver->no_stem_darkening;
|
||||
FT_Bool* val = (FT_Bool*)value;
|
||||
|
||||
|
||||
*val = no_stem_darkening;
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
FT_TRACE0(( "ps_property_get: missing property `%s'\n",
|
||||
property_name ));
|
||||
return FT_THROW( Missing_Property );
|
||||
}
|
||||
|
||||
|
||||
/* END */
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue