mirror of
https://github.com/reactos/reactos.git
synced 2025-02-25 01:39:30 +00:00
[FREETYPE] Update to v2.6.2. CORE-10614
svn path=/trunk/; revision=70225
This commit is contained in:
parent
98fc88e3d5
commit
72b880c604
84 changed files with 3359 additions and 5834 deletions
2
reactos/lib/3rdparty/freetype/CMakeLists.txt
vendored
2
reactos/lib/3rdparty/freetype/CMakeLists.txt
vendored
|
@ -58,4 +58,4 @@ list(APPEND SOURCE
|
|||
src/type42/type42.c
|
||||
src/winfonts/winfnt.c)
|
||||
|
||||
add_library(freetype ${SOURCE})
|
||||
add_library(freetype ${SOURCE})
|
5996
reactos/lib/3rdparty/freetype/ChangeLog
vendored
5996
reactos/lib/3rdparty/freetype/ChangeLog
vendored
File diff suppressed because it is too large
Load diff
8
reactos/lib/3rdparty/freetype/README
vendored
8
reactos/lib/3rdparty/freetype/README
vendored
|
@ -1,4 +1,4 @@
|
|||
FreeType 2.6.1
|
||||
FreeType 2.6.2
|
||||
==============
|
||||
|
||||
Homepage: http://www.freetype.org
|
||||
|
@ -24,9 +24,9 @@
|
|||
|
||||
and download one of the following files.
|
||||
|
||||
freetype-doc-2.6.1.tar.bz2
|
||||
freetype-doc-2.6.1.tar.gz
|
||||
ftdoc261.zip
|
||||
freetype-doc-2.6.2.tar.bz2
|
||||
freetype-doc-2.6.2.tar.gz
|
||||
ftdoc262.zip
|
||||
|
||||
To view the documentation online, go to
|
||||
|
||||
|
|
40
reactos/lib/3rdparty/freetype/devel/ftoption.h
vendored
40
reactos/lib/3rdparty/freetype/devel/ftoption.h
vendored
|
@ -203,6 +203,17 @@ FT_BEGIN_HEADER
|
|||
#define FT_CONFIG_OPTION_USE_BZIP2
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* Define to disable the use of file stream functions and types, FILE, */
|
||||
/* fopen() etc. Enables the use of smaller system libraries on embedded */
|
||||
/* systems that have multiple system libraries, some with or without */
|
||||
/* file stream support, in the cases where file stream support is not */
|
||||
/* necessary such as memory loading of font files. */
|
||||
/* */
|
||||
/* #define FT_CONFIG_OPTION_DISABLE_STREAM_SUPPORT */
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* PNG bitmap support. */
|
||||
|
@ -230,17 +241,6 @@ FT_BEGIN_HEADER
|
|||
#define FT_CONFIG_OPTION_USE_HARFBUZZ
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* Define to disable the use of file stream functions and types, FILE, */
|
||||
/* fopen() etc. Enables the use of smaller system libraries on embedded */
|
||||
/* systems that have multiple system libraries, some with or without */
|
||||
/* file stream support, in the cases where file stream support is not */
|
||||
/* necessary such as memory loading of font files. */
|
||||
/* */
|
||||
/* #define FT_CONFIG_OPTION_DISABLE_STREAM_SUPPORT */
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* DLL export compilation */
|
||||
|
@ -692,6 +692,24 @@ FT_BEGIN_HEADER
|
|||
#define TT_CONFIG_OPTION_BDF
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* Option TT_CONFIG_OPTION_MAX_RUNNABLE_OPCODES controls the maximum */
|
||||
/* number of bytecode instructions executed for a single run of the */
|
||||
/* bytecode interpreter, needed to prevent infinite loops. You don't */
|
||||
/* want to change this except for very special situations (e.g., making */
|
||||
/* a library fuzzer spend less time to handle broken fonts). */
|
||||
/* */
|
||||
/* It is not expected that this value is ever modified by a configuring */
|
||||
/* script; instead, it gets surrounded with #ifndef ... #endif so that */
|
||||
/* the value can be set as a preprocessor option on the compiler's */
|
||||
/* command line. */
|
||||
/* */
|
||||
#ifndef TT_CONFIG_OPTION_MAX_RUNNABLE_OPCODES
|
||||
#define TT_CONFIG_OPTION_MAX_RUNNABLE_OPCODES 1000000L
|
||||
#endif
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/**** ****/
|
||||
|
|
|
@ -692,6 +692,24 @@ FT_BEGIN_HEADER
|
|||
#define TT_CONFIG_OPTION_BDF
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* Option TT_CONFIG_OPTION_MAX_RUNNABLE_OPCODES controls the maximum */
|
||||
/* number of bytecode instructions executed for a single run of the */
|
||||
/* bytecode interpreter, needed to prevent infinite loops. You don't */
|
||||
/* want to change this except for very special situations (e.g., making */
|
||||
/* a library fuzzer spend less time to handle broken fonts). */
|
||||
/* */
|
||||
/* It is not expected that this value is ever modified by a configuring */
|
||||
/* script; instead, it gets surrounded with #ifndef ... #endif so that */
|
||||
/* the value can be set as a preprocessor option on the compiler's */
|
||||
/* command line. */
|
||||
/* */
|
||||
#ifndef TT_CONFIG_OPTION_MAX_RUNNABLE_OPCODES
|
||||
#define TT_CONFIG_OPTION_MAX_RUNNABLE_OPCODES 1000000L
|
||||
#endif
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/**** ****/
|
||||
|
|
|
@ -2821,9 +2821,6 @@ FT_BEGIN_HEADER
|
|||
* have specified (e.g., the TrueType bytecode interpreter). You can set
|
||||
* @FT_LOAD_FORCE_AUTOHINT to ensure that the auto-hinter is used.
|
||||
*
|
||||
* Also note that @FT_LOAD_TARGET_LIGHT is an exception, in that it
|
||||
* always implies @FT_LOAD_FORCE_AUTOHINT.
|
||||
*
|
||||
* @values:
|
||||
* FT_LOAD_TARGET_NORMAL ::
|
||||
* This corresponds to the default hinting algorithm, optimized for
|
||||
|
@ -2831,11 +2828,14 @@ FT_BEGIN_HEADER
|
|||
* @FT_LOAD_TARGET_MONO instead.
|
||||
*
|
||||
* FT_LOAD_TARGET_LIGHT ::
|
||||
* A lighter hinting algorithm for non-monochrome modes. Many
|
||||
* generated glyphs are more fuzzy but better resemble its original
|
||||
* shape. A bit like rendering on Mac OS~X.
|
||||
*
|
||||
* As a special exception, this target implies @FT_LOAD_FORCE_AUTOHINT.
|
||||
* A lighter hinting algorithm for gray-level modes. Many generated
|
||||
* glyphs are fuzzier but better resemble their original shape. This
|
||||
* is achieved by snapping glyphs to the pixel grid only vertically
|
||||
* (Y-axis), as is done by Microsoft's ClearType and Adobe's
|
||||
* proprietary font renderer. This preserves inter-glyph spacing in
|
||||
* horizontal text. The snapping is done either by the native font
|
||||
* driver if the driver itself and the font support it or by the
|
||||
* auto-hinter.
|
||||
*
|
||||
* FT_LOAD_TARGET_MONO ::
|
||||
* Strong hinting algorithm that should only be used for monochrome
|
||||
|
@ -2942,7 +2942,10 @@ FT_BEGIN_HEADER
|
|||
/* field in the @FT_GlyphSlotRec structure gives the format of the */
|
||||
/* returned bitmap. */
|
||||
/* */
|
||||
/* All modes except @FT_RENDER_MODE_MONO use 256 levels of opacity. */
|
||||
/* All modes except @FT_RENDER_MODE_MONO use 256 levels of opacity, */
|
||||
/* indicating pixel coverage. Use linear alpha blending and gamma */
|
||||
/* correction to correctly render non-monochrome glyph bitmaps onto a */
|
||||
/* surface; see @FT_Render_Glyph. */
|
||||
/* */
|
||||
/* <Values> */
|
||||
/* FT_RENDER_MODE_NORMAL :: */
|
||||
|
@ -3012,6 +3015,83 @@ FT_BEGIN_HEADER
|
|||
/* the glyph image format, finding the relevant renderer, and */
|
||||
/* invoking it. */
|
||||
/* */
|
||||
/* When FreeType outputs a bitmap of a glyph, it really outputs an */
|
||||
/* alpha coverage map. If a pixel is completely covered by a */
|
||||
/* filled-in outline, the bitmap contains 0xFF at that pixel, meaning */
|
||||
/* that 0xFF/0xFF fraction of that pixel is covered, meaning the */
|
||||
/* pixel is 100% black (or 0% bright). If a pixel is only 50% */
|
||||
/* covered (value 0x80), the pixel is made 50% black (50% bright or a */
|
||||
/* middle shade of grey). 0% covered means 0% black (100% bright or */
|
||||
/* white). */
|
||||
/* */
|
||||
/* On high-DPI screens like on smartphones and tablets, the pixels */
|
||||
/* are so small that their chance of being completely covered and */
|
||||
/* therefore completely black are fairly good. On the low-DPI */
|
||||
/* screens, however, the situation is different. The pixels are too */
|
||||
/* large for most of the details of a glyph and shades of gray are */
|
||||
/* the norm rather than the exception. */
|
||||
/* */
|
||||
/* This is relevant because all our screens have a second problem: */
|
||||
/* they are not linear. 1~+~1 is not~2. Twice the value does not */
|
||||
/* result in twice the brightness. When a pixel is only 50% covered, */
|
||||
/* the coverage map says 50% black, and this translates to a pixel */
|
||||
/* value of 128 when you use 8~bits per channel (0-255). However, */
|
||||
/* this does not translate to 50% brightness for that pixel on our */
|
||||
/* sRGB and gamma~2.2 screens. Due to their non-linearity, they */
|
||||
/* dwell longer in the darks and only a pixel value of about 186 */
|
||||
/* results in 50% brightness – 128 ends up too dark on both bright */
|
||||
/* and dark backgrounds. The net result is that dark text looks */
|
||||
/* burnt-out, pixely and blotchy on bright background, bright text */
|
||||
/* too frail on dark backgrounds, and colored text on colored */
|
||||
/* background (for example, red on green) seems to have dark halos or */
|
||||
/* `dirt' around it. The situation is especially ugly for diagonal */
|
||||
/* stems like in `w' glyph shapes where the quality of FreeType's */
|
||||
/* anti-aliasing depends on the correct display of grays. On */
|
||||
/* high-DPI screens where smaller, fully black pixels reign supreme, */
|
||||
/* this doesn't matter, but on our low-DPI screens with all the gray */
|
||||
/* shades, it does. 0% and 100% brightness are the same things in */
|
||||
/* linear and non-linear space, just all the shades in-between */
|
||||
/* aren't. */
|
||||
/* */
|
||||
/* The blending function for placing text over a background is */
|
||||
/* */
|
||||
/* { */
|
||||
/* dst = alpha * src + (1 - alpha) * dst , */
|
||||
/* } */
|
||||
/* */
|
||||
/* which is known as the OVER operator. */
|
||||
/* */
|
||||
/* To correctly composite an antialiased pixel of a glyph onto a */
|
||||
/* surface, */
|
||||
/* */
|
||||
/* 1. take the foreground and background colors (e.g., in sRGB space) */
|
||||
/* and apply gamma to get them in a linear space, */
|
||||
/* */
|
||||
/* 2. use OVER to blend the two linear colors using the glyph pixel */
|
||||
/* as the alpha value (remember, the glyph bitmap is an alpha */
|
||||
/* coverage bitmap), and */
|
||||
/* */
|
||||
/* 3. apply inverse gamma to the blended pixel and write it back to */
|
||||
/* the image. */
|
||||
/* */
|
||||
/* Internal testing at Adobe found that a target inverse gamma of~1.8 */
|
||||
/* for step~3 gives good results across a wide range of displays with */
|
||||
/* an sRGB gamma curve or a similar one. */
|
||||
/* */
|
||||
/* This process can cost performance. There is an approximation that */
|
||||
/* does not need to know about the background color; see */
|
||||
/* https://bel.fi/alankila/lcd/ and */
|
||||
/* https://bel.fi/alankila/lcd/alpcor.html for details. */
|
||||
/* */
|
||||
/* *ATTENTION*: Linear blending is even more important when dealing */
|
||||
/* with subpixel-rendered glyphs to prevent color-fringing! A */
|
||||
/* subpixel-rendered glyph must first be filtered with a filter that */
|
||||
/* gives equal weight to the three color primaries and does not */
|
||||
/* exceed a sum of 0x100, see section @lcd_filtering. Then the */
|
||||
/* only difference to gray linear blending is that subpixel-rendered */
|
||||
/* linear blending is done 3~times per pixel: red foreground subpixel */
|
||||
/* to red background subpixel and so on for green and blue. */
|
||||
/* */
|
||||
/* <InOut> */
|
||||
/* slot :: A handle to the glyph slot containing the image to */
|
||||
/* convert. */
|
||||
|
@ -4093,7 +4173,7 @@ FT_BEGIN_HEADER
|
|||
*/
|
||||
#define FREETYPE_MAJOR 2
|
||||
#define FREETYPE_MINOR 6
|
||||
#define FREETYPE_PATCH 1
|
||||
#define FREETYPE_PATCH 2
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
|
|
|
@ -439,6 +439,59 @@ FT_BEGIN_HEADER
|
|||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* @property:
|
||||
* no-stem-darkening[autofit]
|
||||
*
|
||||
* @description:
|
||||
* *Experimental* *only,* *requires* *linear* *alpha* *blending* *and*
|
||||
* *gamma* *correction*
|
||||
*
|
||||
* Stem darkening emboldens glyphs at smaller sizes to make them more
|
||||
* readable on common low-DPI screens when using linear alpha blending
|
||||
* and gamma correction, see @FT_Render_Glyph. When not using linear
|
||||
* alpha blending and gamma correction, glyphs will appear heavy and
|
||||
* fuzzy!
|
||||
*
|
||||
* Gamma correction essentially lightens fonts since shades of grey are
|
||||
* shifted to higher pixel values (=~higher brightness) to match the
|
||||
* original intention to the reality of our screens. The side-effect is
|
||||
* that glyphs `thin out'. Mac OS~X and Adobe's proprietary font
|
||||
* rendering library implement a counter-measure: stem darkening at
|
||||
* smaller sizes where shades of gray dominate. By emboldening a glyph
|
||||
* slightly in relation to its pixel size, individual pixels get higher
|
||||
* coverage of filled-in outlines and are therefore `blacker'. This
|
||||
* counteracts the `thinning out' of glyphs, making text remain readable
|
||||
* at smaller sizes. All glyphs that pass through the auto-hinter will
|
||||
* be emboldened unless this property is set to TRUE.
|
||||
*
|
||||
* See the description of the CFF driver for algorithmic details. Total
|
||||
* consistency with the CFF driver is currently not achieved because the
|
||||
* emboldening method differs and glyphs must be scaled down on the
|
||||
* Y-axis to keep outline points inside their precomputed blue zones.
|
||||
* The smaller the size (especially 9ppem and down), the higher the loss
|
||||
* of emboldening versus the CFF driver.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* @property:
|
||||
* darkening-parameters[autofit]
|
||||
*
|
||||
* @description:
|
||||
* *Experimental* *only*
|
||||
*
|
||||
* See the description of the CFF driver for details. This
|
||||
* implementation appropriates the
|
||||
* CFF_CONFIG_OPTION_DARKENING_PARAMETER_* #defines for consistency.
|
||||
* Note the differences described in @no-stem-darkening[autofit].
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/* */
|
||||
|
||||
|
||||
|
|
|
@ -111,8 +111,8 @@ FT_BEGIN_HEADER
|
|||
*
|
||||
* @order:
|
||||
* hinting-engine
|
||||
* no-stem-darkening
|
||||
* darkening-parameters
|
||||
* no-stem-darkening[cff]
|
||||
* darkening-parameters[cff]
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -175,7 +175,7 @@ FT_BEGIN_HEADER
|
|||
/**************************************************************************
|
||||
*
|
||||
* @property:
|
||||
* no-stem-darkening
|
||||
* no-stem-darkening[cff]
|
||||
*
|
||||
* @description:
|
||||
* By default, the Adobe CFF engine darkens stems at smaller sizes,
|
||||
|
@ -205,7 +205,7 @@ FT_BEGIN_HEADER
|
|||
/**************************************************************************
|
||||
*
|
||||
* @property:
|
||||
* darkening-parameters
|
||||
* darkening-parameters[cff]
|
||||
*
|
||||
* @description:
|
||||
* By default, the Adobe CFF engine darkens stems as follows (if the
|
||||
|
|
|
@ -243,7 +243,7 @@
|
|||
FT_ERRORDEF_( No_Unicode_Glyph_Name, 0xA3,
|
||||
"no Unicode glyph name found" )
|
||||
FT_ERRORDEF_( Glyph_Too_Big, 0xA4,
|
||||
"glyph to big for hinting" )
|
||||
"glyph too big for hinting" )
|
||||
|
||||
/* BDF errors */
|
||||
|
||||
|
|
|
@ -41,56 +41,78 @@ FT_BEGIN_HEADER
|
|||
* LCD Filtering
|
||||
*
|
||||
* @abstract:
|
||||
* Reduce color fringes of LCD-optimized bitmaps.
|
||||
* Reduce color fringes of subpixel-rendered bitmaps.
|
||||
*
|
||||
* @description:
|
||||
* The @FT_Library_SetLcdFilter API can be used to specify a low-pass
|
||||
* filter, which is then applied to LCD-optimized bitmaps generated
|
||||
* through @FT_Render_Glyph. This is useful to reduce color fringes
|
||||
* that would occur with unfiltered rendering.
|
||||
* Subpixel rendering exploits the color-striped structure of LCD
|
||||
* pixels, increasing the available resolution in the direction of the
|
||||
* stripe (usually horizontal RGB) by a factor of~3. Since these
|
||||
* subpixels are color pixels, using them unfiltered creates severe
|
||||
* color fringes. Use the @FT_Library_SetLcdFilter API to specify a
|
||||
* low-pass filter, which is then applied to subpixel-rendered bitmaps
|
||||
* generated through @FT_Render_Glyph. The filter sacrifices some of
|
||||
* the higher resolution to reduce color fringes, making the glyph image
|
||||
* slightly blurrier. Positional improvements will remain.
|
||||
*
|
||||
* Note that no filter is active by default, and that this function is
|
||||
* *not* implemented in default builds of the library. You need to
|
||||
* #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING in your `ftoption.h' file
|
||||
* in order to activate it.
|
||||
*
|
||||
* FreeType generates alpha coverage maps, which are linear by nature.
|
||||
* For instance, the value 0x80 in bitmap representation means that
|
||||
* (within numerical precision) 0x80/0xFF fraction of that pixel is
|
||||
* covered by the glyph's outline. The blending function for placing
|
||||
* text over a background is
|
||||
* A filter should have two properties:
|
||||
*
|
||||
* {
|
||||
* dst = alpha * src + (1 - alpha) * dst ,
|
||||
* }
|
||||
* 1) It should be normalized, meaning the sum of the 5~components
|
||||
* should be 256 (0x100). It is possible to go above or under this
|
||||
* target sum, however: going under means tossing out contrast, going
|
||||
* over means invoking clamping and thereby non-linearities that
|
||||
* increase contrast somewhat at the expense of greater distortion
|
||||
* and color-fringing. Contrast is better enhanced through stem
|
||||
* darkening.
|
||||
*
|
||||
* which is known as OVER. However, when calculating the output of the
|
||||
* OVER operator, the source colors should first be transformed to a
|
||||
* linear color space, then alpha blended in that space, and transformed
|
||||
* back to the output color space.
|
||||
* 2) It should be color-balanced, meaning a filter `{~a, b, c, b, a~}'
|
||||
* where a~+ b~=~c. It distributes the computed coverage for one
|
||||
* subpixel to all subpixels equally, sacrificing some won resolution
|
||||
* but drastically reducing color-fringing. Positioning improvements
|
||||
* remain! Note that color-fringing can only really be minimized
|
||||
* when using a color-balanced filter and alpha-blending the glyph
|
||||
* onto a surface in linear space; see @FT_Render_Glyph.
|
||||
*
|
||||
* When linear light blending is used, the default FIR5 filtering
|
||||
* weights (as given by FT_LCD_FILTER_DEFAULT) are no longer optimal, as
|
||||
* they have been designed for black on white rendering while lacking
|
||||
* gamma correction. To preserve color neutrality, weights for a FIR5
|
||||
* filter should be chosen according to two free parameters `a' and `c',
|
||||
* and the FIR weights should be
|
||||
* Regarding the form, a filter can be a `boxy' filter or a `beveled'
|
||||
* filter. Boxy filters are sharper but are less forgiving of non-ideal
|
||||
* gamma curves of a screen (viewing angles!), beveled filters are
|
||||
* fuzzier but more tolerant.
|
||||
*
|
||||
* {
|
||||
* [a - c, a + c, 2 * a, a + c, a - c] .
|
||||
* }
|
||||
* Examples:
|
||||
*
|
||||
* This formula generates equal weights for all the color primaries
|
||||
* across the filter kernel, which makes it colorless. One suggested
|
||||
* set of weights is
|
||||
* - [0x10 0x40 0x70 0x40 0x10] is beveled and neither balanced nor
|
||||
* normalized.
|
||||
*
|
||||
* {
|
||||
* [0x10, 0x50, 0x60, 0x50, 0x10] ,
|
||||
* }
|
||||
* - [0x1A 0x33 0x4D 0x33 0x1A] is beveled and balanced but not
|
||||
* normalized.
|
||||
*
|
||||
* where `a' has value 0x30 and `b' value 0x20. The weights in filter
|
||||
* may have a sum larger than 0x100, which increases coloration slightly
|
||||
* but also improves contrast.
|
||||
* - [0x19 0x33 0x66 0x4c 0x19] is beveled and normalized but not
|
||||
* balanced.
|
||||
*
|
||||
* - [0x00 0x4c 0x66 0x4c 0x00] is boxily beveled and normalized but not
|
||||
* balanced.
|
||||
*
|
||||
* - [0x00 0x55 0x56 0x55 0x00] is boxy, normalized, and almost
|
||||
* balanced.
|
||||
*
|
||||
* - [0x08 0x4D 0x56 0x4D 0x08] is beveled, normalized and, almost
|
||||
* balanced.
|
||||
*
|
||||
* It is important to understand that linear alpha blending and gamma
|
||||
* correction is critical for correctly rendering glyphs onto surfaces
|
||||
* without artifacts and even more critical when subpixel rendering is
|
||||
* involved.
|
||||
*
|
||||
* Each of the 3~alpha values (subpixels) is independently used to blend
|
||||
* one color channel. That is, red alpha blends the red channel of the
|
||||
* text color with the red channel of the background pixel. The
|
||||
* distribution of density values by the color-balanced filter assumes
|
||||
* alpha blending is done in linear space; only then color artifacts
|
||||
* cancel out.
|
||||
*/
|
||||
|
||||
|
||||
|
@ -111,10 +133,21 @@ FT_BEGIN_HEADER
|
|||
* The default filter reduces color fringes considerably, at the cost
|
||||
* of a slight blurriness in the output.
|
||||
*
|
||||
* It is a beveled, normalized, and color-balanced five-tap filter
|
||||
* that is more forgiving to screens with non-ideal gamma curves and
|
||||
* viewing angles. Note that while color-fringing is reduced, it can
|
||||
* only be minimized by using linear alpha blending and gamma
|
||||
* correction to render glyphs onto surfaces.
|
||||
*
|
||||
* FT_LCD_FILTER_LIGHT ::
|
||||
* The light filter is a variant that produces less blurriness at the
|
||||
* cost of slightly more color fringes than the default one. It might
|
||||
* be better, depending on taste, your monitor, or your personal vision.
|
||||
* The light filter is a variant that is sharper at the cost of
|
||||
* slightly more color fringes than the default one.
|
||||
*
|
||||
* It is a boxy, normalized, and color-balanced three-tap filter that
|
||||
* is less forgiving to screens with non-ideal gamma curves and
|
||||
* viewing angles. This filter works best when the rendering system
|
||||
* uses linear alpha blending and gamma correction to render glyphs
|
||||
* onto surfaces.
|
||||
*
|
||||
* FT_LCD_FILTER_LEGACY ::
|
||||
* This filter corresponds to the original libXft color filter. It
|
||||
|
@ -126,14 +159,23 @@ FT_BEGIN_HEADER
|
|||
* This filter is only provided for comparison purposes, and might be
|
||||
* disabled or stay unsupported in the future.
|
||||
*
|
||||
* FT_LCD_FILTER_LEGACY1 ::
|
||||
* For historical reasons, the FontConfig library returns a different
|
||||
* enumeration value for legacy LCD filtering. To make code work that
|
||||
* (incorrectly) forwards FontConfig's enumeration value to
|
||||
* @FT_Library_SetLcdFilter without proper mapping, it is thus easiest
|
||||
* to have another enumeration value, which is completely equal to
|
||||
* `FT_LCD_FILTER_LEGACY'.
|
||||
*
|
||||
* @since:
|
||||
* 2.3.0
|
||||
* 2.3.0 (`FT_LCD_FILTER_LEGACY1' since 2.6.2)
|
||||
*/
|
||||
typedef enum FT_LcdFilter_
|
||||
{
|
||||
FT_LCD_FILTER_NONE = 0,
|
||||
FT_LCD_FILTER_DEFAULT = 1,
|
||||
FT_LCD_FILTER_LIGHT = 2,
|
||||
FT_LCD_FILTER_LEGACY1 = 3,
|
||||
FT_LCD_FILTER_LEGACY = 16,
|
||||
|
||||
FT_LCD_FILTER_MAX /* do not remove */
|
||||
|
|
|
@ -203,9 +203,13 @@ FT_BEGIN_HEADER
|
|||
/* */
|
||||
/* axis :: An axis descriptor table. */
|
||||
/* GX fonts contain slightly more data than MM. */
|
||||
/* Memory management of this pointer is done */
|
||||
/* internally by FreeType. */
|
||||
/* */
|
||||
/* namedstyle :: A named style table. */
|
||||
/* Only meaningful with GX. */
|
||||
/* Memory management of this pointer is done */
|
||||
/* internally by FreeType. */
|
||||
/* */
|
||||
typedef struct FT_MM_Var_
|
||||
{
|
||||
|
@ -255,7 +259,8 @@ FT_BEGIN_HEADER
|
|||
/* */
|
||||
/* <Output> */
|
||||
/* amaster :: The Multiple Masters/GX var descriptor. */
|
||||
/* Allocates a data structure, which the user must free. */
|
||||
/* Allocates a data structure, which the user must */
|
||||
/* deallocate with `free' after use. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* FreeType error code. 0~means success. */
|
||||
|
|
|
@ -111,12 +111,14 @@ FT_BEGIN_HEADER
|
|||
#define FT_MODULE_HINTER 4 /* this module is a glyph hinter */
|
||||
#define FT_MODULE_STYLER 8 /* this module is a styler */
|
||||
|
||||
#define FT_MODULE_DRIVER_SCALABLE 0x100 /* the driver supports */
|
||||
#define FT_MODULE_DRIVER_SCALABLE 0x100 /* the driver supports */
|
||||
/* scalable fonts */
|
||||
#define FT_MODULE_DRIVER_NO_OUTLINES 0x200 /* the driver does not */
|
||||
#define FT_MODULE_DRIVER_NO_OUTLINES 0x200 /* the driver does not */
|
||||
/* support vector outlines */
|
||||
#define FT_MODULE_DRIVER_HAS_HINTER 0x400 /* the driver provides its */
|
||||
#define FT_MODULE_DRIVER_HAS_HINTER 0x400 /* the driver provides its */
|
||||
/* own hinter */
|
||||
#define FT_MODULE_DRIVER_HINTS_LIGHTLY 0x800 /* the driver's hinter */
|
||||
/* produces LIGHT hints */
|
||||
|
||||
|
||||
/* deprecated values */
|
||||
|
@ -125,9 +127,10 @@ FT_BEGIN_HEADER
|
|||
#define ft_module_hinter FT_MODULE_HINTER
|
||||
#define ft_module_styler FT_MODULE_STYLER
|
||||
|
||||
#define ft_module_driver_scalable FT_MODULE_DRIVER_SCALABLE
|
||||
#define ft_module_driver_no_outlines FT_MODULE_DRIVER_NO_OUTLINES
|
||||
#define ft_module_driver_has_hinter FT_MODULE_DRIVER_HAS_HINTER
|
||||
#define ft_module_driver_scalable FT_MODULE_DRIVER_SCALABLE
|
||||
#define ft_module_driver_no_outlines FT_MODULE_DRIVER_NO_OUTLINES
|
||||
#define ft_module_driver_has_hinter FT_MODULE_DRIVER_HAS_HINTER
|
||||
#define ft_module_driver_hints_lightly FT_MODULE_DRIVER_HINTS_LIGHTLY
|
||||
|
||||
|
||||
typedef FT_Pointer FT_Module_Interface;
|
||||
|
|
|
@ -47,7 +47,7 @@ FT_BEGIN_HEADER
|
|||
FT_MulFix_arm( FT_Int32 a,
|
||||
FT_Int32 b )
|
||||
{
|
||||
register FT_Int32 t, t2;
|
||||
FT_Int32 t, t2;
|
||||
|
||||
|
||||
__asm
|
||||
|
@ -80,7 +80,7 @@ FT_BEGIN_HEADER
|
|||
FT_MulFix_arm( FT_Int32 a,
|
||||
FT_Int32 b )
|
||||
{
|
||||
register FT_Int32 t, t2;
|
||||
FT_Int32 t, t2;
|
||||
|
||||
|
||||
__asm__ __volatile__ (
|
||||
|
@ -116,7 +116,7 @@ FT_BEGIN_HEADER
|
|||
FT_MulFix_i386( FT_Int32 a,
|
||||
FT_Int32 b )
|
||||
{
|
||||
register FT_Int32 result;
|
||||
FT_Int32 result;
|
||||
|
||||
|
||||
__asm__ __volatile__ (
|
||||
|
@ -152,7 +152,7 @@ FT_BEGIN_HEADER
|
|||
FT_MulFix_i386( FT_Int32 a,
|
||||
FT_Int32 b )
|
||||
{
|
||||
register FT_Int32 result;
|
||||
FT_Int32 result;
|
||||
|
||||
__asm
|
||||
{
|
||||
|
|
|
@ -506,6 +506,9 @@ FT_BEGIN_HEADER
|
|||
#define FT_DRIVER_HAS_HINTER( x ) ( FT_MODULE_CLASS( x )->module_flags & \
|
||||
FT_MODULE_DRIVER_HAS_HINTER )
|
||||
|
||||
#define FT_DRIVER_HINTS_LIGHTLY( x ) ( FT_MODULE_CLASS( x )->module_flags & \
|
||||
FT_MODULE_DRIVER_HINTS_LIGHTLY )
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
|
|
|
@ -1515,6 +1515,9 @@ FT_BEGIN_HEADER
|
|||
FT_Byte* cursor;
|
||||
FT_Byte* limit;
|
||||
|
||||
/* since version 2.6.2 */
|
||||
FT_ListRec composites;
|
||||
|
||||
} TT_LoaderRec;
|
||||
|
||||
|
||||
|
|
|
@ -703,6 +703,22 @@
|
|||
}
|
||||
|
||||
|
||||
/* Extract standard_width from writing system/script specific */
|
||||
/* metrics class. */
|
||||
|
||||
FT_LOCAL_DEF( void )
|
||||
af_cjk_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;
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/***** *****/
|
||||
|
@ -2295,6 +2311,7 @@
|
|||
(AF_WritingSystem_InitMetricsFunc) af_cjk_metrics_init,
|
||||
(AF_WritingSystem_ScaleMetricsFunc)af_cjk_metrics_scale,
|
||||
(AF_WritingSystem_DoneMetricsFunc) NULL,
|
||||
(AF_WritingSystem_GetStdWidthsFunc)af_cjk_get_standard_widths,
|
||||
|
||||
(AF_WritingSystem_InitHintsFunc) af_cjk_hints_init,
|
||||
(AF_WritingSystem_ApplyHintsFunc) af_cjk_hints_apply
|
||||
|
@ -2314,6 +2331,7 @@
|
|||
(AF_WritingSystem_InitMetricsFunc) NULL,
|
||||
(AF_WritingSystem_ScaleMetricsFunc)NULL,
|
||||
(AF_WritingSystem_DoneMetricsFunc) NULL,
|
||||
(AF_WritingSystem_GetStdWidthsFunc)NULL,
|
||||
|
||||
(AF_WritingSystem_InitHintsFunc) NULL,
|
||||
(AF_WritingSystem_ApplyHintsFunc) NULL
|
||||
|
|
|
@ -65,6 +65,7 @@
|
|||
(AF_WritingSystem_InitMetricsFunc) NULL,
|
||||
(AF_WritingSystem_ScaleMetricsFunc)NULL,
|
||||
(AF_WritingSystem_DoneMetricsFunc) NULL,
|
||||
(AF_WritingSystem_GetStdWidthsFunc)NULL,
|
||||
|
||||
(AF_WritingSystem_InitHintsFunc) af_dummy_hints_init,
|
||||
(AF_WritingSystem_ApplyHintsFunc) af_dummy_hints_apply
|
||||
|
|
|
@ -350,11 +350,17 @@
|
|||
(FT_ULong)face->num_glyphs * sizeof ( FT_UShort ) ) )
|
||||
goto Exit;
|
||||
|
||||
globals->face = face;
|
||||
globals->glyph_count = face->num_glyphs;
|
||||
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->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 );
|
||||
|
@ -406,9 +412,16 @@
|
|||
globals->hb_font = NULL;
|
||||
#endif
|
||||
|
||||
globals->glyph_count = 0;
|
||||
globals->glyph_styles = NULL; /* no need to free this one! */
|
||||
globals->face = NULL;
|
||||
globals->glyph_count = 0;
|
||||
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;
|
||||
/* no need to free this one! */
|
||||
globals->glyph_styles = NULL;
|
||||
globals->face = NULL;
|
||||
|
||||
FT_FREE( globals );
|
||||
}
|
||||
|
|
|
@ -117,6 +117,22 @@ FT_BEGIN_HEADER
|
|||
|
||||
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;
|
||||
|
|
144
reactos/lib/3rdparty/freetype/src/autofit/afhints.c
vendored
144
reactos/lib/3rdparty/freetype/src/autofit/afhints.c
vendored
|
@ -219,6 +219,82 @@
|
|||
#define AF_INDEX_NUM( ptr, base ) (int)( (ptr) ? ( (ptr) - (base) ) : -1 )
|
||||
|
||||
|
||||
static char*
|
||||
af_print_idx( char* p,
|
||||
int idx )
|
||||
{
|
||||
if ( idx == -1 )
|
||||
{
|
||||
p[0] = '-';
|
||||
p[1] = '-';
|
||||
p[2] = '\0';
|
||||
}
|
||||
else
|
||||
ft_sprintf( p, "%d", idx );
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
af_get_segment_index( AF_GlyphHints hints,
|
||||
int point_idx,
|
||||
int dimension )
|
||||
{
|
||||
AF_AxisHints axis = &hints->axis[dimension];
|
||||
AF_Point point = hints->points + point_idx;
|
||||
AF_Segment segments = axis->segments;
|
||||
AF_Segment limit = segments + axis->num_segments;
|
||||
AF_Segment segment;
|
||||
|
||||
|
||||
for ( segment = segments; segment < limit; segment++ )
|
||||
{
|
||||
if ( segment->first <= segment->last )
|
||||
{
|
||||
if ( point >= segment->first && point <= segment->last )
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
AF_Point p = segment->first;
|
||||
|
||||
|
||||
for (;;)
|
||||
{
|
||||
if ( point == p )
|
||||
goto Exit;
|
||||
|
||||
if ( p == segment->last )
|
||||
break;
|
||||
|
||||
p = p->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Exit:
|
||||
if ( segment == limit )
|
||||
return -1;
|
||||
|
||||
return (int)( segment - segments );
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
af_get_edge_index( AF_GlyphHints hints,
|
||||
int segment_idx,
|
||||
int dimension )
|
||||
{
|
||||
AF_AxisHints axis = &hints->axis[dimension];
|
||||
AF_Edge edges = axis->edges;
|
||||
AF_Segment segment = axis->segments + segment_idx;
|
||||
|
||||
|
||||
return segment_idx == -1 ? -1 : AF_INDEX_NUM( segment->edge, edges );
|
||||
}
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@ -234,22 +310,39 @@
|
|||
AF_DUMP(( "Table of points:\n" ));
|
||||
|
||||
if ( hints->num_points )
|
||||
AF_DUMP(( " [ index | xorg | yorg | xscale | yscale"
|
||||
" | xfit | yfit | flags ]\n" ));
|
||||
AF_DUMP(( " index hedge hseg vedge vseg flags"
|
||||
" xorg yorg xscale yscale xfit yfit\n" ));
|
||||
else
|
||||
AF_DUMP(( " (none)\n" ));
|
||||
|
||||
for ( point = points; point < limit; point++ )
|
||||
AF_DUMP(( " [ %5d | %5d | %5d | %6.2f | %6.2f"
|
||||
" | %5.2f | %5.2f | %c ]\n",
|
||||
AF_INDEX_NUM( point, points ),
|
||||
{
|
||||
int point_idx = AF_INDEX_NUM( point, points );
|
||||
int segment_idx_0 = af_get_segment_index( hints, point_idx, 0 );
|
||||
int segment_idx_1 = af_get_segment_index( hints, point_idx, 1 );
|
||||
|
||||
char buf1[16], buf2[16], buf3[16], buf4[16];
|
||||
|
||||
|
||||
AF_DUMP(( " %5d %5s %5s %5s %5s %s "
|
||||
" %5d %5d %7.2f %7.2f %7.2f %7.2f\n",
|
||||
point_idx,
|
||||
af_print_idx( buf1,
|
||||
af_get_edge_index( hints, segment_idx_1, 1 ) ),
|
||||
af_print_idx( buf2, segment_idx_1 ),
|
||||
af_print_idx( buf3,
|
||||
af_get_edge_index( hints, segment_idx_0, 0 ) ),
|
||||
af_print_idx( buf4, segment_idx_0 ),
|
||||
( point->flags & AF_FLAG_WEAK_INTERPOLATION ) ? "weak"
|
||||
: " -- ",
|
||||
|
||||
point->fx,
|
||||
point->fy,
|
||||
point->ox / 64.0,
|
||||
point->oy / 64.0,
|
||||
point->x / 64.0,
|
||||
point->y / 64.0,
|
||||
( point->flags & AF_FLAG_WEAK_INTERPOLATION ) ? 'w' : ' '));
|
||||
point->y / 64.0 ));
|
||||
}
|
||||
AF_DUMP(( "\n" ));
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
|
@ -306,21 +399,23 @@
|
|||
AF_Segment limit = segments + axis->num_segments;
|
||||
AF_Segment seg;
|
||||
|
||||
char buf1[16], buf2[16], buf3[16];
|
||||
|
||||
|
||||
AF_DUMP(( "Table of %s segments:\n",
|
||||
dimension == AF_DIMENSION_HORZ ? "vertical"
|
||||
: "horizontal" ));
|
||||
if ( axis->num_segments )
|
||||
AF_DUMP(( " [ index | pos | dir | from"
|
||||
" | to | link | serif | edge"
|
||||
" | height | extra | flags ]\n" ));
|
||||
AF_DUMP(( " index pos dir from to"
|
||||
" link serif edge"
|
||||
" height extra flags\n" ));
|
||||
else
|
||||
AF_DUMP(( " (none)\n" ));
|
||||
|
||||
for ( seg = segments; seg < limit; seg++ )
|
||||
AF_DUMP(( " [ %5d | %5.2g | %5s | %4d"
|
||||
" | %4d | %4d | %5d | %4d"
|
||||
" | %6d | %5d | %11s ]\n",
|
||||
AF_DUMP(( " %5d %5.2g %5s %4d %4d"
|
||||
" %4s %5s %4s"
|
||||
" %6d %5d %11s\n",
|
||||
AF_INDEX_NUM( seg, segments ),
|
||||
dimension == AF_DIMENSION_HORZ
|
||||
? (int)seg->first->ox / 64.0
|
||||
|
@ -328,9 +423,11 @@
|
|||
af_dir_str( (AF_Direction)seg->dir ),
|
||||
AF_INDEX_NUM( seg->first, points ),
|
||||
AF_INDEX_NUM( seg->last, points ),
|
||||
AF_INDEX_NUM( seg->link, segments ),
|
||||
AF_INDEX_NUM( seg->serif, segments ),
|
||||
AF_INDEX_NUM( seg->edge, edges ),
|
||||
|
||||
af_print_idx( buf1, AF_INDEX_NUM( seg->link, segments ) ),
|
||||
af_print_idx( buf2, AF_INDEX_NUM( seg->serif, segments ) ),
|
||||
af_print_idx( buf3, AF_INDEX_NUM( seg->edge, edges ) ),
|
||||
|
||||
seg->height,
|
||||
seg->height - ( seg->max_coord - seg->min_coord ),
|
||||
af_edge_flags_to_string( seg->flags ) ));
|
||||
|
@ -435,6 +532,8 @@
|
|||
AF_Edge limit = edges + axis->num_edges;
|
||||
AF_Edge edge;
|
||||
|
||||
char buf1[16], buf2[16];
|
||||
|
||||
|
||||
/*
|
||||
* note: AF_DIMENSION_HORZ corresponds to _vertical_ edges
|
||||
|
@ -444,19 +543,20 @@
|
|||
dimension == AF_DIMENSION_HORZ ? "vertical"
|
||||
: "horizontal" ));
|
||||
if ( axis->num_edges )
|
||||
AF_DUMP(( " [ index | pos | dir | link"
|
||||
" | serif | blue | opos | pos | flags ]\n" ));
|
||||
AF_DUMP(( " index pos dir link serif"
|
||||
" blue opos pos flags\n" ));
|
||||
else
|
||||
AF_DUMP(( " (none)\n" ));
|
||||
|
||||
for ( edge = edges; edge < limit; edge++ )
|
||||
AF_DUMP(( " [ %5d | %5.2g | %5s | %4d"
|
||||
" | %5d | %c | %5.2f | %5.2f | %11s ]\n",
|
||||
AF_DUMP(( " %5d %5.2g %5s %4s %5s"
|
||||
" %c %5.2f %5.2f %11s\n",
|
||||
AF_INDEX_NUM( edge, edges ),
|
||||
(int)edge->opos / 64.0,
|
||||
af_dir_str( (AF_Direction)edge->dir ),
|
||||
AF_INDEX_NUM( edge->link, edges ),
|
||||
AF_INDEX_NUM( edge->serif, edges ),
|
||||
af_print_idx( buf1, AF_INDEX_NUM( edge->link, edges ) ),
|
||||
af_print_idx( buf2, AF_INDEX_NUM( edge->serif, edges ) ),
|
||||
|
||||
edge->blue_edge ? 'y' : 'n',
|
||||
edge->opos / 64.0,
|
||||
edge->pos / 64.0,
|
||||
|
|
|
@ -89,6 +89,22 @@
|
|||
}
|
||||
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/***** *****/
|
||||
|
@ -108,6 +124,7 @@
|
|||
(AF_WritingSystem_InitMetricsFunc) af_indic_metrics_init,
|
||||
(AF_WritingSystem_ScaleMetricsFunc)af_indic_metrics_scale,
|
||||
(AF_WritingSystem_DoneMetricsFunc) NULL,
|
||||
(AF_WritingSystem_GetStdWidthsFunc)af_indic_get_standard_widths,
|
||||
|
||||
(AF_WritingSystem_InitHintsFunc) af_indic_hints_init,
|
||||
(AF_WritingSystem_ApplyHintsFunc) af_indic_hints_apply
|
||||
|
@ -127,6 +144,7 @@
|
|||
(AF_WritingSystem_InitMetricsFunc) NULL,
|
||||
(AF_WritingSystem_ScaleMetricsFunc)NULL,
|
||||
(AF_WritingSystem_DoneMetricsFunc) NULL,
|
||||
(AF_WritingSystem_GetStdWidthsFunc)NULL,
|
||||
|
||||
(AF_WritingSystem_InitHintsFunc) NULL,
|
||||
(AF_WritingSystem_ApplyHintsFunc) NULL
|
||||
|
|
|
@ -309,6 +309,8 @@
|
|||
const char* p = &af_blue_strings[bs->string];
|
||||
FT_Pos* blue_ref;
|
||||
FT_Pos* blue_shoot;
|
||||
FT_Pos ascender;
|
||||
FT_Pos descender;
|
||||
|
||||
|
||||
#ifdef FT_DEBUG_LEVEL_TRACE
|
||||
|
@ -360,6 +362,8 @@
|
|||
|
||||
num_flats = 0;
|
||||
num_rounds = 0;
|
||||
ascender = 0;
|
||||
descender = 0;
|
||||
|
||||
while ( *p )
|
||||
{
|
||||
|
@ -421,20 +425,30 @@
|
|||
if ( AF_LATIN_IS_TOP_BLUE( bs ) )
|
||||
{
|
||||
for ( pp = first; pp <= last; pp++ )
|
||||
{
|
||||
if ( best_point < 0 || points[pp].y > best_y )
|
||||
{
|
||||
best_point = pp;
|
||||
best_y = points[pp].y;
|
||||
ascender = FT_MAX( ascender, best_y + y_offset );
|
||||
}
|
||||
else
|
||||
descender = FT_MIN( descender, points[pp].y + y_offset );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( pp = first; pp <= last; pp++ )
|
||||
{
|
||||
if ( best_point < 0 || points[pp].y < best_y )
|
||||
{
|
||||
best_point = pp;
|
||||
best_y = points[pp].y;
|
||||
descender = FT_MIN( descender, best_y + y_offset );
|
||||
}
|
||||
else
|
||||
ascender = FT_MAX( ascender, points[pp].y + y_offset );
|
||||
}
|
||||
}
|
||||
|
||||
if ( best_point != old_best_point )
|
||||
|
@ -807,6 +821,9 @@
|
|||
}
|
||||
}
|
||||
|
||||
blue->ascender = ascender;
|
||||
blue->descender = descender;
|
||||
|
||||
blue->flags = 0;
|
||||
if ( AF_LATIN_IS_TOP_BLUE( bs ) )
|
||||
blue->flags |= AF_LATIN_BLUE_TOP;
|
||||
|
@ -989,18 +1006,52 @@
|
|||
#endif
|
||||
if ( dim == AF_DIMENSION_VERT )
|
||||
{
|
||||
scale = FT_MulDiv( scale, fitted, scaled );
|
||||
FT_Pos max_height;
|
||||
FT_Pos dist;
|
||||
FT_Fixed new_scale;
|
||||
|
||||
FT_TRACE5((
|
||||
"af_latin_metrics_scale_dim:"
|
||||
" x height alignment (style `%s'):\n"
|
||||
" "
|
||||
" vertical scaling changed from %.4f to %.4f (by %d%%)\n"
|
||||
"\n",
|
||||
af_style_names[metrics->root.style_class->style],
|
||||
axis->org_scale / 65536.0,
|
||||
scale / 65536.0,
|
||||
( fitted - scaled ) * 100 / scaled ));
|
||||
|
||||
new_scale = FT_MulDiv( scale, fitted, scaled );
|
||||
|
||||
/* the scaling should not change the result by more than two pixels */
|
||||
max_height = metrics->units_per_em;
|
||||
|
||||
for ( nn = 0; nn < Axis->blue_count; nn++ )
|
||||
{
|
||||
max_height = FT_MAX( max_height, Axis->blues[nn].ascender );
|
||||
max_height = FT_MAX( max_height, -Axis->blues[nn].descender );
|
||||
}
|
||||
|
||||
dist = FT_ABS( FT_MulFix( max_height, new_scale - scale ) );
|
||||
dist &= ~127;
|
||||
|
||||
if ( dist == 0 )
|
||||
{
|
||||
scale = new_scale;
|
||||
|
||||
FT_TRACE5((
|
||||
"af_latin_metrics_scale_dim:"
|
||||
" x height alignment (style `%s'):\n"
|
||||
" "
|
||||
" vertical scaling changed from %.4f to %.4f (by %d%%)\n"
|
||||
"\n",
|
||||
af_style_names[metrics->root.style_class->style],
|
||||
axis->org_scale / 65536.0,
|
||||
scale / 65536.0,
|
||||
( fitted - scaled ) * 100 / scaled ));
|
||||
}
|
||||
#ifdef FT_DEBUG_LEVEL_TRACE
|
||||
else
|
||||
{
|
||||
FT_TRACE5((
|
||||
"af_latin_metrics_scale_dim:"
|
||||
" x height alignment (style `%s'):\n"
|
||||
" "
|
||||
" excessive vertical scaling abandoned\n"
|
||||
"\n",
|
||||
af_style_names[metrics->root.style_class->style] ));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1165,6 +1216,22 @@
|
|||
}
|
||||
|
||||
|
||||
/* Extract standard_width from writing system/script specific */
|
||||
/* metrics class. */
|
||||
|
||||
FT_LOCAL_DEF( void )
|
||||
af_latin_get_standard_widths( AF_LatinMetrics 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;
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/***** *****/
|
||||
|
@ -2960,6 +3027,7 @@
|
|||
(AF_WritingSystem_InitMetricsFunc) af_latin_metrics_init,
|
||||
(AF_WritingSystem_ScaleMetricsFunc)af_latin_metrics_scale,
|
||||
(AF_WritingSystem_DoneMetricsFunc) NULL,
|
||||
(AF_WritingSystem_GetStdWidthsFunc)af_latin_get_standard_widths,
|
||||
|
||||
(AF_WritingSystem_InitHintsFunc) af_latin_hints_init,
|
||||
(AF_WritingSystem_ApplyHintsFunc) af_latin_hints_apply
|
||||
|
|
|
@ -74,6 +74,8 @@ FT_BEGIN_HEADER
|
|||
{
|
||||
AF_WidthRec ref;
|
||||
AF_WidthRec shoot;
|
||||
FT_Pos ascender;
|
||||
FT_Pos descender;
|
||||
FT_UInt flags;
|
||||
|
||||
} AF_LatinBlueRec, *AF_LatinBlue;
|
||||
|
|
|
@ -693,6 +693,22 @@
|
|||
}
|
||||
|
||||
|
||||
/* Extract standard_width from writing system/script specific */
|
||||
/* metrics class. */
|
||||
|
||||
FT_LOCAL_DEF( void )
|
||||
af_latin2_get_standard_widths( AF_LatinMetrics 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;
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/***** *****/
|
||||
|
@ -2392,6 +2408,7 @@
|
|||
(AF_WritingSystem_InitMetricsFunc) af_latin2_metrics_init,
|
||||
(AF_WritingSystem_ScaleMetricsFunc)af_latin2_metrics_scale,
|
||||
(AF_WritingSystem_DoneMetricsFunc) NULL,
|
||||
(AF_WritingSystem_GetStdWidthsFunc)af_latin2_get_standard_widths,
|
||||
|
||||
(AF_WritingSystem_InitHintsFunc) af_latin2_hints_init,
|
||||
(AF_WritingSystem_ApplyHintsFunc) af_latin2_hints_apply
|
||||
|
|
268
reactos/lib/3rdparty/freetype/src/autofit/afloader.c
vendored
268
reactos/lib/3rdparty/freetype/src/autofit/afloader.c
vendored
|
@ -23,6 +23,8 @@
|
|||
#include "afmodule.h"
|
||||
#include "afpic.h"
|
||||
|
||||
#include FT_INTERNAL_CALC_H
|
||||
|
||||
|
||||
/* Initialize glyph loader. */
|
||||
|
||||
|
@ -76,6 +78,14 @@
|
|||
}
|
||||
|
||||
|
||||
#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 ) )
|
||||
|
||||
|
||||
/* 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. */
|
||||
|
@ -88,6 +98,8 @@
|
|||
FT_UInt glyph_index,
|
||||
FT_Int32 load_flags )
|
||||
{
|
||||
AF_Module module = loader->globals->module;
|
||||
|
||||
FT_Error error;
|
||||
FT_Face face = loader->face;
|
||||
AF_StyleMetrics metrics = loader->metrics;
|
||||
|
@ -103,6 +115,132 @@
|
|||
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.
|
||||
*/
|
||||
if ( !module->no_stem_darkening )
|
||||
{
|
||||
AF_FaceGlobals globals = loader->globals;
|
||||
AF_WritingSystemClass writing_system_class;
|
||||
|
||||
FT_Pos stdVW = 0;
|
||||
FT_Pos stdHW = 0;
|
||||
|
||||
FT_Bool size_changed = face->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 )
|
||||
goto After_Emboldening;
|
||||
|
||||
/*
|
||||
* 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 effectively disabled.
|
||||
*/
|
||||
writing_system_class =
|
||||
AF_WRITING_SYSTEM_CLASSES_GET[metrics->style_class->writing_system];
|
||||
|
||||
if ( writing_system_class->style_metrics_getstdw )
|
||||
writing_system_class->style_metrics_getstdw( metrics,
|
||||
&stdHW,
|
||||
&stdVW );
|
||||
else
|
||||
goto After_Emboldening;
|
||||
|
||||
|
||||
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,
|
||||
face->size->metrics.x_scale ),
|
||||
em_ratio );
|
||||
|
||||
globals->standard_vertical_width = stdVW;
|
||||
globals->stem_darkening_for_ppem = face->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,
|
||||
face->size->metrics.y_scale ),
|
||||
em_ratio );
|
||||
|
||||
globals->standard_horizontal_width = stdHW;
|
||||
globals->stem_darkening_for_ppem = face->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 );
|
||||
}
|
||||
|
||||
After_Emboldening:
|
||||
loader->transformed = internal->glyph_transformed;
|
||||
if ( loader->transformed )
|
||||
{
|
||||
|
@ -405,4 +543,134 @@
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* 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 */
|
||||
|
|
|
@ -75,6 +75,11 @@ FT_BEGIN_HEADER
|
|||
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 );
|
||||
|
||||
/* */
|
||||
|
||||
|
||||
|
|
|
@ -177,6 +177,46 @@
|
|||
return error;
|
||||
}
|
||||
#endif /* AF_CONFIG_OPTION_USE_WARPER */
|
||||
else if ( !ft_strcmp( property_name, "darkening-parameters" ) )
|
||||
{
|
||||
FT_Int* darken_params = (FT_Int*)value;
|
||||
|
||||
FT_Int x1 = darken_params[0];
|
||||
FT_Int y1 = darken_params[1];
|
||||
FT_Int x2 = darken_params[2];
|
||||
FT_Int y2 = darken_params[3];
|
||||
FT_Int x3 = darken_params[4];
|
||||
FT_Int y3 = darken_params[5];
|
||||
FT_Int x4 = darken_params[6];
|
||||
FT_Int 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" ) )
|
||||
{
|
||||
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 ));
|
||||
|
@ -253,6 +293,33 @@
|
|||
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 ));
|
||||
|
@ -262,8 +329,8 @@
|
|||
|
||||
FT_DEFINE_SERVICE_PROPERTIESREC(
|
||||
af_service_properties,
|
||||
(FT_Properties_SetFunc)af_property_set,
|
||||
(FT_Properties_GetFunc)af_property_get )
|
||||
(FT_Properties_SetFunc)af_property_set, /* set_property */
|
||||
(FT_Properties_GetFunc)af_property_get ) /* get_property */
|
||||
|
||||
|
||||
FT_DEFINE_SERVICEDESCREC1(
|
||||
|
@ -299,11 +366,21 @@
|
|||
AF_Module module = (AF_Module)ft_module;
|
||||
|
||||
|
||||
module->fallback_style = AF_STYLE_FALLBACK;
|
||||
module->default_script = AF_SCRIPT_DEFAULT;
|
||||
module->fallback_style = AF_STYLE_FALLBACK;
|
||||
module->default_script = AF_SCRIPT_DEFAULT;
|
||||
#ifdef AF_CONFIG_OPTION_USE_WARPER
|
||||
module->warping = 0;
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -41,6 +41,8 @@ FT_BEGIN_HEADER
|
|||
#ifdef AF_CONFIG_OPTION_USE_WARPER
|
||||
FT_Bool warping;
|
||||
#endif
|
||||
FT_Bool no_stem_darkening;
|
||||
FT_Int darken_params[8];
|
||||
|
||||
} AF_ModuleRec, *AF_Module;
|
||||
|
||||
|
|
|
@ -211,6 +211,11 @@ extern void* _af_debug_hints;
|
|||
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,
|
||||
|
@ -276,6 +281,7 @@ extern void* _af_debug_hints;
|
|||
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;
|
||||
|
@ -489,6 +495,7 @@ extern void* _af_debug_hints;
|
|||
m_init, \
|
||||
m_scale, \
|
||||
m_done, \
|
||||
m_stdw, \
|
||||
h_init, \
|
||||
h_apply ) \
|
||||
FT_CALLBACK_TABLE_DEF \
|
||||
|
@ -501,6 +508,7 @@ extern void* _af_debug_hints;
|
|||
m_init, \
|
||||
m_scale, \
|
||||
m_done, \
|
||||
m_stdw, \
|
||||
\
|
||||
h_init, \
|
||||
h_apply \
|
||||
|
@ -570,16 +578,17 @@ extern void* _af_debug_hints;
|
|||
FT_LOCAL_DEF( void ) \
|
||||
FT_Init_Class_ ## writing_system_class( AF_WritingSystemClassRec* ac ) \
|
||||
{ \
|
||||
ac->writing_system = system; \
|
||||
ac->writing_system = system; \
|
||||
\
|
||||
ac->style_metrics_size = m_size; \
|
||||
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_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; \
|
||||
ac->style_hints_init = h_init; \
|
||||
ac->style_hints_apply = h_apply; \
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -462,7 +462,7 @@
|
|||
(FT_UInt32)( 5 * _ft_debug_lineno );
|
||||
pnode = &table->sources[hash % FT_MEM_SOURCE_BUCKETS];
|
||||
|
||||
for ( ;; )
|
||||
for (;;)
|
||||
{
|
||||
node = *pnode;
|
||||
if ( node == NULL )
|
||||
|
|
14
reactos/lib/3rdparty/freetype/src/base/ftglyph.c
vendored
14
reactos/lib/3rdparty/freetype/src/base/ftglyph.c
vendored
|
@ -125,10 +125,10 @@
|
|||
FT_BitmapGlyph glyph = (FT_BitmapGlyph)bitmap_glyph;
|
||||
|
||||
|
||||
cbox->xMin = glyph->left << 6;
|
||||
cbox->xMax = cbox->xMin + (FT_Pos)( glyph->bitmap.width << 6 );
|
||||
cbox->yMax = glyph->top << 6;
|
||||
cbox->yMin = cbox->yMax - (FT_Pos)( glyph->bitmap.rows << 6 );
|
||||
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 );
|
||||
}
|
||||
|
||||
|
||||
|
@ -403,9 +403,9 @@
|
|||
if ( error )
|
||||
goto Exit;
|
||||
|
||||
/* copy advance while converting it to 16.16 format */
|
||||
glyph->advance.x = slot->advance.x << 10;
|
||||
glyph->advance.y = slot->advance.y << 10;
|
||||
/* copy advance while converting 26.6 to 16.16 format */
|
||||
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 );
|
||||
|
|
|
@ -305,12 +305,10 @@
|
|||
FT_Library_SetLcdFilter( FT_Library library,
|
||||
FT_LcdFilter filter )
|
||||
{
|
||||
static const FT_Byte default_filter[5] =
|
||||
{ 0x08, 0x4d, 0x56, 0x4d, 0x08 };
|
||||
static const FT_Byte light_filter[5] =
|
||||
{ 0x00, 0x55, 0x56, 0x55, 0x00 };
|
||||
/* the values here sum up to a value larger than 256, */
|
||||
/* providing a cheap gamma correction */
|
||||
static const FT_Byte default_filter[5] =
|
||||
{ 0x10, 0x40, 0x70, 0x40, 0x10 };
|
||||
|
||||
|
||||
if ( !library )
|
||||
|
@ -354,6 +352,7 @@
|
|||
#ifdef USE_LEGACY
|
||||
|
||||
case FT_LCD_FILTER_LEGACY:
|
||||
case FT_LCD_FILTER_LEGACY1:
|
||||
library->lcd_filter_func = _ft_lcd_filter_legacy;
|
||||
library->lcd_extra = 0;
|
||||
break;
|
||||
|
|
81
reactos/lib/3rdparty/freetype/src/base/ftobjs.c
vendored
81
reactos/lib/3rdparty/freetype/src/base/ftobjs.c
vendored
|
@ -55,7 +55,18 @@
|
|||
#pragma warning( disable : 4244 )
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
/* it's easiest to include `md5.c' directly */
|
||||
/* It's easiest to include `md5.c' directly. However, since OpenSSL */
|
||||
/* also provides the same functions, there might be conflicts if */
|
||||
/* both FreeType and OpenSSL are built as static libraries. For */
|
||||
/* this reason, we put the MD5 stuff into the `FT_' namespace. */
|
||||
#define MD5_u32plus FT_MD5_u32plus
|
||||
#define MD5_CTX FT_MD5_CTX
|
||||
#define MD5_Init FT_MD5_Init
|
||||
#define MD5_Update FT_MD5_Update
|
||||
#define MD5_Final FT_MD5_Final
|
||||
|
||||
#undef HAVE_OPENSSL
|
||||
|
||||
#include "md5.c"
|
||||
|
||||
#if defined( _MSC_VER )
|
||||
|
@ -675,7 +686,8 @@
|
|||
/* check the size of the `fpgm' and `prep' tables, too -- */
|
||||
/* the assumption is that there don't exist real TTFs where */
|
||||
/* both `fpgm' and `prep' tables are missing */
|
||||
if ( mode == FT_RENDER_MODE_LIGHT ||
|
||||
if ( ( mode == FT_RENDER_MODE_LIGHT &&
|
||||
!FT_DRIVER_HINTS_LIGHTLY( driver ) ) ||
|
||||
face->internal->ignore_unpatented_hinter ||
|
||||
( FT_IS_SFNT( face ) &&
|
||||
ttface->num_locations &&
|
||||
|
@ -4156,39 +4168,50 @@
|
|||
#undef FT_COMPONENT
|
||||
#define FT_COMPONENT trace_bitmap
|
||||
|
||||
/* we convert to a single bitmap format for computing the checksum */
|
||||
if ( !error )
|
||||
/*
|
||||
* Computing the MD5 checksum is expensive, unnecessarily distorting a
|
||||
* possible profiling of FreeType if compiled with tracing support. For
|
||||
* this reason, we execute the following code only if explicitly
|
||||
* requested.
|
||||
*/
|
||||
|
||||
/* we use FT_TRACE3 in this block */
|
||||
if ( ft_trace_levels[trace_bitmap] >= 3 )
|
||||
{
|
||||
FT_Bitmap bitmap;
|
||||
FT_Error err;
|
||||
|
||||
|
||||
FT_Bitmap_Init( &bitmap );
|
||||
|
||||
/* this also converts the bitmap flow to `down' (i.e., pitch > 0) */
|
||||
err = FT_Bitmap_Convert( library, &slot->bitmap, &bitmap, 1 );
|
||||
if ( !err )
|
||||
/* we convert to a single bitmap format for computing the checksum */
|
||||
if ( !error )
|
||||
{
|
||||
MD5_CTX ctx;
|
||||
unsigned char md5[16];
|
||||
int i;
|
||||
unsigned int rows = bitmap.rows;
|
||||
unsigned int pitch = (unsigned int)bitmap.pitch;
|
||||
FT_Bitmap bitmap;
|
||||
FT_Error err;
|
||||
|
||||
|
||||
MD5_Init( &ctx );
|
||||
MD5_Update( &ctx, bitmap.buffer, rows * pitch );
|
||||
MD5_Final( md5, &ctx );
|
||||
FT_Bitmap_Init( &bitmap );
|
||||
|
||||
FT_TRACE3(( "MD5 checksum for %dx%d bitmap:\n"
|
||||
" ",
|
||||
rows, pitch ));
|
||||
for ( i = 0; i < 16; i++ )
|
||||
FT_TRACE3(( "%02X", md5[i] ));
|
||||
FT_TRACE3(( "\n" ));
|
||||
/* this also converts the bitmap flow to `down' (i.e., pitch > 0) */
|
||||
err = FT_Bitmap_Convert( library, &slot->bitmap, &bitmap, 1 );
|
||||
if ( !err )
|
||||
{
|
||||
MD5_CTX ctx;
|
||||
unsigned char md5[16];
|
||||
int i;
|
||||
unsigned int rows = bitmap.rows;
|
||||
unsigned int pitch = (unsigned int)bitmap.pitch;
|
||||
|
||||
|
||||
MD5_Init( &ctx );
|
||||
MD5_Update( &ctx, bitmap.buffer, rows * pitch );
|
||||
MD5_Final( md5, &ctx );
|
||||
|
||||
FT_TRACE3(( "MD5 checksum for %dx%d bitmap:\n"
|
||||
" ",
|
||||
rows, pitch ));
|
||||
for ( i = 0; i < 16; i++ )
|
||||
FT_TRACE3(( "%02X", md5[i] ));
|
||||
FT_TRACE3(( "\n" ));
|
||||
}
|
||||
|
||||
FT_Bitmap_Done( library, &bitmap );
|
||||
}
|
||||
|
||||
FT_Bitmap_Done( library, &bitmap );
|
||||
}
|
||||
|
||||
#undef FT_COMPONENT
|
||||
|
|
14
reactos/lib/3rdparty/freetype/src/base/ftoutln.c
vendored
14
reactos/lib/3rdparty/freetype/src/base/ftoutln.c
vendored
|
@ -942,6 +942,9 @@
|
|||
l_in = 0;
|
||||
last = outline->contours[c];
|
||||
|
||||
/* pacify compiler */
|
||||
in.x = in.y = anchor.x = anchor.y = 0;
|
||||
|
||||
/* Counter j cycles though the points; counter i advances only */
|
||||
/* when points are moved; anchor k marks the first moved point. */
|
||||
for ( i = last, j = first, k = -1;
|
||||
|
@ -1074,13 +1077,16 @@
|
|||
FT_Int last = outline->contours[c];
|
||||
|
||||
|
||||
v_prev = points[last];
|
||||
v_prev.x = points[last].x >> xshift;
|
||||
v_prev.y = points[last].y >> yshift;
|
||||
|
||||
for ( n = first; n <= last; n++ )
|
||||
{
|
||||
v_cur = points[n];
|
||||
area += ( ( v_cur.y - v_prev.y ) >> yshift ) *
|
||||
( ( v_cur.x + v_prev.x ) >> xshift );
|
||||
v_cur.x = points[n].x >> xshift;
|
||||
v_cur.y = points[n].y >> yshift;
|
||||
|
||||
area += ( v_cur.y - v_prev.y ) * ( v_cur.x + v_prev.x );
|
||||
|
||||
v_prev = v_cur;
|
||||
}
|
||||
|
||||
|
|
36
reactos/lib/3rdparty/freetype/src/bdf/bdfdrivr.c
vendored
36
reactos/lib/3rdparty/freetype/src/bdf/bdfdrivr.c
vendored
|
@ -824,8 +824,8 @@ THE SOFTWARE.
|
|||
|
||||
static const FT_Service_BDFRec bdf_service_bdf =
|
||||
{
|
||||
(FT_BDF_GetCharsetIdFunc)bdf_get_charset_id,
|
||||
(FT_BDF_GetPropertyFunc) bdf_get_bdf_property
|
||||
(FT_BDF_GetCharsetIdFunc)bdf_get_charset_id, /* get_charset_id */
|
||||
(FT_BDF_GetPropertyFunc) bdf_get_bdf_property /* get_property */
|
||||
};
|
||||
|
||||
|
||||
|
@ -866,32 +866,32 @@ THE SOFTWARE.
|
|||
0x10000L,
|
||||
0x20000L,
|
||||
|
||||
0,
|
||||
0, /* module-specific interface */
|
||||
|
||||
0, /* FT_Module_Constructor */
|
||||
0, /* FT_Module_Destructor */
|
||||
bdf_driver_requester
|
||||
0, /* FT_Module_Constructor module_init */
|
||||
0, /* FT_Module_Destructor module_done */
|
||||
bdf_driver_requester /* FT_Module_Requester get_interface */
|
||||
},
|
||||
|
||||
sizeof ( BDF_FaceRec ),
|
||||
sizeof ( FT_SizeRec ),
|
||||
sizeof ( FT_GlyphSlotRec ),
|
||||
|
||||
BDF_Face_Init,
|
||||
BDF_Face_Done,
|
||||
0, /* FT_Size_InitFunc */
|
||||
0, /* FT_Size_DoneFunc */
|
||||
0, /* FT_Slot_InitFunc */
|
||||
0, /* FT_Slot_DoneFunc */
|
||||
BDF_Face_Init, /* FT_Face_InitFunc init_face */
|
||||
BDF_Face_Done, /* FT_Face_DoneFunc done_face */
|
||||
0, /* FT_Size_InitFunc init_size */
|
||||
0, /* FT_Size_DoneFunc done_size */
|
||||
0, /* FT_Slot_InitFunc init_slot */
|
||||
0, /* FT_Slot_DoneFunc done_slot */
|
||||
|
||||
BDF_Glyph_Load,
|
||||
BDF_Glyph_Load, /* FT_Slot_LoadFunc load_glyph */
|
||||
|
||||
0, /* FT_Face_GetKerningFunc */
|
||||
0, /* FT_Face_AttachFunc */
|
||||
0, /* FT_Face_GetAdvancesFunc */
|
||||
0, /* FT_Face_GetKerningFunc get_kerning */
|
||||
0, /* FT_Face_AttachFunc attach_file */
|
||||
0, /* FT_Face_GetAdvancesFunc get_advances */
|
||||
|
||||
BDF_Size_Request,
|
||||
BDF_Size_Select
|
||||
BDF_Size_Request, /* FT_Size_RequestFunc request_size */
|
||||
BDF_Size_Select /* FT_Size_SelectFunc select_size */
|
||||
};
|
||||
|
||||
|
||||
|
|
28
reactos/lib/3rdparty/freetype/src/bdf/bdflib.c
vendored
28
reactos/lib/3rdparty/freetype/src/bdf/bdflib.c
vendored
|
@ -201,6 +201,7 @@
|
|||
#define ACMSG14 "Glyph %ld extra columns removed.\n"
|
||||
#define ACMSG15 "Incorrect glyph count: %ld indicated but %ld found.\n"
|
||||
#define ACMSG16 "Glyph %ld missing columns padded with zero bits.\n"
|
||||
#define ACMSG17 "Adjusting number of glyphs to %ld.\n"
|
||||
|
||||
/* Error messages. */
|
||||
#define ERRMSG1 "[line %ld] Missing `%s' line.\n"
|
||||
|
@ -432,6 +433,7 @@
|
|||
_bdf_list_t list;
|
||||
|
||||
FT_Memory memory;
|
||||
unsigned long size; /* the stream size */
|
||||
|
||||
} _bdf_parse_t;
|
||||
|
||||
|
@ -1579,6 +1581,13 @@
|
|||
goto Exit;
|
||||
p->cnt = font->glyphs_size = _bdf_atoul( p->list.field[1], 0, 10 );
|
||||
|
||||
/* We need at least 20 bytes per glyph. */
|
||||
if ( p->cnt > p->size / 20 )
|
||||
{
|
||||
p->cnt = font->glyphs_size = p->size / 20;
|
||||
FT_TRACE2(( "_bdf_parse_glyphs: " ACMSG17, p->cnt ));
|
||||
}
|
||||
|
||||
/* Make sure the number of glyphs is non-zero. */
|
||||
if ( p->cnt == 0 )
|
||||
font->glyphs_size = 64;
|
||||
|
@ -1641,6 +1650,14 @@
|
|||
/* Check for the STARTCHAR field. */
|
||||
if ( _bdf_strncmp( line, "STARTCHAR", 9 ) == 0 )
|
||||
{
|
||||
if ( p->flags & _BDF_GLYPH_BITS )
|
||||
{
|
||||
/* Missing ENDCHAR field. */
|
||||
FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG1, lineno, "ENDCHAR" ));
|
||||
error = FT_THROW( Missing_Startchar_Field );
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
/* Set the character name in the parse info first until the */
|
||||
/* encoding can be checked for an unencoded character. */
|
||||
FT_FREE( p->glyph_name );
|
||||
|
@ -1773,11 +1790,16 @@
|
|||
glyph = font->unencoded + font->unencoded_used;
|
||||
glyph->name = p->glyph_name;
|
||||
glyph->encoding = (long)font->unencoded_used++;
|
||||
|
||||
/* Reset the initial glyph info. */
|
||||
p->glyph_name = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Free up the glyph name if the unencoded shouldn't be */
|
||||
/* kept. */
|
||||
FT_FREE( p->glyph_name );
|
||||
}
|
||||
|
||||
p->glyph_name = NULL;
|
||||
}
|
||||
|
@ -2447,6 +2469,7 @@
|
|||
memory = NULL;
|
||||
p->opts = (bdf_options_t*)( ( opts != 0 ) ? opts : &_bdf_opts );
|
||||
p->minlb = 32767;
|
||||
p->size = stream->size;
|
||||
p->memory = extmemory; /* only during font creation */
|
||||
|
||||
_bdf_list_init( &p->list, extmemory );
|
||||
|
@ -2531,14 +2554,14 @@
|
|||
/* Error happened while parsing header. */
|
||||
FT_ERROR(( "bdf_load_font: " ERRMSG2, lineno ));
|
||||
error = FT_THROW( Corrupted_Font_Header );
|
||||
goto Exit;
|
||||
goto Fail;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Error happened when parsing glyphs. */
|
||||
FT_ERROR(( "bdf_load_font: " ERRMSG3, lineno ));
|
||||
error = FT_THROW( Corrupted_Font_Glyphs );
|
||||
goto Exit;
|
||||
goto Fail;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2569,6 +2592,7 @@
|
|||
|
||||
memory = extmemory;
|
||||
|
||||
FT_FREE( p->glyph_name );
|
||||
FT_FREE( p );
|
||||
}
|
||||
|
||||
|
|
|
@ -576,7 +576,7 @@
|
|||
FTC_Node* pnode = bucket;
|
||||
|
||||
|
||||
for ( ;; )
|
||||
for (;;)
|
||||
{
|
||||
FTC_Node node = *pnode;
|
||||
FT_Bool list_changed = FALSE;
|
||||
|
|
14
reactos/lib/3rdparty/freetype/src/cff/cf2ft.c
vendored
14
reactos/lib/3rdparty/freetype/src/cff/cf2ft.c
vendored
|
@ -544,14 +544,17 @@
|
|||
/* return 0 on success */
|
||||
FT_LOCAL_DEF( CF2_Int )
|
||||
cf2_initGlobalRegionBuffer( CFF_Decoder* decoder,
|
||||
CF2_UInt idx,
|
||||
CF2_Int subrNum,
|
||||
CF2_Buffer buf )
|
||||
{
|
||||
CF2_UInt idx;
|
||||
|
||||
|
||||
FT_ASSERT( decoder );
|
||||
|
||||
FT_ZERO( buf );
|
||||
|
||||
idx += (CF2_UInt)decoder->globals_bias;
|
||||
idx = (CF2_UInt)( subrNum + decoder->globals_bias );
|
||||
if ( idx >= decoder->num_globals )
|
||||
return TRUE; /* error */
|
||||
|
||||
|
@ -628,14 +631,17 @@
|
|||
|
||||
FT_LOCAL_DEF( CF2_Int )
|
||||
cf2_initLocalRegionBuffer( CFF_Decoder* decoder,
|
||||
CF2_UInt idx,
|
||||
CF2_Int subrNum,
|
||||
CF2_Buffer buf )
|
||||
{
|
||||
CF2_UInt idx;
|
||||
|
||||
|
||||
FT_ASSERT( decoder );
|
||||
|
||||
FT_ZERO( buf );
|
||||
|
||||
idx += (CF2_UInt)decoder->locals_bias;
|
||||
idx = (CF2_UInt)( subrNum + decoder->locals_bias );
|
||||
if ( idx >= decoder->num_locals )
|
||||
return TRUE; /* error */
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@ FT_BEGIN_HEADER
|
|||
|
||||
FT_LOCAL( CF2_Int )
|
||||
cf2_initGlobalRegionBuffer( CFF_Decoder* decoder,
|
||||
CF2_UInt idx,
|
||||
CF2_Int subrNum,
|
||||
CF2_Buffer buf );
|
||||
FT_LOCAL( FT_Error )
|
||||
cf2_getSeacComponent( CFF_Decoder* decoder,
|
||||
|
@ -110,7 +110,7 @@ FT_BEGIN_HEADER
|
|||
CF2_Buffer buf );
|
||||
FT_LOCAL( CF2_Int )
|
||||
cf2_initLocalRegionBuffer( CFF_Decoder* decoder,
|
||||
CF2_UInt idx,
|
||||
CF2_Int subrNum,
|
||||
CF2_Buffer buf );
|
||||
|
||||
FT_LOCAL( CF2_Fixed )
|
||||
|
|
|
@ -587,8 +587,9 @@
|
|||
}
|
||||
|
||||
/* paired edges must be in proper order */
|
||||
FT_ASSERT( !isPair ||
|
||||
topHintEdge->csCoord >= bottomHintEdge->csCoord );
|
||||
if ( isPair &&
|
||||
topHintEdge->csCoord < bottomHintEdge->csCoord )
|
||||
return;
|
||||
|
||||
/* linear search to find index value of insertion point */
|
||||
indexInsert = 0;
|
||||
|
|
14
reactos/lib/3rdparty/freetype/src/cff/cf2intrp.c
vendored
14
reactos/lib/3rdparty/freetype/src/cff/cf2intrp.c
vendored
|
@ -184,7 +184,7 @@
|
|||
return;
|
||||
|
||||
FT_ASSERT( hintmask->byteCount > 0 );
|
||||
FT_ASSERT( hintmask->byteCount <
|
||||
FT_ASSERT( hintmask->byteCount <=
|
||||
sizeof ( hintmask->mask ) / sizeof ( hintmask->mask[0] ) );
|
||||
|
||||
/* set mask to all ones */
|
||||
|
@ -752,7 +752,7 @@
|
|||
case cf2_cmdCALLGSUBR:
|
||||
case cf2_cmdCALLSUBR:
|
||||
{
|
||||
CF2_UInt subrIndex;
|
||||
CF2_Int subrNum;
|
||||
|
||||
|
||||
FT_TRACE4(( op1 == cf2_cmdCALLGSUBR ? " callgsubr"
|
||||
|
@ -772,17 +772,17 @@
|
|||
(size_t)charstringIndex + 1 );
|
||||
|
||||
/* set up the new CFF region and pointer */
|
||||
subrIndex = (CF2_UInt)cf2_stack_popInt( opStack );
|
||||
subrNum = cf2_stack_popInt( opStack );
|
||||
|
||||
switch ( op1 )
|
||||
{
|
||||
case cf2_cmdCALLGSUBR:
|
||||
FT_TRACE4(( " (idx %d, entering level %d)\n",
|
||||
subrIndex + (CF2_UInt)decoder->globals_bias,
|
||||
subrNum + decoder->globals_bias,
|
||||
charstringIndex + 1 ));
|
||||
|
||||
if ( cf2_initGlobalRegionBuffer( decoder,
|
||||
subrIndex,
|
||||
subrNum,
|
||||
charstring ) )
|
||||
{
|
||||
lastError = FT_THROW( Invalid_Glyph_Format );
|
||||
|
@ -793,11 +793,11 @@
|
|||
default:
|
||||
/* cf2_cmdCALLSUBR */
|
||||
FT_TRACE4(( " (idx %d, entering level %d)\n",
|
||||
subrIndex + (CF2_UInt)decoder->locals_bias,
|
||||
subrNum + decoder->locals_bias,
|
||||
charstringIndex + 1 ));
|
||||
|
||||
if ( cf2_initLocalRegionBuffer( decoder,
|
||||
subrIndex,
|
||||
subrNum,
|
||||
charstring ) )
|
||||
{
|
||||
lastError = FT_THROW( Invalid_Glyph_Format );
|
||||
|
|
74
reactos/lib/3rdparty/freetype/src/cff/cffdrivr.c
vendored
74
reactos/lib/3rdparty/freetype/src/cff/cffdrivr.c
vendored
|
@ -358,8 +358,8 @@
|
|||
|
||||
FT_DEFINE_SERVICE_GLYPHDICTREC(
|
||||
cff_service_glyph_dict,
|
||||
(FT_GlyphDict_GetNameFunc) cff_get_glyph_name,
|
||||
(FT_GlyphDict_NameIndexFunc)cff_get_name_index
|
||||
(FT_GlyphDict_GetNameFunc) cff_get_glyph_name, /* get_name */
|
||||
(FT_GlyphDict_NameIndexFunc)cff_get_name_index /* name_index */
|
||||
)
|
||||
|
||||
|
||||
|
@ -421,11 +421,13 @@
|
|||
|
||||
FT_DEFINE_SERVICE_PSINFOREC(
|
||||
cff_service_ps_info,
|
||||
(PS_GetFontInfoFunc) cff_ps_get_font_info,
|
||||
(PS_GetFontExtraFunc) NULL,
|
||||
(PS_HasGlyphNamesFunc) cff_ps_has_glyph_names,
|
||||
(PS_GetFontPrivateFunc)NULL, /* unsupported with CFF fonts */
|
||||
(PS_GetFontValueFunc) NULL /* not implemented */
|
||||
(PS_GetFontInfoFunc) cff_ps_get_font_info, /* ps_get_font_info */
|
||||
(PS_GetFontExtraFunc) NULL, /* ps_get_font_extra */
|
||||
(PS_HasGlyphNamesFunc) cff_ps_has_glyph_names, /* ps_has_glyph_names */
|
||||
/* unsupported with CFF fonts */
|
||||
(PS_GetFontPrivateFunc)NULL, /* ps_get_font_private */
|
||||
/* not implemented */
|
||||
(PS_GetFontValueFunc) NULL /* ps_get_font_value */
|
||||
)
|
||||
|
||||
|
||||
|
@ -444,7 +446,7 @@
|
|||
/* following the OpenType specification 1.7, we return the name stored */
|
||||
/* in the `name' table for a CFF wrapped into an SFNT container */
|
||||
|
||||
if ( sfnt )
|
||||
if ( FT_IS_SFNT( FT_FACE( face ) ) && sfnt )
|
||||
{
|
||||
FT_Library library = FT_FACE_LIBRARY( face );
|
||||
FT_Module sfnt_module = FT_Get_Module( library, "sfnt" );
|
||||
|
@ -464,7 +466,7 @@
|
|||
|
||||
FT_DEFINE_SERVICE_PSFONTNAMEREC(
|
||||
cff_service_ps_name,
|
||||
(FT_PsName_GetFunc)cff_get_ps_name
|
||||
(FT_PsName_GetFunc)cff_get_ps_name /* get_ps_font_name */
|
||||
)
|
||||
|
||||
|
||||
|
@ -511,7 +513,7 @@
|
|||
|
||||
FT_DEFINE_SERVICE_TTCMAPSREC(
|
||||
cff_service_get_cmap_info,
|
||||
(TT_CMap_Info_GetFunc)cff_get_cmap_info
|
||||
(TT_CMap_Info_GetFunc)cff_get_cmap_info /* get_cmap_info */
|
||||
)
|
||||
|
||||
|
||||
|
@ -641,9 +643,12 @@
|
|||
|
||||
FT_DEFINE_SERVICE_CIDREC(
|
||||
cff_service_cid_info,
|
||||
(FT_CID_GetRegistryOrderingSupplementFunc)cff_get_ros,
|
||||
(FT_CID_GetIsInternallyCIDKeyedFunc) cff_get_is_cid,
|
||||
(FT_CID_GetCIDFromGlyphIndexFunc) cff_get_cid_from_glyph_index
|
||||
(FT_CID_GetRegistryOrderingSupplementFunc)
|
||||
cff_get_ros, /* get_ros */
|
||||
(FT_CID_GetIsInternallyCIDKeyedFunc)
|
||||
cff_get_is_cid, /* get_is_cid */
|
||||
(FT_CID_GetCIDFromGlyphIndexFunc)
|
||||
cff_get_cid_from_glyph_index /* get_cid_from_glyph_index */
|
||||
)
|
||||
|
||||
|
||||
|
@ -776,8 +781,8 @@
|
|||
|
||||
FT_DEFINE_SERVICE_PROPERTIESREC(
|
||||
cff_service_properties,
|
||||
(FT_Properties_SetFunc)cff_property_set,
|
||||
(FT_Properties_GetFunc)cff_property_get )
|
||||
(FT_Properties_SetFunc)cff_property_set, /* set_property */
|
||||
(FT_Properties_GetFunc)cff_property_get ) /* get_property */
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
|
@ -865,9 +870,10 @@
|
|||
FT_DEFINE_DRIVER(
|
||||
cff_driver_class,
|
||||
|
||||
FT_MODULE_FONT_DRIVER |
|
||||
FT_MODULE_DRIVER_SCALABLE |
|
||||
FT_MODULE_DRIVER_HAS_HINTER,
|
||||
FT_MODULE_FONT_DRIVER |
|
||||
FT_MODULE_DRIVER_SCALABLE |
|
||||
FT_MODULE_DRIVER_HAS_HINTER |
|
||||
FT_MODULE_DRIVER_HINTS_LIGHTLY,
|
||||
|
||||
sizeof ( CFF_DriverRec ),
|
||||
"cff",
|
||||
|
@ -876,31 +882,29 @@
|
|||
|
||||
0, /* module-specific interface */
|
||||
|
||||
cff_driver_init,
|
||||
cff_driver_done,
|
||||
cff_get_interface,
|
||||
cff_driver_init, /* FT_Module_Constructor module_init */
|
||||
cff_driver_done, /* FT_Module_Destructor module_done */
|
||||
cff_get_interface, /* FT_Module_Requester get_interface */
|
||||
|
||||
/* now the specific driver fields */
|
||||
sizeof ( TT_FaceRec ),
|
||||
sizeof ( CFF_SizeRec ),
|
||||
sizeof ( CFF_GlyphSlotRec ),
|
||||
|
||||
cff_face_init,
|
||||
cff_face_done,
|
||||
cff_size_init,
|
||||
cff_size_done,
|
||||
cff_slot_init,
|
||||
cff_slot_done,
|
||||
cff_face_init, /* FT_Face_InitFunc init_face */
|
||||
cff_face_done, /* FT_Face_DoneFunc done_face */
|
||||
cff_size_init, /* FT_Size_InitFunc init_size */
|
||||
cff_size_done, /* FT_Size_DoneFunc done_size */
|
||||
cff_slot_init, /* FT_Slot_InitFunc init_slot */
|
||||
cff_slot_done, /* FT_Slot_DoneFunc done_slot */
|
||||
|
||||
cff_glyph_load,
|
||||
cff_glyph_load, /* FT_Slot_LoadFunc load_glyph */
|
||||
|
||||
cff_get_kerning,
|
||||
0, /* FT_Face_AttachFunc */
|
||||
cff_get_advances,
|
||||
cff_get_kerning, /* FT_Face_GetKerningFunc get_kerning */
|
||||
0, /* FT_Face_AttachFunc attach_file */
|
||||
cff_get_advances, /* FT_Face_GetAdvancesFunc get_advances */
|
||||
|
||||
cff_size_request,
|
||||
|
||||
CFF_SIZE_SELECT
|
||||
cff_size_request, /* FT_Size_RequestFunc request_size */
|
||||
CFF_SIZE_SELECT /* FT_Size_SelectFunc select_size */
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -1052,7 +1052,7 @@
|
|||
driver->hinting_engine = FT_CFF_HINTING_ADOBE;
|
||||
#endif
|
||||
|
||||
driver->no_stem_darkening = FALSE;
|
||||
driver->no_stem_darkening = TRUE;
|
||||
|
||||
driver->darken_params[0] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_X1;
|
||||
driver->darken_params[1] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y1;
|
||||
|
|
29
reactos/lib/3rdparty/freetype/src/cid/cidgload.c
vendored
29
reactos/lib/3rdparty/freetype/src/cid/cidgload.c
vendored
|
@ -100,7 +100,7 @@
|
|||
/* and charstring offset from the CIDMap. */
|
||||
{
|
||||
FT_UInt entry_len = (FT_UInt)( cid->fd_bytes + cid->gd_bytes );
|
||||
FT_ULong off1;
|
||||
FT_ULong off1, off2;
|
||||
|
||||
|
||||
if ( FT_STREAM_SEEK( cid->data_offset + cid->cidmap_offset +
|
||||
|
@ -108,18 +108,23 @@
|
|||
FT_FRAME_ENTER( 2 * entry_len ) )
|
||||
goto Exit;
|
||||
|
||||
p = (FT_Byte*)stream->cursor;
|
||||
fd_select = cid_get_offset( &p, (FT_Byte)cid->fd_bytes );
|
||||
off1 = cid_get_offset( &p, (FT_Byte)cid->gd_bytes );
|
||||
p += cid->fd_bytes;
|
||||
glyph_length = cid_get_offset( &p, (FT_Byte)cid->gd_bytes ) - off1;
|
||||
p = (FT_Byte*)stream->cursor;
|
||||
fd_select = cid_get_offset( &p, (FT_Byte)cid->fd_bytes );
|
||||
off1 = cid_get_offset( &p, (FT_Byte)cid->gd_bytes );
|
||||
p += cid->fd_bytes;
|
||||
off2 = cid_get_offset( &p, (FT_Byte)cid->gd_bytes );
|
||||
FT_FRAME_EXIT();
|
||||
|
||||
if ( fd_select >= (FT_ULong)cid->num_dicts )
|
||||
if ( fd_select >= (FT_ULong)cid->num_dicts ||
|
||||
off2 > stream->size ||
|
||||
off1 > off2 )
|
||||
{
|
||||
FT_TRACE0(( "cid_load_glyph: invalid glyph stream offsets\n" ));
|
||||
error = FT_THROW( Invalid_Offset );
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
glyph_length = off2 - off1;
|
||||
if ( glyph_length == 0 )
|
||||
goto Exit;
|
||||
if ( FT_ALLOC( charstring, glyph_length ) )
|
||||
|
@ -152,6 +157,12 @@
|
|||
|
||||
/* Adjustment for seed bytes. */
|
||||
cs_offset = decoder->lenIV >= 0 ? (FT_UInt)decoder->lenIV : 0;
|
||||
if ( cs_offset > glyph_length )
|
||||
{
|
||||
FT_TRACE0(( "cid_load_glyph: invalid glyph stream offsets\n" ));
|
||||
error = FT_THROW( Invalid_Offset );
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
/* Decrypt only if lenIV >= 0. */
|
||||
if ( decoder->lenIV >= 0 )
|
||||
|
@ -162,8 +173,6 @@
|
|||
glyph_length - cs_offset );
|
||||
}
|
||||
|
||||
FT_FREE( charstring );
|
||||
|
||||
#ifdef FT_CONFIG_OPTION_INCREMENTAL
|
||||
|
||||
/* Incremental fonts can optionally override the metrics. */
|
||||
|
@ -188,6 +197,8 @@
|
|||
#endif /* FT_CONFIG_OPTION_INCREMENTAL */
|
||||
|
||||
Exit:
|
||||
FT_FREE( charstring );
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
|
|
157
reactos/lib/3rdparty/freetype/src/cid/cidload.c
vendored
157
reactos/lib/3rdparty/freetype/src/cid/cidload.c
vendored
|
@ -215,6 +215,7 @@
|
|||
{
|
||||
CID_FaceInfo cid = &face->cid;
|
||||
FT_Memory memory = face->root.memory;
|
||||
FT_Stream stream = parser->stream;
|
||||
FT_Error error = FT_Err_Ok;
|
||||
FT_Long num_dicts;
|
||||
|
||||
|
@ -227,6 +228,31 @@
|
|||
goto Exit;
|
||||
}
|
||||
|
||||
/*
|
||||
* A single entry in the FDArray must (at least) contain the following
|
||||
* structure elements.
|
||||
*
|
||||
* %ADOBeginFontDict 18
|
||||
* X dict begin 13
|
||||
* /FontMatrix [X X X X] 22
|
||||
* /Private X dict begin 22
|
||||
* end 4
|
||||
* end 4
|
||||
* %ADOEndFontDict 16
|
||||
*
|
||||
* This needs 18+13+22+22+4+4+16=99 bytes or more. Normally, you also
|
||||
* need a `dup X' at the very beginning and a `put' at the end, so a
|
||||
* rough guess using 100 bytes as the minimum is justified.
|
||||
*/
|
||||
if ( (FT_ULong)num_dicts > stream->size / 100 )
|
||||
{
|
||||
FT_TRACE0(( "parse_fd_array: adjusting FDArray size"
|
||||
" (from %d to %d)\n",
|
||||
num_dicts,
|
||||
stream->size / 100 ));
|
||||
num_dicts = (FT_Long)( stream->size / 100 );
|
||||
}
|
||||
|
||||
if ( !cid->font_dicts )
|
||||
{
|
||||
FT_Int n;
|
||||
|
@ -395,7 +421,14 @@
|
|||
|
||||
cur = parser->root.cursor;
|
||||
}
|
||||
|
||||
if ( !face->cid.num_dicts )
|
||||
{
|
||||
FT_ERROR(( "cid_parse_dict: No font dictionary found\n" ));
|
||||
return FT_THROW( Invalid_File_Format );
|
||||
}
|
||||
}
|
||||
|
||||
return parser->root.error;
|
||||
}
|
||||
|
||||
|
@ -428,13 +461,6 @@
|
|||
FT_Byte* p;
|
||||
|
||||
|
||||
/* Check for possible overflow. */
|
||||
if ( num_subrs == FT_UINT_MAX )
|
||||
{
|
||||
error = FT_THROW( Syntax_Error );
|
||||
goto Fail;
|
||||
}
|
||||
|
||||
/* reallocate offsets array if needed */
|
||||
if ( num_subrs + 1 > max_offsets )
|
||||
{
|
||||
|
@ -467,14 +493,25 @@
|
|||
/* offsets must be ordered */
|
||||
for ( count = 1; count <= num_subrs; count++ )
|
||||
if ( offsets[count - 1] > offsets[count] )
|
||||
{
|
||||
FT_ERROR(( "cid_read_subrs: offsets are not ordered\n" ));
|
||||
error = FT_THROW( Invalid_File_Format );
|
||||
goto Fail;
|
||||
}
|
||||
|
||||
if ( offsets[num_subrs] > stream->size - cid->data_offset )
|
||||
{
|
||||
FT_ERROR(( "cid_read_subrs: too large `subrs' offsets\n" ));
|
||||
error = FT_THROW( Invalid_File_Format );
|
||||
goto Fail;
|
||||
}
|
||||
|
||||
/* now, compute the size of subrs charstrings, */
|
||||
/* allocate, and read them */
|
||||
data_len = offsets[num_subrs] - offsets[0];
|
||||
|
||||
if ( FT_NEW_ARRAY( subr->code, num_subrs + 1 ) ||
|
||||
FT_ALLOC( subr->code[0], data_len ) )
|
||||
FT_ALLOC( subr->code[0], data_len ) )
|
||||
goto Fail;
|
||||
|
||||
if ( FT_STREAM_SEEK( cid->data_offset + offsets[0] ) ||
|
||||
|
@ -654,6 +691,12 @@
|
|||
CID_Parser* parser;
|
||||
FT_Memory memory = face->root.memory;
|
||||
FT_Error error;
|
||||
FT_Int n;
|
||||
|
||||
CID_FaceInfo cid = &face->cid;
|
||||
|
||||
FT_ULong binary_length;
|
||||
FT_ULong entry_len;
|
||||
|
||||
|
||||
cid_init_loader( &loader, face );
|
||||
|
@ -678,6 +721,17 @@
|
|||
|
||||
if ( parser->binary_length )
|
||||
{
|
||||
if ( parser->binary_length >
|
||||
face->root.stream->size - parser->data_offset )
|
||||
{
|
||||
FT_TRACE0(( "cid_face_open: adjusting length of binary data\n"
|
||||
" (from %d to %d bytes)\n",
|
||||
parser->binary_length,
|
||||
face->root.stream->size - parser->data_offset ));
|
||||
parser->binary_length = face->root.stream->size -
|
||||
parser->data_offset;
|
||||
}
|
||||
|
||||
/* we must convert the data section from hexadecimal to binary */
|
||||
if ( FT_ALLOC( face->binary_data, parser->binary_length ) ||
|
||||
cid_hex_to_binary( face->binary_data, parser->binary_length,
|
||||
|
@ -686,14 +740,95 @@
|
|||
|
||||
FT_Stream_OpenMemory( face->cid_stream,
|
||||
face->binary_data, parser->binary_length );
|
||||
face->cid.data_offset = 0;
|
||||
cid->data_offset = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
*face->cid_stream = *face->root.stream;
|
||||
face->cid.data_offset = loader.parser.data_offset;
|
||||
*face->cid_stream = *face->root.stream;
|
||||
cid->data_offset = loader.parser.data_offset;
|
||||
}
|
||||
|
||||
/* sanity tests */
|
||||
|
||||
if ( cid->fd_bytes < 0 || cid->gd_bytes < 1 )
|
||||
{
|
||||
FT_ERROR(( "cid_parse_dict:"
|
||||
" Invalid `FDBytes' or `GDBytes' value\n" ));
|
||||
error = FT_THROW( Invalid_File_Format );
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
/* allow at most 32bit offsets */
|
||||
if ( cid->fd_bytes > 4 || cid->gd_bytes > 4 )
|
||||
{
|
||||
FT_ERROR(( "cid_parse_dict:"
|
||||
" Values of `FDBytes' or `GDBytes' larger than 4\n"
|
||||
" "
|
||||
" are not supported\n" ));
|
||||
error = FT_THROW( Invalid_File_Format );
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
binary_length = face->cid_stream->size - cid->data_offset;
|
||||
entry_len = (FT_ULong)( cid->fd_bytes + cid->gd_bytes );
|
||||
|
||||
for ( n = 0; n < cid->num_dicts; n++ )
|
||||
{
|
||||
CID_FaceDict dict = cid->font_dicts + n;
|
||||
|
||||
|
||||
if ( dict->sd_bytes < 0 )
|
||||
{
|
||||
FT_ERROR(( "cid_parse_dict: Invalid `SDBytes' value\n" ));
|
||||
error = FT_THROW( Invalid_File_Format );
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
if ( dict->sd_bytes > 4 )
|
||||
{
|
||||
FT_ERROR(( "cid_parse_dict:"
|
||||
" Values of `SDBytes' larger than 4"
|
||||
" are not supported\n" ));
|
||||
error = FT_THROW( Invalid_File_Format );
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
if ( dict->subrmap_offset > binary_length )
|
||||
{
|
||||
FT_ERROR(( "cid_parse_dict: Invalid `SubrMapOffset' value\n" ));
|
||||
error = FT_THROW( Invalid_File_Format );
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
/* `num_subrs' is scanned as a signed integer */
|
||||
if ( (FT_Int)dict->num_subrs < 0 ||
|
||||
( dict->sd_bytes &&
|
||||
dict->num_subrs > ( binary_length - dict->subrmap_offset ) /
|
||||
(FT_UInt)dict->sd_bytes ) )
|
||||
{
|
||||
FT_ERROR(( "cid_parse_dict: Invalid `SubrCount' value\n" ));
|
||||
error = FT_THROW( Invalid_File_Format );
|
||||
goto Exit;
|
||||
}
|
||||
}
|
||||
|
||||
if ( cid->cidmap_offset > binary_length )
|
||||
{
|
||||
FT_ERROR(( "cid_parse_dict: Invalid `CIDMapOffset' value\n" ));
|
||||
error = FT_THROW( Invalid_File_Format );
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
if ( entry_len &&
|
||||
cid->cid_count >
|
||||
( binary_length - cid->cidmap_offset ) / entry_len )
|
||||
{
|
||||
FT_ERROR(( "cid_parse_dict: Invalid `CIDCount' value\n" ));
|
||||
error = FT_THROW( Invalid_File_Format );
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
/* we can now safely proceed */
|
||||
error = cid_read_subrs( face );
|
||||
|
||||
Exit:
|
||||
|
|
62
reactos/lib/3rdparty/freetype/src/cid/cidriver.c
vendored
62
reactos/lib/3rdparty/freetype/src/cid/cidriver.c
vendored
|
@ -59,7 +59,7 @@
|
|||
|
||||
static const FT_Service_PsFontNameRec cid_service_ps_name =
|
||||
{
|
||||
(FT_PsName_GetFunc) cid_get_postscript_name
|
||||
(FT_PsName_GetFunc)cid_get_postscript_name /* get_ps_font_name */
|
||||
};
|
||||
|
||||
|
||||
|
@ -88,11 +88,14 @@
|
|||
|
||||
static const FT_Service_PsInfoRec cid_service_ps_info =
|
||||
{
|
||||
(PS_GetFontInfoFunc) cid_ps_get_font_info,
|
||||
(PS_GetFontExtraFunc) cid_ps_get_font_extra,
|
||||
(PS_HasGlyphNamesFunc) NULL, /* unsupported with CID fonts */
|
||||
(PS_GetFontPrivateFunc)NULL, /* unsupported */
|
||||
(PS_GetFontValueFunc) NULL /* not implemented */
|
||||
(PS_GetFontInfoFunc) cid_ps_get_font_info, /* ps_get_font_info */
|
||||
(PS_GetFontExtraFunc) cid_ps_get_font_extra, /* ps_get_font_extra */
|
||||
/* unsupported with CID fonts */
|
||||
(PS_HasGlyphNamesFunc) NULL, /* ps_has_glyph_names */
|
||||
/* unsupported */
|
||||
(PS_GetFontPrivateFunc)NULL, /* ps_get_font_private */
|
||||
/* not implemented */
|
||||
(PS_GetFontValueFunc) NULL /* ps_get_font_value */
|
||||
};
|
||||
|
||||
|
||||
|
@ -155,9 +158,12 @@
|
|||
|
||||
static const FT_Service_CIDRec cid_service_cid_info =
|
||||
{
|
||||
(FT_CID_GetRegistryOrderingSupplementFunc)cid_get_ros,
|
||||
(FT_CID_GetIsInternallyCIDKeyedFunc) cid_get_is_cid,
|
||||
(FT_CID_GetCIDFromGlyphIndexFunc) cid_get_cid_from_glyph_index
|
||||
(FT_CID_GetRegistryOrderingSupplementFunc)
|
||||
cid_get_ros, /* get_ros */
|
||||
(FT_CID_GetIsInternallyCIDKeyedFunc)
|
||||
cid_get_is_cid, /* get_is_cid */
|
||||
(FT_CID_GetCIDFromGlyphIndexFunc)
|
||||
cid_get_cid_from_glyph_index /* get_cid_from_glyph_index */
|
||||
};
|
||||
|
||||
|
||||
|
@ -190,46 +196,42 @@
|
|||
FT_CALLBACK_TABLE_DEF
|
||||
const FT_Driver_ClassRec t1cid_driver_class =
|
||||
{
|
||||
/* first of all, the FT_Module_Class fields */
|
||||
{
|
||||
FT_MODULE_FONT_DRIVER |
|
||||
FT_MODULE_DRIVER_SCALABLE |
|
||||
FT_MODULE_DRIVER_HAS_HINTER,
|
||||
|
||||
sizeof ( FT_DriverRec ),
|
||||
|
||||
"t1cid", /* module name */
|
||||
0x10000L, /* version 1.0 of driver */
|
||||
0x20000L, /* requires FreeType 2.0 */
|
||||
|
||||
0,
|
||||
0, /* module-specific interface */
|
||||
|
||||
cid_driver_init,
|
||||
cid_driver_done,
|
||||
cid_get_interface
|
||||
cid_driver_init, /* FT_Module_Constructor module_init */
|
||||
cid_driver_done, /* FT_Module_Destructor module_done */
|
||||
cid_get_interface /* FT_Module_Requester get_interface */
|
||||
},
|
||||
|
||||
/* then the other font drivers fields */
|
||||
sizeof ( CID_FaceRec ),
|
||||
sizeof ( CID_SizeRec ),
|
||||
sizeof ( CID_GlyphSlotRec ),
|
||||
|
||||
cid_face_init,
|
||||
cid_face_done,
|
||||
cid_face_init, /* FT_Face_InitFunc init_face */
|
||||
cid_face_done, /* FT_Face_DoneFunc done_face */
|
||||
cid_size_init, /* FT_Size_InitFunc init_size */
|
||||
cid_size_done, /* FT_Size_DoneFunc done_size */
|
||||
cid_slot_init, /* FT_Slot_InitFunc init_slot */
|
||||
cid_slot_done, /* FT_Slot_DoneFunc done_slot */
|
||||
|
||||
cid_size_init,
|
||||
cid_size_done,
|
||||
cid_slot_init,
|
||||
cid_slot_done,
|
||||
cid_slot_load_glyph, /* FT_Slot_LoadFunc load_glyph */
|
||||
|
||||
cid_slot_load_glyph,
|
||||
0, /* FT_Face_GetKerningFunc get_kerning */
|
||||
0, /* FT_Face_AttachFunc attach_file */
|
||||
0, /* FT_Face_GetAdvancesFunc get_advances */
|
||||
|
||||
0, /* FT_Face_GetKerningFunc */
|
||||
0, /* FT_Face_AttachFunc */
|
||||
|
||||
0, /* FT_Face_GetAdvancesFunc */
|
||||
|
||||
cid_size_request,
|
||||
0 /* FT_Size_SelectFunc */
|
||||
cid_size_request, /* FT_Size_RequestFunc request_size */
|
||||
0 /* FT_Size_SelectFunc select_size */
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -235,14 +235,14 @@
|
|||
static
|
||||
const FT_Service_GXvalidateRec gxvalid_interface =
|
||||
{
|
||||
gxv_validate
|
||||
gxv_validate /* validate */
|
||||
};
|
||||
|
||||
|
||||
static
|
||||
const FT_Service_CKERNvalidateRec ckernvalid_interface =
|
||||
{
|
||||
classic_kern_validate
|
||||
classic_kern_validate /* validate */
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -691,9 +691,13 @@
|
|||
}
|
||||
error = FT_Err_Ok;
|
||||
}
|
||||
|
||||
if ( zip_size )
|
||||
stream->size = zip_size;
|
||||
else
|
||||
stream->size = 0x7FFFFFFFL; /* don't know the real size! */
|
||||
}
|
||||
|
||||
stream->size = 0x7FFFFFFFL; /* don't know the real size! */
|
||||
stream->pos = 0;
|
||||
stream->base = NULL;
|
||||
stream->read = ft_gzip_stream_io;
|
||||
|
|
|
@ -240,7 +240,7 @@
|
|||
static
|
||||
const FT_Service_OTvalidateRec otvalid_interface =
|
||||
{
|
||||
otv_validate
|
||||
otv_validate /* validate */
|
||||
};
|
||||
|
||||
|
||||
|
|
5
reactos/lib/3rdparty/freetype/src/pcf/pcf.h
vendored
5
reactos/lib/3rdparty/freetype/src/pcf/pcf.h
vendored
|
@ -226,8 +226,9 @@ FT_BEGIN_HEADER
|
|||
#define GLYPHPADOPTIONS 4 /* I'm not sure about this */
|
||||
|
||||
FT_LOCAL( FT_Error )
|
||||
pcf_load_font( FT_Stream,
|
||||
PCF_Face );
|
||||
pcf_load_font( FT_Stream stream,
|
||||
PCF_Face face,
|
||||
FT_Long face_index );
|
||||
|
||||
FT_END_HEADER
|
||||
|
||||
|
|
44
reactos/lib/3rdparty/freetype/src/pcf/pcfdrivr.c
vendored
44
reactos/lib/3rdparty/freetype/src/pcf/pcfdrivr.c
vendored
|
@ -271,7 +271,7 @@ THE SOFTWARE.
|
|||
|
||||
FT_TRACE2(( "PCF driver\n" ));
|
||||
|
||||
error = pcf_load_font( stream, face );
|
||||
error = pcf_load_font( stream, face, face_index );
|
||||
if ( error )
|
||||
{
|
||||
PCF_Face_Done( pcfface );
|
||||
|
@ -332,7 +332,7 @@ THE SOFTWARE.
|
|||
|
||||
stream = pcfface->stream;
|
||||
|
||||
error = pcf_load_font( stream, face );
|
||||
error = pcf_load_font( stream, face, face_index );
|
||||
if ( error )
|
||||
goto Fail;
|
||||
|
||||
|
@ -351,7 +351,9 @@ THE SOFTWARE.
|
|||
* an invalid argument error when the font could be
|
||||
* opened by the specified driver.
|
||||
*/
|
||||
if ( face_index > 0 && ( face_index & 0xFFFF ) > 0 )
|
||||
if ( face_index < 0 )
|
||||
goto Exit;
|
||||
else if ( face_index > 0 && ( face_index & 0xFFFF ) > 0 )
|
||||
{
|
||||
FT_ERROR(( "PCF_Face_Init: invalid face index\n" ));
|
||||
PCF_Face_Done( pcfface );
|
||||
|
@ -657,8 +659,8 @@ THE SOFTWARE.
|
|||
|
||||
static const FT_Service_BDFRec pcf_service_bdf =
|
||||
{
|
||||
(FT_BDF_GetCharsetIdFunc)pcf_get_charset_id,
|
||||
(FT_BDF_GetPropertyFunc) pcf_get_bdf_property
|
||||
(FT_BDF_GetCharsetIdFunc)pcf_get_charset_id, /* get_charset_id */
|
||||
(FT_BDF_GetPropertyFunc) pcf_get_bdf_property /* get_property */
|
||||
};
|
||||
|
||||
|
||||
|
@ -698,32 +700,32 @@ THE SOFTWARE.
|
|||
0x10000L,
|
||||
0x20000L,
|
||||
|
||||
0,
|
||||
0, /* module-specific interface */
|
||||
|
||||
0, /* FT_Module_Constructor */
|
||||
0, /* FT_Module_Destructor */
|
||||
pcf_driver_requester
|
||||
0, /* FT_Module_Constructor module_init */
|
||||
0, /* FT_Module_Destructor module_done */
|
||||
pcf_driver_requester /* FT_Module_Requester get_interface */
|
||||
},
|
||||
|
||||
sizeof ( PCF_FaceRec ),
|
||||
sizeof ( FT_SizeRec ),
|
||||
sizeof ( FT_GlyphSlotRec ),
|
||||
|
||||
PCF_Face_Init,
|
||||
PCF_Face_Done,
|
||||
0, /* FT_Size_InitFunc */
|
||||
0, /* FT_Size_DoneFunc */
|
||||
0, /* FT_Slot_InitFunc */
|
||||
0, /* FT_Slot_DoneFunc */
|
||||
PCF_Face_Init, /* FT_Face_InitFunc init_face */
|
||||
PCF_Face_Done, /* FT_Face_DoneFunc done_face */
|
||||
0, /* FT_Size_InitFunc init_size */
|
||||
0, /* FT_Size_DoneFunc done_size */
|
||||
0, /* FT_Slot_InitFunc init_slot */
|
||||
0, /* FT_Slot_DoneFunc done_slot */
|
||||
|
||||
PCF_Glyph_Load,
|
||||
PCF_Glyph_Load, /* FT_Slot_LoadFunc load_glyph */
|
||||
|
||||
0, /* FT_Face_GetKerningFunc */
|
||||
0, /* FT_Face_AttachFunc */
|
||||
0, /* FT_Face_GetAdvancesFunc */
|
||||
0, /* FT_Face_GetKerningFunc get_kerning */
|
||||
0, /* FT_Face_AttachFunc attach_file */
|
||||
0, /* FT_Face_GetAdvancesFunc get_advances */
|
||||
|
||||
PCF_Size_Request,
|
||||
PCF_Size_Select
|
||||
PCF_Size_Request, /* FT_Size_RequestFunc request_size */
|
||||
PCF_Size_Select /* FT_Size_SelectFunc select_size */
|
||||
};
|
||||
|
||||
|
||||
|
|
32
reactos/lib/3rdparty/freetype/src/pcf/pcfread.c
vendored
32
reactos/lib/3rdparty/freetype/src/pcf/pcfread.c
vendored
|
@ -102,11 +102,22 @@ THE SOFTWARE.
|
|||
FT_STREAM_READ_FIELDS( pcf_toc_header, toc ) )
|
||||
return FT_THROW( Cannot_Open_Resource );
|
||||
|
||||
if ( toc->version != PCF_FILE_VERSION ||
|
||||
toc->count > FT_ARRAY_MAX( face->toc.tables ) ||
|
||||
toc->count == 0 )
|
||||
if ( toc->version != PCF_FILE_VERSION ||
|
||||
toc->count == 0 )
|
||||
return FT_THROW( Invalid_File_Format );
|
||||
|
||||
if ( stream->size < 16 )
|
||||
return FT_THROW( Invalid_File_Format );
|
||||
|
||||
/* we need 16 bytes per TOC entry */
|
||||
if ( toc->count > stream->size >> 4 )
|
||||
{
|
||||
FT_TRACE0(( "pcf_read_TOC: adjusting number of tables"
|
||||
" (from %d to %d)\n",
|
||||
toc->count, stream->size >> 4 ));
|
||||
toc->count = stream->size >> 4;
|
||||
}
|
||||
|
||||
if ( FT_NEW_ARRAY( face->toc.tables, toc->count ) )
|
||||
return FT_THROW( Out_Of_Memory );
|
||||
|
||||
|
@ -1173,8 +1184,10 @@ THE SOFTWARE.
|
|||
|
||||
FT_LOCAL_DEF( FT_Error )
|
||||
pcf_load_font( FT_Stream stream,
|
||||
PCF_Face face )
|
||||
PCF_Face face,
|
||||
FT_Long face_index )
|
||||
{
|
||||
FT_Face root = FT_FACE( face );
|
||||
FT_Error error;
|
||||
FT_Memory memory = FT_FACE( face )->memory;
|
||||
FT_Bool hasBDFAccelerators;
|
||||
|
@ -1184,6 +1197,13 @@ THE SOFTWARE.
|
|||
if ( error )
|
||||
goto Exit;
|
||||
|
||||
root->num_faces = 1;
|
||||
root->face_index = 0;
|
||||
|
||||
/* If we are performing a simple font format check, exit immediately. */
|
||||
if ( face_index < 0 )
|
||||
return FT_Err_Ok;
|
||||
|
||||
error = pcf_get_properties( stream, face );
|
||||
if ( error )
|
||||
goto Exit;
|
||||
|
@ -1226,13 +1246,9 @@ THE SOFTWARE.
|
|||
|
||||
/* now construct the face object */
|
||||
{
|
||||
FT_Face root = FT_FACE( face );
|
||||
PCF_Property prop;
|
||||
|
||||
|
||||
root->num_faces = 1;
|
||||
root->face_index = 0;
|
||||
|
||||
root->face_flags |= FT_FACE_FLAG_FIXED_SIZES |
|
||||
FT_FACE_FLAG_HORIZONTAL |
|
||||
FT_FACE_FLAG_FAST_GLYPHS;
|
||||
|
|
|
@ -130,7 +130,7 @@
|
|||
}
|
||||
|
||||
if ( gchar->char_code < char_code )
|
||||
min = mid+1;
|
||||
min = mid + 1;
|
||||
else
|
||||
max = mid;
|
||||
}
|
||||
|
|
39
reactos/lib/3rdparty/freetype/src/pfr/pfrdrivr.c
vendored
39
reactos/lib/3rdparty/freetype/src/pfr/pfrdrivr.c
vendored
|
@ -139,9 +139,9 @@
|
|||
static
|
||||
const FT_Service_PfrMetricsRec pfr_metrics_service_rec =
|
||||
{
|
||||
pfr_get_metrics,
|
||||
pfr_face_get_kerning,
|
||||
pfr_get_advance
|
||||
pfr_get_metrics, /* get_metrics */
|
||||
pfr_face_get_kerning, /* get_kerning */
|
||||
pfr_get_advance /* get_advance */
|
||||
};
|
||||
|
||||
|
||||
|
@ -181,31 +181,32 @@
|
|||
0x10000L,
|
||||
0x20000L,
|
||||
|
||||
NULL,
|
||||
0, /* module-specific interface */
|
||||
|
||||
0, /* FT_Module_Constructor */
|
||||
0, /* FT_Module_Destructor */
|
||||
pfr_get_service
|
||||
0, /* FT_Module_Constructor module_init */
|
||||
0, /* FT_Module_Destructor module_done */
|
||||
pfr_get_service /* FT_Module_Requester get_interface */
|
||||
},
|
||||
|
||||
sizeof ( PFR_FaceRec ),
|
||||
sizeof ( PFR_SizeRec ),
|
||||
sizeof ( PFR_SlotRec ),
|
||||
|
||||
pfr_face_init,
|
||||
pfr_face_done,
|
||||
0, /* FT_Size_InitFunc */
|
||||
0, /* FT_Size_DoneFunc */
|
||||
pfr_slot_init,
|
||||
pfr_slot_done,
|
||||
pfr_face_init, /* FT_Face_InitFunc init_face */
|
||||
pfr_face_done, /* FT_Face_DoneFunc done_face */
|
||||
0, /* FT_Size_InitFunc init_size */
|
||||
0, /* FT_Size_DoneFunc done_size */
|
||||
pfr_slot_init, /* FT_Slot_InitFunc init_slot */
|
||||
pfr_slot_done, /* FT_Slot_DoneFunc done_slot */
|
||||
|
||||
pfr_slot_load,
|
||||
pfr_slot_load, /* FT_Slot_LoadFunc load_glyph */
|
||||
|
||||
pfr_get_kerning,
|
||||
0, /* FT_Face_AttachFunc */
|
||||
0, /* FT_Face_GetAdvancesFunc */
|
||||
0, /* FT_Size_RequestFunc */
|
||||
0, /* FT_Size_SelectFunc */
|
||||
pfr_get_kerning, /* FT_Face_GetKerningFunc get_kerning */
|
||||
0, /* FT_Face_AttachFunc attach_file */
|
||||
0, /* FT_Face_GetAdvancesFunc get_advances */
|
||||
|
||||
0, /* FT_Size_RequestFunc request_size */
|
||||
0, /* FT_Size_SelectFunc select_size */
|
||||
};
|
||||
|
||||
|
||||
|
|
51
reactos/lib/3rdparty/freetype/src/pfr/pfrgload.c
vendored
51
reactos/lib/3rdparty/freetype/src/pfr/pfrgload.c
vendored
|
@ -92,8 +92,8 @@
|
|||
if ( outline->n_contours > 0 )
|
||||
first = outline->contours[outline->n_contours - 1];
|
||||
|
||||
/* if the last point falls on the same location than the first one */
|
||||
/* we need to delete it */
|
||||
/* if the last point falls on the same location as the first one */
|
||||
/* we need to delete it */
|
||||
if ( last > first )
|
||||
{
|
||||
FT_Vector* p1 = outline->points + first;
|
||||
|
@ -215,8 +215,10 @@
|
|||
/* check that there is space for a new contour and a new point */
|
||||
error = FT_GLYPHLOADER_CHECK_POINTS( loader, 1, 1 );
|
||||
if ( !error )
|
||||
{
|
||||
/* add new start point */
|
||||
error = pfr_glyph_line_to( glyph, to );
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
@ -304,8 +306,8 @@
|
|||
|
||||
glyph->y_control = glyph->x_control + x_count;
|
||||
|
||||
mask = 0;
|
||||
x = 0;
|
||||
mask = 0;
|
||||
x = 0;
|
||||
|
||||
for ( i = 0; i < count; i++ )
|
||||
{
|
||||
|
@ -331,9 +333,9 @@
|
|||
mask >>= 1;
|
||||
}
|
||||
|
||||
/* XXX: for now we ignore the secondary stroke and edge definitions */
|
||||
/* since we don't want to support native PFR hinting */
|
||||
/* */
|
||||
/* XXX: we ignore the secondary stroke and edge definitions */
|
||||
/* since we don't support native PFR hinting */
|
||||
/* */
|
||||
if ( flags & PFR_GLYPH_EXTRA_ITEMS )
|
||||
{
|
||||
error = pfr_extra_items_skip( &p, limit );
|
||||
|
@ -366,27 +368,27 @@
|
|||
|
||||
switch ( format >> 4 )
|
||||
{
|
||||
case 0: /* end glyph */
|
||||
case 0: /* end glyph */
|
||||
FT_TRACE6(( "- end glyph" ));
|
||||
args_count = 0;
|
||||
break;
|
||||
|
||||
case 1: /* general line operation */
|
||||
case 1: /* general line operation */
|
||||
FT_TRACE6(( "- general line" ));
|
||||
goto Line1;
|
||||
|
||||
case 4: /* move to inside contour */
|
||||
case 4: /* move to inside contour */
|
||||
FT_TRACE6(( "- move to inside" ));
|
||||
goto Line1;
|
||||
|
||||
case 5: /* move to outside contour */
|
||||
case 5: /* move to outside contour */
|
||||
FT_TRACE6(( "- move to outside" ));
|
||||
Line1:
|
||||
args_format = format_low;
|
||||
args_count = 1;
|
||||
break;
|
||||
|
||||
case 2: /* horizontal line to */
|
||||
case 2: /* horizontal line to */
|
||||
FT_TRACE6(( "- horizontal line to cx.%d", format_low ));
|
||||
if ( format_low >= x_count )
|
||||
goto Failure;
|
||||
|
@ -396,7 +398,7 @@
|
|||
args_count = 0;
|
||||
break;
|
||||
|
||||
case 3: /* vertical line to */
|
||||
case 3: /* vertical line to */
|
||||
FT_TRACE6(( "- vertical line to cy.%d", format_low ));
|
||||
if ( format_low >= y_count )
|
||||
goto Failure;
|
||||
|
@ -406,19 +408,19 @@
|
|||
args_count = 0;
|
||||
break;
|
||||
|
||||
case 6: /* horizontal to vertical curve */
|
||||
case 6: /* horizontal to vertical curve */
|
||||
FT_TRACE6(( "- hv curve " ));
|
||||
args_format = 0xB8E;
|
||||
args_count = 3;
|
||||
break;
|
||||
|
||||
case 7: /* vertical to horizontal curve */
|
||||
case 7: /* vertical to horizontal curve */
|
||||
FT_TRACE6(( "- vh curve" ));
|
||||
args_format = 0xE2B;
|
||||
args_count = 3;
|
||||
break;
|
||||
|
||||
default: /* general curve to */
|
||||
default: /* general curve to */
|
||||
FT_TRACE6(( "- general curve" ));
|
||||
args_count = 4;
|
||||
args_format = format_low;
|
||||
|
@ -439,14 +441,14 @@
|
|||
{
|
||||
case 0: /* 8-bit index */
|
||||
PFR_CHECK( 1 );
|
||||
idx = PFR_NEXT_BYTE( p );
|
||||
idx = PFR_NEXT_BYTE( p );
|
||||
if ( idx >= x_count )
|
||||
goto Failure;
|
||||
cur->x = glyph->x_control[idx];
|
||||
FT_TRACE7(( " cx#%d", idx ));
|
||||
break;
|
||||
|
||||
case 1: /* 16-bit value */
|
||||
case 1: /* 16-bit absolute value */
|
||||
PFR_CHECK( 2 );
|
||||
cur->x = PFR_NEXT_SHORT( p );
|
||||
FT_TRACE7(( " x.%d", cur->x ));
|
||||
|
@ -516,22 +518,22 @@
|
|||
/* */
|
||||
switch ( format >> 4 )
|
||||
{
|
||||
case 0: /* end glyph => EXIT */
|
||||
case 0: /* end glyph => EXIT */
|
||||
pfr_glyph_end( glyph );
|
||||
goto Exit;
|
||||
|
||||
case 1: /* line operations */
|
||||
case 1: /* line operations */
|
||||
case 2:
|
||||
case 3:
|
||||
error = pfr_glyph_line_to( glyph, pos );
|
||||
goto Test_Error;
|
||||
|
||||
case 4: /* move to inside contour */
|
||||
case 5: /* move to outside contour */
|
||||
case 4: /* move to inside contour */
|
||||
case 5: /* move to outside contour */
|
||||
error = pfr_glyph_move_to( glyph, pos );
|
||||
goto Test_Error;
|
||||
|
||||
default: /* curve operations */
|
||||
default: /* curve operations */
|
||||
error = pfr_glyph_curve_to( glyph, pos, pos + 1, pos + 2 );
|
||||
|
||||
Test_Error: /* test error condition */
|
||||
|
@ -580,7 +582,8 @@
|
|||
if ( flags & PFR_GLYPH_EXTRA_ITEMS )
|
||||
{
|
||||
error = pfr_extra_items_skip( &p, limit );
|
||||
if (error) goto Exit;
|
||||
if ( error )
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
/* we can't rely on the FT_GlyphLoader to load sub-glyphs, because */
|
||||
|
|
165
reactos/lib/3rdparty/freetype/src/pfr/pfrload.c
vendored
165
reactos/lib/3rdparty/freetype/src/pfr/pfrload.c
vendored
|
@ -26,6 +26,93 @@
|
|||
#define FT_COMPONENT trace_pfr
|
||||
|
||||
|
||||
/*
|
||||
* The overall structure of a PFR file is as follows.
|
||||
*
|
||||
* PFR header
|
||||
* 58 bytes (contains nPhysFonts)
|
||||
*
|
||||
* Logical font directory (size at most 2^16 bytes)
|
||||
* 2 bytes (nLogFonts)
|
||||
* + nLogFonts * 5 bytes
|
||||
*
|
||||
* ==> nLogFonts <= 13106
|
||||
*
|
||||
* Logical font section (size at most 2^24 bytes)
|
||||
* nLogFonts * logFontRecord
|
||||
*
|
||||
* logFontRecord (size at most 2^16 bytes)
|
||||
* 12 bytes (fontMatrix)
|
||||
* + 1 byte (flags)
|
||||
* + 0-5 bytes (depending on `flags')
|
||||
* + 0-(1+255*(2+255)) = 0-65536 (depending on `flags')
|
||||
* + 5 bytes (physical font info)
|
||||
* + 0-1 bytes (depending on PFR header)
|
||||
*
|
||||
* ==> minimum size 18 bytes
|
||||
*
|
||||
* Physical font section (size at most 2^24 bytes)
|
||||
* nPhysFonts * (physFontRecord
|
||||
* + nBitmapSizes * nBmapChars * bmapCharRecord)
|
||||
*
|
||||
* physFontRecord (size at most 2^24 bytes)
|
||||
* 14 bytes (font info)
|
||||
* + 1 byte (flags)
|
||||
* + 0-2 (depending on `flags')
|
||||
* + 0-? (structure too complicated to be shown here; depending on
|
||||
* `flags'; contains `nBitmapSizes' and `nBmapChars')
|
||||
* + 3 bytes (nAuxBytes)
|
||||
* + nAuxBytes
|
||||
* + 1 byte (nBlueValues)
|
||||
* + 2 * nBlueValues
|
||||
* + 6 bytes (hinting data)
|
||||
* + 2 bytes (nCharacters)
|
||||
* + nCharacters * (4-10 bytes) (depending on `flags')
|
||||
*
|
||||
* ==> minimum size 27 bytes
|
||||
*
|
||||
* bmapCharRecord
|
||||
* 4-7 bytes
|
||||
*
|
||||
* Glyph program strings (three possible types: simpleGps, compoundGps,
|
||||
* and bitmapGps; size at most 2^24 bytes)
|
||||
* simpleGps (size at most 2^16 bytes)
|
||||
* 1 byte (flags)
|
||||
* 1-2 bytes (n[XY]orus, depending on `flags')
|
||||
* 0-(64+512*2) = 0-1088 bytes (depending on `n[XY]orus')
|
||||
* 0-? (structure too complicated to be shown here; depending on
|
||||
* `flags')
|
||||
* 1-? glyph data (faintly resembling PS Type 1 charstrings)
|
||||
*
|
||||
* ==> minimum size 3 bytes
|
||||
*
|
||||
* compoundGps (size at most 2^16 bytes)
|
||||
* 1 byte (nElements <= 63, flags)
|
||||
* + 0-(1+255*(2+255)) = 0-65536 (depending on `flags')
|
||||
* + nElements * (6-14 bytes)
|
||||
*
|
||||
* bitmapGps (size at most 2^16 bytes)
|
||||
* 1 byte (flags)
|
||||
* 3-13 bytes (position info, depending on `flags')
|
||||
* 0-? bitmap data
|
||||
*
|
||||
* ==> minimum size 4 bytes
|
||||
*
|
||||
* PFR trailer
|
||||
* 8 bytes
|
||||
*
|
||||
*
|
||||
* ==> minimum size of a valid PFR:
|
||||
* 58 (header)
|
||||
* + 2 (nLogFonts)
|
||||
* + 27 (1 physFontRecord)
|
||||
* + 8 (trailer)
|
||||
* -----
|
||||
* 95 bytes
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/***** *****/
|
||||
|
@ -75,7 +162,8 @@
|
|||
if ( extra->type == item_type )
|
||||
{
|
||||
error = extra->parser( p, p + item_size, item_data );
|
||||
if ( error ) goto Exit;
|
||||
if ( error )
|
||||
goto Exit;
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -183,7 +271,8 @@
|
|||
{
|
||||
result = 0;
|
||||
}
|
||||
return result;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
@ -206,9 +295,20 @@
|
|||
FT_UInt result = 0;
|
||||
|
||||
|
||||
if ( FT_STREAM_SEEK( section_offset ) || FT_READ_USHORT( count ) )
|
||||
if ( FT_STREAM_SEEK( section_offset ) ||
|
||||
FT_READ_USHORT( count ) )
|
||||
goto Exit;
|
||||
|
||||
/* check maximum value and a rough minimum size */
|
||||
if ( count > ( ( 1 << 16 ) - 2 ) / 5 ||
|
||||
2 + count * 5 >= stream->size - section_offset )
|
||||
{
|
||||
FT_ERROR(( "pfr_log_font_count:"
|
||||
" invalid number of logical fonts\n" ));
|
||||
error = FT_THROW( Invalid_Table );
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
result = count;
|
||||
|
||||
Exit:
|
||||
|
@ -254,13 +354,14 @@
|
|||
FT_UInt local;
|
||||
|
||||
|
||||
if ( FT_STREAM_SEEK( offset ) || FT_FRAME_ENTER( size ) )
|
||||
if ( FT_STREAM_SEEK( offset ) ||
|
||||
FT_FRAME_ENTER( size ) )
|
||||
goto Exit;
|
||||
|
||||
p = stream->cursor;
|
||||
limit = p + size;
|
||||
|
||||
PFR_CHECK(13);
|
||||
PFR_CHECK( 13 );
|
||||
|
||||
log_font->matrix[0] = PFR_NEXT_LONG( p );
|
||||
log_font->matrix[1] = PFR_NEXT_LONG( p );
|
||||
|
@ -308,10 +409,11 @@
|
|||
if ( flags & PFR_LOG_EXTRA_ITEMS )
|
||||
{
|
||||
error = pfr_extra_items_skip( &p, limit );
|
||||
if (error) goto Fail;
|
||||
if ( error )
|
||||
goto Fail;
|
||||
}
|
||||
|
||||
PFR_CHECK(5);
|
||||
PFR_CHECK( 5 );
|
||||
log_font->phys_size = PFR_NEXT_USHORT( p );
|
||||
log_font->phys_offset = PFR_NEXT_ULONG( p );
|
||||
if ( size_increment )
|
||||
|
@ -358,7 +460,7 @@
|
|||
|
||||
PFR_CHECK( 5 );
|
||||
|
||||
p += 3; /* skip bctSize */
|
||||
p += 3; /* skip bctSize */
|
||||
flags0 = PFR_NEXT_BYTE( p );
|
||||
count = PFR_NEXT_BYTE( p );
|
||||
|
||||
|
@ -434,12 +536,12 @@
|
|||
}
|
||||
|
||||
|
||||
/* Load font ID. This is a so-called "unique" name that is rather
|
||||
* long and descriptive (like "Tiresias ScreenFont v7.51").
|
||||
/* Load font ID. This is a so-called `unique' name that is rather
|
||||
* long and descriptive (like `Tiresias ScreenFont v7.51').
|
||||
*
|
||||
* Note that a PFR font's family name is contained in an *undocumented*
|
||||
* string of the "auxiliary data" portion of a physical font record. This
|
||||
* may also contain the "real" style name!
|
||||
* string of the `auxiliary data' portion of a physical font record. This
|
||||
* may also contain the `real' style name!
|
||||
*
|
||||
* If no family name is present, the font ID is used instead for the
|
||||
* family.
|
||||
|
@ -525,8 +627,6 @@
|
|||
FT_Memory memory = phy_font->memory;
|
||||
|
||||
|
||||
FT_TRACE2(( "pfr_extra_item_load_kerning_pairs()\n" ));
|
||||
|
||||
if ( FT_NEW( item ) )
|
||||
goto Exit;
|
||||
|
||||
|
@ -612,7 +712,6 @@
|
|||
}
|
||||
|
||||
|
||||
|
||||
static const PFR_ExtraItemRec pfr_phy_font_extra_items[] =
|
||||
{
|
||||
{ 1, (PFR_ExtraItem_ParseFunc)pfr_extra_item_load_bitmap_info },
|
||||
|
@ -623,7 +722,8 @@
|
|||
};
|
||||
|
||||
|
||||
/* Loads a name from the auxiliary data. Since this extracts undocumented
|
||||
/*
|
||||
* Load a name from the auxiliary data. Since this extracts undocumented
|
||||
* strings from the font file, we need to be careful here.
|
||||
*/
|
||||
static FT_Error
|
||||
|
@ -729,7 +829,8 @@
|
|||
phy_font->kern_items = NULL;
|
||||
phy_font->kern_items_tail = &phy_font->kern_items;
|
||||
|
||||
if ( FT_STREAM_SEEK( offset ) || FT_FRAME_ENTER( size ) )
|
||||
if ( FT_STREAM_SEEK( offset ) ||
|
||||
FT_FRAME_ENTER( size ) )
|
||||
goto Exit;
|
||||
|
||||
phy_font->cursor = stream->cursor;
|
||||
|
@ -757,16 +858,16 @@
|
|||
/* load the extra items when present */
|
||||
if ( flags & PFR_PHY_EXTRA_ITEMS )
|
||||
{
|
||||
error = pfr_extra_items_parse( &p, limit,
|
||||
pfr_phy_font_extra_items, phy_font );
|
||||
error = pfr_extra_items_parse( &p, limit,
|
||||
pfr_phy_font_extra_items, phy_font );
|
||||
|
||||
if ( error )
|
||||
goto Fail;
|
||||
}
|
||||
|
||||
/* In certain fonts, the auxiliary bytes contain interesting */
|
||||
/* information. These are not in the specification but can be */
|
||||
/* guessed by looking at the content of a few PFR0 fonts. */
|
||||
/* In certain fonts, the auxiliary bytes contain interesting */
|
||||
/* information. These are not in the specification but can be */
|
||||
/* guessed by looking at the content of a few PFR0 fonts. */
|
||||
PFR_CHECK( 3 );
|
||||
num_aux = PFR_NEXT_ULONG( p );
|
||||
|
||||
|
@ -776,7 +877,7 @@
|
|||
FT_Byte* q2;
|
||||
|
||||
|
||||
PFR_CHECK( num_aux );
|
||||
PFR_CHECK_SIZE( num_aux );
|
||||
p += num_aux;
|
||||
|
||||
while ( num_aux > 0 )
|
||||
|
@ -797,9 +898,8 @@
|
|||
switch ( type )
|
||||
{
|
||||
case 1:
|
||||
/* this seems to correspond to the font's family name,
|
||||
* padded to 16-bits with one zero when necessary
|
||||
*/
|
||||
/* this seems to correspond to the font's family name, padded to */
|
||||
/* an even number of bytes with a zero byte appended if needed */
|
||||
error = pfr_aux_name_load( q, length - 4U, memory,
|
||||
&phy_font->family_name );
|
||||
if ( error )
|
||||
|
@ -817,9 +917,8 @@
|
|||
break;
|
||||
|
||||
case 3:
|
||||
/* this seems to correspond to the font's style name,
|
||||
* padded to 16-bits with one zero when necessary
|
||||
*/
|
||||
/* this seems to correspond to the font's style name, padded to */
|
||||
/* an even number of bytes with a zero byte appended if needed */
|
||||
error = pfr_aux_name_load( q, length - 4U, memory,
|
||||
&phy_font->style_name );
|
||||
if ( error )
|
||||
|
@ -867,9 +966,6 @@
|
|||
phy_font->num_chars = count = PFR_NEXT_USHORT( p );
|
||||
phy_font->chars_offset = offset + (FT_Offset)( p - stream->cursor );
|
||||
|
||||
if ( FT_NEW_ARRAY( phy_font->chars, count ) )
|
||||
goto Fail;
|
||||
|
||||
Size = 1 + 1 + 2;
|
||||
if ( flags & PFR_PHY_2BYTE_CHARCODE )
|
||||
Size += 1;
|
||||
|
@ -886,7 +982,10 @@
|
|||
if ( flags & PFR_PHY_3BYTE_GPS_OFFSET )
|
||||
Size += 1;
|
||||
|
||||
PFR_CHECK( count * Size );
|
||||
PFR_CHECK_SIZE( count * Size );
|
||||
|
||||
if ( FT_NEW_ARRAY( phy_font->chars, count ) )
|
||||
goto Fail;
|
||||
|
||||
for ( n = 0; n < count; n++ )
|
||||
{
|
||||
|
|
15
reactos/lib/3rdparty/freetype/src/pfr/pfrload.h
vendored
15
reactos/lib/3rdparty/freetype/src/pfr/pfrload.h
vendored
|
@ -25,14 +25,19 @@
|
|||
|
||||
FT_BEGIN_HEADER
|
||||
|
||||
/* some size checks should be always done (mainly to prevent */
|
||||
/* excessive allocation for malformed data), ... */
|
||||
#define PFR_CHECK_SIZE( x ) do \
|
||||
{ \
|
||||
if ( p + (x) > limit ) \
|
||||
goto Too_Short; \
|
||||
} while ( 0 )
|
||||
|
||||
/* ... and some only if intensive checking is explicitly requested */
|
||||
#ifdef PFR_CONFIG_NO_CHECKS
|
||||
#define PFR_CHECK( x ) do { } while ( 0 )
|
||||
#else
|
||||
#define PFR_CHECK( x ) do \
|
||||
{ \
|
||||
if ( p + (x) > limit ) \
|
||||
goto Too_Short; \
|
||||
} while ( 0 )
|
||||
#define PFR_CHECK PFR_CHECK_SIZE
|
||||
#endif
|
||||
|
||||
#define PFR_NEXT_BYTE( p ) FT_NEXT_BYTE( p )
|
||||
|
|
25
reactos/lib/3rdparty/freetype/src/pfr/pfrobjs.c
vendored
25
reactos/lib/3rdparty/freetype/src/pfr/pfrobjs.c
vendored
|
@ -118,9 +118,11 @@
|
|||
|
||||
/* load the face */
|
||||
error = pfr_log_font_load(
|
||||
&face->log_font, stream, (FT_UInt)( face_index & 0xFFFF ),
|
||||
face->header.log_dir_offset,
|
||||
FT_BOOL( face->header.phy_font_max_size_high != 0 ) );
|
||||
&face->log_font,
|
||||
stream,
|
||||
(FT_UInt)( face_index & 0xFFFF ),
|
||||
face->header.log_dir_offset,
|
||||
FT_BOOL( face->header.phy_font_max_size_high != 0 ) );
|
||||
if ( error )
|
||||
goto Exit;
|
||||
|
||||
|
@ -141,8 +143,8 @@
|
|||
|
||||
pfrface->face_flags |= FT_FACE_FLAG_SCALABLE;
|
||||
|
||||
/* if all characters point to the same gps_offset 0, we */
|
||||
/* assume that the font only contains bitmaps */
|
||||
/* if gps_offset == 0 for all characters, we */
|
||||
/* assume that the font only contains bitmaps */
|
||||
{
|
||||
FT_UInt nn;
|
||||
|
||||
|
@ -164,7 +166,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
if ( (phy_font->flags & PFR_PHY_PROPORTIONAL) == 0 )
|
||||
if ( ( phy_font->flags & PFR_PHY_PROPORTIONAL ) == 0 )
|
||||
pfrface->face_flags |= FT_FACE_FLAG_FIXED_WIDTH;
|
||||
|
||||
if ( phy_font->flags & PFR_PHY_VERTICAL )
|
||||
|
@ -178,7 +180,7 @@
|
|||
if ( phy_font->num_kern_pairs > 0 )
|
||||
pfrface->face_flags |= FT_FACE_FLAG_KERNING;
|
||||
|
||||
/* If no family name was found in the "undocumented" auxiliary
|
||||
/* If no family name was found in the `undocumented' auxiliary
|
||||
* data, use the font ID instead. This sucks but is better than
|
||||
* nothing.
|
||||
*/
|
||||
|
@ -187,7 +189,7 @@
|
|||
pfrface->family_name = phy_font->font_id;
|
||||
|
||||
/* note that the style name can be NULL in certain PFR fonts,
|
||||
* probably meaning "Regular"
|
||||
* probably meaning `Regular'
|
||||
*/
|
||||
pfrface->style_name = phy_font->style_name;
|
||||
|
||||
|
@ -264,13 +266,13 @@
|
|||
error = FT_CMap_New( &pfr_cmap_class_rec, NULL, &charmap, NULL );
|
||||
|
||||
#if 0
|
||||
/* Select default charmap */
|
||||
/* select default charmap */
|
||||
if ( pfrface->num_charmaps )
|
||||
pfrface->charmap = pfrface->charmaps[0];
|
||||
#endif
|
||||
}
|
||||
|
||||
/* check whether we've loaded any kerning pairs */
|
||||
/* check whether we have loaded any kerning pairs */
|
||||
if ( phy_font->num_kern_pairs )
|
||||
pfrface->face_flags |= FT_FACE_FLAG_KERNING;
|
||||
}
|
||||
|
@ -402,7 +404,7 @@
|
|||
pfrslot->linearHoriAdvance = metrics->horiAdvance;
|
||||
pfrslot->linearVertAdvance = metrics->vertAdvance;
|
||||
|
||||
/* make-up vertical metrics(?) */
|
||||
/* make up vertical metrics(?) */
|
||||
metrics->vertBearingX = 0;
|
||||
metrics->vertBearingY = 0;
|
||||
|
||||
|
@ -596,4 +598,5 @@
|
|||
return error;
|
||||
}
|
||||
|
||||
|
||||
/* END */
|
||||
|
|
81
reactos/lib/3rdparty/freetype/src/pfr/pfrsbit.c
vendored
81
reactos/lib/3rdparty/freetype/src/pfr/pfrsbit.c
vendored
|
@ -37,11 +37,11 @@
|
|||
|
||||
typedef struct PFR_BitWriter_
|
||||
{
|
||||
FT_Byte* line; /* current line start */
|
||||
FT_Int pitch; /* line size in bytes */
|
||||
FT_UInt width; /* width in pixels/bits */
|
||||
FT_UInt rows; /* number of remaining rows to scan */
|
||||
FT_UInt total; /* total number of bits to draw */
|
||||
FT_Byte* line; /* current line start */
|
||||
FT_Int pitch; /* line size in bytes */
|
||||
FT_UInt width; /* width in pixels/bits */
|
||||
FT_UInt rows; /* number of remaining rows to scan */
|
||||
FT_UInt total; /* total number of bits to draw */
|
||||
|
||||
} PFR_BitWriterRec, *PFR_BitWriter;
|
||||
|
||||
|
@ -341,8 +341,8 @@
|
|||
}
|
||||
|
||||
|
||||
/* load bitmap metrics. "*padvance" must be set to the default value */
|
||||
/* before calling this function... */
|
||||
/* load bitmap metrics. `*padvance' must be set to the default value */
|
||||
/* before calling this function */
|
||||
/* */
|
||||
static FT_Error
|
||||
pfr_load_bitmap_metrics( FT_Byte** pdata,
|
||||
|
@ -510,8 +510,7 @@
|
|||
break;
|
||||
|
||||
default:
|
||||
FT_ERROR(( "pfr_read_bitmap_data: invalid image type\n" ));
|
||||
error = FT_THROW( Invalid_File_Format );
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -544,7 +543,7 @@
|
|||
|
||||
character = &phys->chars[glyph_index];
|
||||
|
||||
/* Look-up a bitmap strike corresponding to the current */
|
||||
/* look up a bitmap strike corresponding to the current */
|
||||
/* character dimensions */
|
||||
{
|
||||
FT_UInt n;
|
||||
|
@ -555,9 +554,7 @@
|
|||
{
|
||||
if ( strike->x_ppm == (FT_UInt)size->root.metrics.x_ppem &&
|
||||
strike->y_ppm == (FT_UInt)size->root.metrics.y_ppem )
|
||||
{
|
||||
goto Found_Strike;
|
||||
}
|
||||
|
||||
strike++;
|
||||
}
|
||||
|
@ -568,7 +565,7 @@
|
|||
|
||||
Found_Strike:
|
||||
|
||||
/* Now lookup the glyph's position within the file */
|
||||
/* now look up the glyph's position within the file */
|
||||
{
|
||||
FT_UInt char_len;
|
||||
|
||||
|
@ -578,7 +575,7 @@
|
|||
if ( strike->flags & 2 ) char_len += 1;
|
||||
if ( strike->flags & 4 ) char_len += 1;
|
||||
|
||||
/* Access data directly in the frame to speed lookups */
|
||||
/* access data directly in the frame to speed lookups */
|
||||
if ( FT_STREAM_SEEK( phys->bct_offset + strike->bct_offset ) ||
|
||||
FT_FRAME_ENTER( char_len * strike->num_bitmaps ) )
|
||||
goto Exit;
|
||||
|
@ -595,7 +592,7 @@
|
|||
|
||||
if ( gps_size == 0 )
|
||||
{
|
||||
/* Could not find a bitmap program string for this glyph */
|
||||
/* could not find a bitmap program string for this glyph */
|
||||
error = FT_THROW( Invalid_Argument );
|
||||
goto Exit;
|
||||
}
|
||||
|
@ -617,8 +614,8 @@
|
|||
|
||||
glyph->root.linearHoriAdvance = advance;
|
||||
|
||||
/* compute default advance, i.e., scaled advance. This can be */
|
||||
/* overridden in the bitmap header of certain glyphs. */
|
||||
/* compute default advance, i.e., scaled advance; this can be */
|
||||
/* overridden in the bitmap header of certain glyphs */
|
||||
advance = FT_MulDiv( (FT_Fixed)size->root.metrics.x_ppem << 8,
|
||||
character->advance,
|
||||
(FT_Long)phys->metrics_resolution );
|
||||
|
@ -634,6 +631,53 @@
|
|||
&xsize, &ysize,
|
||||
&advance, &format );
|
||||
|
||||
/*
|
||||
* Before allocating the target bitmap, we check whether the given
|
||||
* bitmap dimensions are valid, depending on the image format.
|
||||
*
|
||||
* Format 0: We have a stream of pixels (with 8 pixels per byte).
|
||||
*
|
||||
* (xsize * ysize + 7) / 8 <= gps_size
|
||||
*
|
||||
* Format 1: Run-length encoding; the high nibble holds the number of
|
||||
* white bits, the low nibble the number of black bits. In
|
||||
* other words, a single byte can represent at most 15
|
||||
* pixels.
|
||||
*
|
||||
* xsize * ysize <= 15 * gps_size
|
||||
*
|
||||
* Format 2: Run-length encoding; the high byte holds the number of
|
||||
* white bits, the low byte the number of black bits. In
|
||||
* other words, two bytes can represent at most 255 pixels.
|
||||
*
|
||||
* xsize * ysize <= 255 * (gps_size + 1) / 2
|
||||
*/
|
||||
switch ( format )
|
||||
{
|
||||
case 0:
|
||||
if ( ( (FT_ULong)xsize * ysize + 7 ) / 8 > gps_size )
|
||||
error = FT_THROW( Invalid_Table );
|
||||
break;
|
||||
case 1:
|
||||
if ( (FT_ULong)xsize * ysize > 15 * gps_size )
|
||||
error = FT_THROW( Invalid_Table );
|
||||
break;
|
||||
case 2:
|
||||
if ( (FT_ULong)xsize * ysize > 255 * ( ( gps_size + 1 ) / 2 ) )
|
||||
error = FT_THROW( Invalid_Table );
|
||||
break;
|
||||
default:
|
||||
FT_ERROR(( "pfr_slot_load_bitmap: invalid image type\n" ));
|
||||
error = FT_THROW( Invalid_Table );
|
||||
}
|
||||
|
||||
if ( error )
|
||||
{
|
||||
if ( FT_ERR_EQ( error, Invalid_Table ) )
|
||||
FT_ERROR(( "pfr_slot_load_bitmap: invalid bitmap dimensions\n" ));
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
/*
|
||||
* XXX: on 16bit systems we return an error for huge bitmaps
|
||||
* that cause size truncation, because truncated
|
||||
|
@ -684,14 +728,12 @@
|
|||
|
||||
error = ft_glyphslot_alloc_bitmap( &glyph->root, len );
|
||||
if ( !error )
|
||||
{
|
||||
error = pfr_load_bitmap_bits(
|
||||
p,
|
||||
stream->limit,
|
||||
format,
|
||||
FT_BOOL(face->header.color_flags & 2),
|
||||
&glyph->root.bitmap );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -702,4 +744,5 @@
|
|||
return error;
|
||||
}
|
||||
|
||||
|
||||
/* END */
|
||||
|
|
|
@ -512,7 +512,7 @@
|
|||
break;
|
||||
|
||||
case 12:
|
||||
if ( ip > limit )
|
||||
if ( ip >= limit )
|
||||
{
|
||||
FT_ERROR(( "t1_decoder_parse_charstrings:"
|
||||
" invalid escape (12+EOF)\n" ));
|
||||
|
@ -669,7 +669,7 @@
|
|||
if ( large_int )
|
||||
FT_TRACE4(( " %ld", value ));
|
||||
else
|
||||
FT_TRACE4(( " %ld", Fix2Int( value ) ));
|
||||
FT_TRACE4(( " %ld", value / 65536 ));
|
||||
#endif
|
||||
|
||||
*top++ = value;
|
||||
|
|
|
@ -525,31 +525,31 @@
|
|||
|
||||
FT_DEFINE_SERVICE_PSCMAPSREC(
|
||||
pscmaps_interface,
|
||||
(PS_Unicode_ValueFunc) ps_unicode_value,
|
||||
(PS_Unicodes_InitFunc) ps_unicodes_init,
|
||||
(PS_Unicodes_CharIndexFunc)ps_unicodes_char_index,
|
||||
(PS_Unicodes_CharNextFunc) ps_unicodes_char_next,
|
||||
(PS_Unicode_ValueFunc) ps_unicode_value, /* unicode_value */
|
||||
(PS_Unicodes_InitFunc) ps_unicodes_init, /* unicodes_init */
|
||||
(PS_Unicodes_CharIndexFunc)ps_unicodes_char_index, /* unicodes_char_index */
|
||||
(PS_Unicodes_CharNextFunc) ps_unicodes_char_next, /* unicodes_char_next */
|
||||
|
||||
(PS_Macintosh_NameFunc) ps_get_macintosh_name,
|
||||
(PS_Adobe_Std_StringsFunc) ps_get_standard_strings,
|
||||
(PS_Macintosh_NameFunc) ps_get_macintosh_name, /* macintosh_name */
|
||||
(PS_Adobe_Std_StringsFunc) ps_get_standard_strings, /* adobe_std_strings */
|
||||
|
||||
t1_standard_encoding,
|
||||
t1_expert_encoding )
|
||||
t1_standard_encoding, /* adobe_std_encoding */
|
||||
t1_expert_encoding ) /* adobe_expert_encoding */
|
||||
|
||||
#else
|
||||
|
||||
FT_DEFINE_SERVICE_PSCMAPSREC(
|
||||
pscmaps_interface,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL, /* unicode_value */
|
||||
NULL, /* unicodes_init */
|
||||
NULL, /* unicodes_char_index */
|
||||
NULL, /* unicodes_char_next */
|
||||
|
||||
(PS_Macintosh_NameFunc) ps_get_macintosh_name,
|
||||
(PS_Adobe_Std_StringsFunc) ps_get_standard_strings,
|
||||
(PS_Macintosh_NameFunc) ps_get_macintosh_name, /* macintosh_name */
|
||||
(PS_Adobe_Std_StringsFunc) ps_get_standard_strings, /* adobe_std_strings */
|
||||
|
||||
t1_standard_encoding,
|
||||
t1_expert_encoding )
|
||||
t1_standard_encoding, /* adobe_std_encoding */
|
||||
t1_expert_encoding ) /* adobe_expert_encoding */
|
||||
|
||||
#endif /* FT_CONFIG_OPTION_ADOBE_GLYPH_LIST */
|
||||
|
||||
|
|
|
@ -139,9 +139,9 @@
|
|||
|
||||
FT_DEFINE_SERVICE_SFNT_TABLEREC(
|
||||
sfnt_service_sfnt_table,
|
||||
(FT_SFNT_TableLoadFunc)tt_face_load_any,
|
||||
(FT_SFNT_TableGetFunc) get_sfnt_table,
|
||||
(FT_SFNT_TableInfoFunc)sfnt_table_info )
|
||||
(FT_SFNT_TableLoadFunc)tt_face_load_any, /* load_table */
|
||||
(FT_SFNT_TableGetFunc) get_sfnt_table, /* get_table */
|
||||
(FT_SFNT_TableInfoFunc)sfnt_table_info ) /* table_info */
|
||||
|
||||
|
||||
#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
|
||||
|
@ -205,8 +205,8 @@
|
|||
|
||||
FT_DEFINE_SERVICE_GLYPHDICTREC(
|
||||
sfnt_service_glyph_dict,
|
||||
(FT_GlyphDict_GetNameFunc) sfnt_get_glyph_name,
|
||||
(FT_GlyphDict_NameIndexFunc)sfnt_get_name_index )
|
||||
(FT_GlyphDict_GetNameFunc) sfnt_get_glyph_name, /* get_name */
|
||||
(FT_GlyphDict_NameIndexFunc)sfnt_get_name_index ) /* name_index */
|
||||
|
||||
|
||||
#endif /* TT_CONFIG_OPTION_POSTSCRIPT_NAMES */
|
||||
|
@ -330,7 +330,7 @@
|
|||
|
||||
FT_DEFINE_SERVICE_PSFONTNAMEREC(
|
||||
sfnt_service_ps_name,
|
||||
(FT_PsName_GetFunc)sfnt_get_ps_name )
|
||||
(FT_PsName_GetFunc)sfnt_get_ps_name ) /* get_ps_font_name */
|
||||
|
||||
|
||||
/*
|
||||
|
@ -338,7 +338,7 @@
|
|||
*/
|
||||
FT_DEFINE_SERVICE_TTCMAPSREC(
|
||||
tt_service_get_cmap_info,
|
||||
(TT_CMap_Info_GetFunc)tt_get_cmap_info )
|
||||
(TT_CMap_Info_GetFunc)tt_get_cmap_info ) /* get_cmap_info */
|
||||
|
||||
|
||||
#ifdef TT_CONFIG_OPTION_BDF
|
||||
|
@ -381,8 +381,8 @@
|
|||
|
||||
FT_DEFINE_SERVICE_BDFRec(
|
||||
sfnt_service_bdf,
|
||||
(FT_BDF_GetCharsetIdFunc)sfnt_get_charset_id,
|
||||
(FT_BDF_GetPropertyFunc) tt_face_find_bdf_prop )
|
||||
(FT_BDF_GetCharsetIdFunc)sfnt_get_charset_id, /* get_charset_id */
|
||||
(FT_BDF_GetPropertyFunc) tt_face_find_bdf_prop ) /* get_property */
|
||||
|
||||
|
||||
#endif /* TT_CONFIG_OPTION_BDF */
|
||||
|
|
64
reactos/lib/3rdparty/freetype/src/sfnt/sfobjs.c
vendored
64
reactos/lib/3rdparty/freetype/src/sfnt/sfobjs.c
vendored
|
@ -451,10 +451,14 @@
|
|||
woff.metaOrigLength != 0 ) ) ||
|
||||
( woff.metaLength != 0 && woff.metaOrigLength == 0 ) ||
|
||||
( woff.privOffset == 0 && woff.privLength != 0 ) )
|
||||
{
|
||||
FT_ERROR(( "woff_font_open: invalid WOFF header\n" ));
|
||||
return FT_THROW( Invalid_Table );
|
||||
}
|
||||
|
||||
if ( FT_ALLOC( sfnt, woff.totalSfntSize ) ||
|
||||
FT_NEW( sfnt_stream ) )
|
||||
/* Don't trust `totalSfntSize' before thorough checks. */
|
||||
if ( FT_ALLOC( sfnt, 12 + woff.num_tables * 16UL ) ||
|
||||
FT_NEW( sfnt_stream ) )
|
||||
goto Exit;
|
||||
|
||||
sfnt_header = sfnt;
|
||||
|
@ -521,6 +525,8 @@
|
|||
if ( table->Tag <= old_tag )
|
||||
{
|
||||
FT_FRAME_EXIT();
|
||||
|
||||
FT_ERROR(( "woff_font_open: table tags are not sorted\n" ));
|
||||
error = FT_THROW( Invalid_Table );
|
||||
goto Exit;
|
||||
}
|
||||
|
@ -555,6 +561,7 @@
|
|||
sfnt_offset > woff.totalSfntSize - table->OrigLength ||
|
||||
table->CompLength > table->OrigLength )
|
||||
{
|
||||
FT_ERROR(( "woff_font_open: invalid table offsets\n" ));
|
||||
error = FT_THROW( Invalid_Table );
|
||||
goto Exit;
|
||||
}
|
||||
|
@ -580,6 +587,8 @@
|
|||
if ( woff.metaOffset != woff_offset ||
|
||||
woff.metaOffset + woff.metaLength > woff.length )
|
||||
{
|
||||
FT_ERROR(( "woff_font_open:"
|
||||
" invalid `metadata' offset or length\n" ));
|
||||
error = FT_THROW( Invalid_Table );
|
||||
goto Exit;
|
||||
}
|
||||
|
@ -596,6 +605,7 @@
|
|||
if ( woff.privOffset != woff_offset ||
|
||||
woff.privOffset + woff.privLength > woff.length )
|
||||
{
|
||||
FT_ERROR(( "woff_font_open: invalid `private' offset or length\n" ));
|
||||
error = FT_THROW( Invalid_Table );
|
||||
goto Exit;
|
||||
}
|
||||
|
@ -607,10 +617,19 @@
|
|||
if ( sfnt_offset != woff.totalSfntSize ||
|
||||
woff_offset != woff.length )
|
||||
{
|
||||
FT_ERROR(( "woff_font_open: invalid `sfnt' table structure\n" ));
|
||||
error = FT_THROW( Invalid_Table );
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
/* Now use `totalSfntSize'. */
|
||||
if ( FT_REALLOC( sfnt,
|
||||
12 + woff.num_tables * 16UL,
|
||||
woff.totalSfntSize ) )
|
||||
goto Exit;
|
||||
|
||||
sfnt_header = sfnt + 12;
|
||||
|
||||
/* Write the tables. */
|
||||
|
||||
for ( nn = 0; nn < woff.num_tables; nn++ )
|
||||
|
@ -651,6 +670,7 @@
|
|||
goto Exit;
|
||||
if ( output_len != table->OrigLength )
|
||||
{
|
||||
FT_ERROR(( "woff_font_open: compressed table length mismatch\n" ));
|
||||
error = FT_THROW( Invalid_Table );
|
||||
goto Exit;
|
||||
}
|
||||
|
@ -883,9 +903,17 @@
|
|||
|
||||
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
||||
{
|
||||
FT_ULong fvar_len;
|
||||
FT_ULong fvar_len;
|
||||
|
||||
FT_ULong version;
|
||||
FT_ULong offset;
|
||||
|
||||
FT_UShort num_axes;
|
||||
FT_UShort axis_size;
|
||||
FT_UShort num_instances;
|
||||
FT_Int instance_index;
|
||||
FT_UShort instance_size;
|
||||
|
||||
FT_Int instance_index;
|
||||
|
||||
|
||||
instance_index = FT_ABS( face_instance_index ) >> 16;
|
||||
|
@ -893,8 +921,32 @@
|
|||
/* test whether current face is a GX font with named instances */
|
||||
if ( face->goto_table( face, TTAG_fvar, stream, &fvar_len ) ||
|
||||
fvar_len < 20 ||
|
||||
FT_STREAM_SKIP( 12 ) ||
|
||||
FT_READ_USHORT( num_instances ) )
|
||||
FT_READ_ULONG( version ) ||
|
||||
FT_READ_USHORT( offset ) ||
|
||||
FT_STREAM_SKIP( 2 ) ||
|
||||
FT_READ_USHORT( num_axes ) ||
|
||||
FT_READ_USHORT( axis_size ) ||
|
||||
FT_READ_USHORT( num_instances ) ||
|
||||
FT_READ_USHORT( instance_size ) )
|
||||
{
|
||||
version = 0;
|
||||
offset = 0;
|
||||
num_axes = 0;
|
||||
axis_size = 0;
|
||||
num_instances = 0;
|
||||
instance_size = 0;
|
||||
}
|
||||
|
||||
/* check that the data is bound by the table length; */
|
||||
/* based on similar code in function `TT_Get_MM_Var' */
|
||||
if ( version != 0x00010000UL ||
|
||||
axis_size != 20 ||
|
||||
num_axes > 0x3FFE ||
|
||||
instance_size != 4 + 4 * num_axes ||
|
||||
num_instances > 0x7EFF ||
|
||||
offset +
|
||||
axis_size * num_axes +
|
||||
instance_size * num_instances > fvar_len )
|
||||
num_instances = 0;
|
||||
|
||||
/* we support at most 2^15 - 1 instances */
|
||||
|
|
36
reactos/lib/3rdparty/freetype/src/sfnt/ttcmap.c
vendored
36
reactos/lib/3rdparty/freetype/src/sfnt/ttcmap.c
vendored
|
@ -774,7 +774,7 @@
|
|||
if ( charcode < cmap->cur_start )
|
||||
charcode = cmap->cur_start;
|
||||
|
||||
for ( ;; )
|
||||
for (;;)
|
||||
{
|
||||
FT_Byte* values = cmap->cur_values;
|
||||
FT_UInt end = cmap->cur_end;
|
||||
|
@ -1891,7 +1891,10 @@
|
|||
/* if `gindex' is invalid, the remaining values */
|
||||
/* in this group are invalid, too */
|
||||
if ( gindex >= (FT_UInt)face->num_glyphs )
|
||||
{
|
||||
gindex = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
result = char_code;
|
||||
break;
|
||||
|
@ -2277,7 +2280,10 @@
|
|||
/* if `gindex' is invalid, the remaining values */
|
||||
/* in this group are invalid, too */
|
||||
if ( gindex >= (FT_UInt)face->num_glyphs )
|
||||
{
|
||||
gindex = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
cmap->cur_charcode = char_code;
|
||||
cmap->cur_gindex = gindex;
|
||||
|
@ -2962,12 +2968,17 @@
|
|||
/* through the normal Unicode cmap, no GIDs, just check order) */
|
||||
if ( defOff != 0 )
|
||||
{
|
||||
FT_Byte* defp = table + defOff;
|
||||
FT_ULong numRanges = TT_NEXT_ULONG( defp );
|
||||
FT_Byte* defp = table + defOff;
|
||||
FT_ULong numRanges;
|
||||
FT_ULong i;
|
||||
FT_ULong lastBase = 0;
|
||||
FT_ULong lastBase = 0;
|
||||
|
||||
|
||||
if ( defp + 4 > valid->limit )
|
||||
FT_INVALID_TOO_SHORT;
|
||||
|
||||
numRanges = TT_NEXT_ULONG( defp );
|
||||
|
||||
/* defp + numRanges * 4 > valid->limit ? */
|
||||
if ( numRanges > (FT_ULong)( valid->limit - defp ) / 4 )
|
||||
FT_INVALID_TOO_SHORT;
|
||||
|
@ -2991,13 +3002,18 @@
|
|||
/* and the non-default table (these glyphs are specified here) */
|
||||
if ( nondefOff != 0 )
|
||||
{
|
||||
FT_Byte* ndp = table + nondefOff;
|
||||
FT_ULong numMappings = TT_NEXT_ULONG( ndp );
|
||||
FT_ULong i, lastUni = 0;
|
||||
FT_Byte* ndp = table + nondefOff;
|
||||
FT_ULong numMappings;
|
||||
FT_ULong i, lastUni = 0;
|
||||
|
||||
|
||||
/* numMappings * 4 > (FT_ULong)( valid->limit - ndp ) ? */
|
||||
if ( numMappings > ( (FT_ULong)( valid->limit - ndp ) ) / 4 )
|
||||
if ( ndp + 4 > valid->limit )
|
||||
FT_INVALID_TOO_SHORT;
|
||||
|
||||
numMappings = TT_NEXT_ULONG( ndp );
|
||||
|
||||
/* numMappings * 5 > (FT_ULong)( valid->limit - ndp ) ? */
|
||||
if ( numMappings > ( (FT_ULong)( valid->limit - ndp ) ) / 5 )
|
||||
FT_INVALID_TOO_SHORT;
|
||||
|
||||
for ( i = 0; i < numMappings; ++i )
|
||||
|
@ -3442,7 +3458,7 @@
|
|||
ni = 1;
|
||||
i = 0;
|
||||
|
||||
for ( ;; )
|
||||
for (;;)
|
||||
{
|
||||
if ( nuni > duni + dcnt )
|
||||
{
|
||||
|
|
163
reactos/lib/3rdparty/freetype/src/sfnt/ttsbit.c
vendored
163
reactos/lib/3rdparty/freetype/src/sfnt/ttsbit.c
vendored
|
@ -104,7 +104,8 @@
|
|||
version = FT_NEXT_LONG( p );
|
||||
num_strikes = FT_NEXT_ULONG( p );
|
||||
|
||||
if ( ( (FT_ULong)version & 0xFFFF0000UL ) != 0x00020000UL )
|
||||
if ( ( (FT_ULong)version & 0xFFFF0000UL ) != 0x00020000UL &&
|
||||
( (FT_ULong)version & 0xFFFF0000UL ) != 0x00030000UL )
|
||||
{
|
||||
error = FT_THROW( Unknown_File_Format );
|
||||
goto Exit;
|
||||
|
@ -247,6 +248,8 @@
|
|||
case TT_SBIT_TABLE_TYPE_CBLC:
|
||||
{
|
||||
FT_Byte* strike;
|
||||
FT_Char max_before_bl;
|
||||
FT_Char min_after_bl;
|
||||
|
||||
|
||||
strike = face->sbit_table + 8 + strike_index * 48;
|
||||
|
@ -256,7 +259,64 @@
|
|||
|
||||
metrics->ascender = (FT_Char)strike[16] * 64; /* hori.ascender */
|
||||
metrics->descender = (FT_Char)strike[17] * 64; /* hori.descender */
|
||||
metrics->height = metrics->ascender - metrics->descender;
|
||||
|
||||
/* Due to fuzzy wording in the EBLC documentation, we find both */
|
||||
/* positive and negative values for `descender'. Additionally, */
|
||||
/* many fonts have both `ascender' and `descender' set to zero */
|
||||
/* (which is definitely wrong). MS Windows simply ignores all */
|
||||
/* those values... For these reasons we apply some heuristics */
|
||||
/* to get a reasonable, non-zero value for the height. */
|
||||
|
||||
max_before_bl = (FT_Char)strike[24];
|
||||
min_after_bl = (FT_Char)strike[25];
|
||||
|
||||
if ( metrics->descender > 0 )
|
||||
{
|
||||
/* compare sign of descender with `min_after_bl' */
|
||||
if ( min_after_bl < 0 )
|
||||
metrics->descender = -metrics->descender;
|
||||
}
|
||||
|
||||
else if ( metrics->descender == 0 )
|
||||
{
|
||||
if ( metrics->ascender == 0 )
|
||||
{
|
||||
FT_TRACE2(( "tt_face_load_strike_metrics:"
|
||||
" sanitizing invalid ascender and descender\n"
|
||||
" "
|
||||
" values for strike (%d, %d)\n",
|
||||
metrics->x_ppem, metrics->y_ppem ));
|
||||
|
||||
/* sanitize buggy ascender and descender values */
|
||||
if ( max_before_bl || min_after_bl )
|
||||
{
|
||||
metrics->ascender = max_before_bl * 64;
|
||||
metrics->descender = min_after_bl * 64;
|
||||
}
|
||||
else
|
||||
{
|
||||
metrics->ascender = metrics->y_ppem * 64;
|
||||
metrics->descender = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
else
|
||||
; /* if we have a negative descender, simply use it */
|
||||
#endif
|
||||
|
||||
metrics->height = metrics->ascender - metrics->descender;
|
||||
if ( metrics->height == 0 )
|
||||
{
|
||||
FT_TRACE2(( "tt_face_load_strike_metrics:"
|
||||
" sanitizing invalid height value\n"
|
||||
" "
|
||||
" for strike (%d, %d)\n",
|
||||
metrics->x_ppem, metrics->y_ppem ));
|
||||
metrics->height = metrics->y_ppem * 64;
|
||||
metrics->descender = metrics->ascender - metrics->height;
|
||||
}
|
||||
|
||||
/* Is this correct? */
|
||||
metrics->max_advance = ( (FT_Char)strike[22] + /* min_origin_SB */
|
||||
|
@ -269,11 +329,11 @@
|
|||
case TT_SBIT_TABLE_TYPE_SBIX:
|
||||
{
|
||||
FT_Stream stream = face->root.stream;
|
||||
FT_UInt offset, upem;
|
||||
FT_UShort ppem, resolution;
|
||||
FT_UInt offset;
|
||||
FT_UShort upem, ppem, resolution;
|
||||
TT_HoriHeader *hori;
|
||||
FT_ULong table_size;
|
||||
FT_Pos ppem_, upem_; /* to reduce casts */
|
||||
FT_Pos ppem_; /* to reduce casts */
|
||||
|
||||
FT_Error error;
|
||||
FT_Byte* p;
|
||||
|
@ -307,14 +367,16 @@
|
|||
metrics->y_ppem = ppem;
|
||||
|
||||
ppem_ = (FT_Pos)ppem;
|
||||
upem_ = (FT_Pos)upem;
|
||||
|
||||
metrics->ascender = ppem_ * hori->Ascender * 64 / upem_;
|
||||
metrics->descender = ppem_ * hori->Descender * 64 / upem_;
|
||||
metrics->height = ppem_ * ( hori->Ascender -
|
||||
hori->Descender +
|
||||
hori->Line_Gap ) * 64 / upem_;
|
||||
metrics->max_advance = ppem_ * hori->advance_Width_Max * 64 / upem_;
|
||||
metrics->ascender =
|
||||
FT_MulDiv( hori->Ascender, ppem_ * 64, upem );
|
||||
metrics->descender =
|
||||
FT_MulDiv( hori->Descender, ppem_ * 64, upem );
|
||||
metrics->height =
|
||||
FT_MulDiv( hori->Ascender - hori->Descender + hori->Line_Gap,
|
||||
ppem_ * 64, upem );
|
||||
metrics->max_advance =
|
||||
FT_MulDiv( hori->advance_Width_Max, ppem_ * 64, upem );
|
||||
|
||||
return error;
|
||||
}
|
||||
|
@ -547,13 +609,16 @@
|
|||
tt_sbit_decoder_load_image( TT_SBitDecoder decoder,
|
||||
FT_UInt glyph_index,
|
||||
FT_Int x_pos,
|
||||
FT_Int y_pos );
|
||||
FT_Int y_pos,
|
||||
FT_UInt recurse_count );
|
||||
|
||||
typedef FT_Error (*TT_SBitDecoder_LoadFunc)( TT_SBitDecoder decoder,
|
||||
FT_Byte* p,
|
||||
FT_Byte* plimit,
|
||||
FT_Int x_pos,
|
||||
FT_Int y_pos );
|
||||
typedef FT_Error (*TT_SBitDecoder_LoadFunc)(
|
||||
TT_SBitDecoder decoder,
|
||||
FT_Byte* p,
|
||||
FT_Byte* plimit,
|
||||
FT_Int x_pos,
|
||||
FT_Int y_pos,
|
||||
FT_UInt recurse_count );
|
||||
|
||||
|
||||
static FT_Error
|
||||
|
@ -561,7 +626,8 @@
|
|||
FT_Byte* p,
|
||||
FT_Byte* limit,
|
||||
FT_Int x_pos,
|
||||
FT_Int y_pos )
|
||||
FT_Int y_pos,
|
||||
FT_UInt recurse_count )
|
||||
{
|
||||
FT_Error error = FT_Err_Ok;
|
||||
FT_Byte* line;
|
||||
|
@ -569,6 +635,8 @@
|
|||
FT_UInt bit_height, bit_width;
|
||||
FT_Bitmap* bitmap;
|
||||
|
||||
FT_UNUSED( recurse_count );
|
||||
|
||||
|
||||
/* check that we can write the glyph into the bitmap */
|
||||
bitmap = decoder->bitmap;
|
||||
|
@ -700,7 +768,8 @@
|
|||
FT_Byte* p,
|
||||
FT_Byte* limit,
|
||||
FT_Int x_pos,
|
||||
FT_Int y_pos )
|
||||
FT_Int y_pos,
|
||||
FT_UInt recurse_count )
|
||||
{
|
||||
FT_Error error = FT_Err_Ok;
|
||||
FT_Byte* line;
|
||||
|
@ -709,6 +778,8 @@
|
|||
FT_Bitmap* bitmap;
|
||||
FT_UShort rval;
|
||||
|
||||
FT_UNUSED( recurse_count );
|
||||
|
||||
|
||||
/* check that we can write the glyph into the bitmap */
|
||||
bitmap = decoder->bitmap;
|
||||
|
@ -738,6 +809,12 @@
|
|||
goto Exit;
|
||||
}
|
||||
|
||||
if ( !line_bits || !height )
|
||||
{
|
||||
/* nothing to do */
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
/* now do the blit */
|
||||
|
||||
/* adjust `line' to point to the first byte of the bitmap */
|
||||
|
@ -824,7 +901,8 @@
|
|||
FT_Byte* p,
|
||||
FT_Byte* limit,
|
||||
FT_Int x_pos,
|
||||
FT_Int y_pos )
|
||||
FT_Int y_pos,
|
||||
FT_UInt recurse_count )
|
||||
{
|
||||
FT_Error error = FT_Err_Ok;
|
||||
FT_UInt num_components, nn;
|
||||
|
@ -858,8 +936,11 @@
|
|||
|
||||
|
||||
/* NB: a recursive call */
|
||||
error = tt_sbit_decoder_load_image( decoder, gindex,
|
||||
x_pos + dx, y_pos + dy );
|
||||
error = tt_sbit_decoder_load_image( decoder,
|
||||
gindex,
|
||||
x_pos + dx,
|
||||
y_pos + dy,
|
||||
recurse_count + 1 );
|
||||
if ( error )
|
||||
break;
|
||||
}
|
||||
|
@ -891,11 +972,14 @@
|
|||
FT_Byte* p,
|
||||
FT_Byte* limit,
|
||||
FT_Int x_pos,
|
||||
FT_Int y_pos )
|
||||
FT_Int y_pos,
|
||||
FT_UInt recurse_count )
|
||||
{
|
||||
FT_Error error = FT_Err_Ok;
|
||||
FT_ULong png_len;
|
||||
|
||||
FT_UNUSED( recurse_count );
|
||||
|
||||
|
||||
if ( limit - p < 4 )
|
||||
{
|
||||
|
@ -937,7 +1021,8 @@
|
|||
FT_ULong glyph_start,
|
||||
FT_ULong glyph_size,
|
||||
FT_Int x_pos,
|
||||
FT_Int y_pos )
|
||||
FT_Int y_pos,
|
||||
FT_UInt recurse_count )
|
||||
{
|
||||
FT_Error error;
|
||||
FT_Stream stream = decoder->stream;
|
||||
|
@ -947,7 +1032,8 @@
|
|||
|
||||
|
||||
/* seek into the EBDT table now */
|
||||
if ( glyph_start + glyph_size > decoder->ebdt_size )
|
||||
if ( !glyph_size ||
|
||||
glyph_start + glyph_size > decoder->ebdt_size )
|
||||
{
|
||||
error = FT_THROW( Invalid_Argument );
|
||||
goto Exit;
|
||||
|
@ -1063,7 +1149,7 @@
|
|||
goto Fail;
|
||||
}
|
||||
|
||||
error = loader( decoder, p, p_limit, x_pos, y_pos );
|
||||
error = loader( decoder, p, p_limit, x_pos, y_pos, recurse_count );
|
||||
}
|
||||
|
||||
Fail:
|
||||
|
@ -1078,13 +1164,9 @@
|
|||
tt_sbit_decoder_load_image( TT_SBitDecoder decoder,
|
||||
FT_UInt glyph_index,
|
||||
FT_Int x_pos,
|
||||
FT_Int y_pos )
|
||||
FT_Int y_pos,
|
||||
FT_UInt recurse_count )
|
||||
{
|
||||
/*
|
||||
* First, we find the correct strike range that applies to this
|
||||
* glyph index.
|
||||
*/
|
||||
|
||||
FT_Byte* p = decoder->eblc_base + decoder->strike_index_array;
|
||||
FT_Byte* p_limit = decoder->eblc_limit;
|
||||
FT_ULong num_ranges = decoder->strike_index_count;
|
||||
|
@ -1092,6 +1174,17 @@
|
|||
FT_ULong image_start = 0, image_end = 0, image_offset;
|
||||
|
||||
|
||||
/* arbitrary recursion limit */
|
||||
if ( recurse_count > 100 )
|
||||
{
|
||||
FT_TRACE4(( "tt_sbit_decoder_load_image:"
|
||||
" recursion depth exceeded\n" ));
|
||||
goto Failure;
|
||||
}
|
||||
|
||||
|
||||
/* First, we find the correct strike range that applies to this */
|
||||
/* glyph index. */
|
||||
for ( ; num_ranges > 0; num_ranges-- )
|
||||
{
|
||||
start = FT_NEXT_USHORT( p );
|
||||
|
@ -1256,7 +1349,8 @@
|
|||
image_start,
|
||||
image_end,
|
||||
x_pos,
|
||||
y_pos );
|
||||
y_pos,
|
||||
recurse_count );
|
||||
|
||||
Failure:
|
||||
return FT_THROW( Invalid_Table );
|
||||
|
@ -1419,6 +1513,7 @@
|
|||
error = tt_sbit_decoder_load_image( decoder,
|
||||
glyph_index,
|
||||
0,
|
||||
0,
|
||||
0 );
|
||||
tt_sbit_decoder_done( decoder );
|
||||
}
|
||||
|
|
153
reactos/lib/3rdparty/freetype/src/smooth/ftgrays.c
vendored
153
reactos/lib/3rdparty/freetype/src/smooth/ftgrays.c
vendored
|
@ -135,8 +135,10 @@
|
|||
#include <string.h>
|
||||
#include <setjmp.h>
|
||||
#include <limits.h>
|
||||
#define FT_UINT_MAX UINT_MAX
|
||||
#define FT_INT_MAX INT_MAX
|
||||
#define FT_CHAR_BIT CHAR_BIT
|
||||
#define FT_UINT_MAX UINT_MAX
|
||||
#define FT_INT_MAX INT_MAX
|
||||
#define FT_ULONG_MAX ULONG_MAX
|
||||
|
||||
#define ft_memset memset
|
||||
|
||||
|
@ -366,6 +368,15 @@ typedef ptrdiff_t FT_PtrDist;
|
|||
#endif /* __arm__ */
|
||||
|
||||
|
||||
/* These macros speed up repetitive divisions by replacing them */
|
||||
/* with multiplications and right shifts. */
|
||||
#define FT_UDIVPREP( b ) \
|
||||
long b ## _r = (long)( FT_ULONG_MAX >> PIXEL_BITS ) / ( b )
|
||||
#define FT_UDIV( a, b ) \
|
||||
( ( (unsigned long)( a ) * (unsigned long)( b ## _r ) ) >> \
|
||||
( sizeof( long ) * FT_CHAR_BIT - PIXEL_BITS ) )
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* TYPE DEFINITIONS */
|
||||
|
@ -678,6 +689,7 @@ typedef ptrdiff_t FT_PtrDist;
|
|||
gray_set_cell( RAS_VAR_ ex, ey );
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
|
@ -910,6 +922,143 @@ typedef ptrdiff_t FT_PtrDist;
|
|||
ras.y = to_y;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* Render a straight line across multiple cells in any direction. */
|
||||
/* */
|
||||
static void
|
||||
gray_render_line( RAS_ARG_ TPos to_x,
|
||||
TPos to_y )
|
||||
{
|
||||
TPos dx, dy, fx1, fy1, fx2, fy2;
|
||||
TCoord ex1, ex2, ey1, ey2;
|
||||
|
||||
|
||||
ex1 = TRUNC( ras.x );
|
||||
ex2 = TRUNC( to_x );
|
||||
ey1 = TRUNC( ras.y );
|
||||
ey2 = TRUNC( to_y );
|
||||
|
||||
/* perform vertical clipping */
|
||||
if ( ( ey1 >= ras.max_ey && ey2 >= ras.max_ey ) ||
|
||||
( ey1 < ras.min_ey && ey2 < ras.min_ey ) )
|
||||
goto End;
|
||||
|
||||
dx = to_x - ras.x;
|
||||
dy = to_y - ras.y;
|
||||
|
||||
fx1 = ras.x - SUBPIXELS( ex1 );
|
||||
fy1 = ras.y - SUBPIXELS( ey1 );
|
||||
|
||||
if ( ex1 == ex2 && ey1 == ey2 ) /* inside one cell */
|
||||
;
|
||||
else if ( dy == 0 ) /* ex1 != ex2 */ /* any horizontal line */
|
||||
{
|
||||
ex1 = ex2;
|
||||
gray_set_cell( RAS_VAR_ ex1, ey1 );
|
||||
}
|
||||
else if ( dx == 0 )
|
||||
{
|
||||
if ( dy > 0 ) /* vertical line up */
|
||||
do
|
||||
{
|
||||
fy2 = ONE_PIXEL;
|
||||
ras.cover += ( fy2 - fy1 );
|
||||
ras.area += ( fy2 - fy1 ) * fx1 * 2;
|
||||
fy1 = 0;
|
||||
ey1++;
|
||||
gray_set_cell( RAS_VAR_ ex1, ey1 );
|
||||
} while ( ey1 != ey2 );
|
||||
else /* vertical line down */
|
||||
do
|
||||
{
|
||||
fy2 = 0;
|
||||
ras.cover += ( fy2 - fy1 );
|
||||
ras.area += ( fy2 - fy1 ) * fx1 * 2;
|
||||
fy1 = ONE_PIXEL;
|
||||
ey1--;
|
||||
gray_set_cell( RAS_VAR_ ex1, ey1 );
|
||||
} while ( ey1 != ey2 );
|
||||
}
|
||||
else /* any other line */
|
||||
{
|
||||
TArea prod = dx * fy1 - dy * fx1;
|
||||
FT_UDIVPREP( dx );
|
||||
FT_UDIVPREP( dy );
|
||||
|
||||
|
||||
/* The fundamental value `prod' determines which side and the */
|
||||
/* exact coordinate where the line exits current cell. It is */
|
||||
/* also easily updated when moving from one cell to the next. */
|
||||
do
|
||||
{
|
||||
if ( prod <= 0 &&
|
||||
prod - dx * ONE_PIXEL > 0 ) /* left */
|
||||
{
|
||||
fx2 = 0;
|
||||
fy2 = (TPos)FT_UDIV( -prod, -dx );
|
||||
prod -= dy * ONE_PIXEL;
|
||||
ras.cover += ( fy2 - fy1 );
|
||||
ras.area += ( fy2 - fy1 ) * ( fx1 + fx2 );
|
||||
fx1 = ONE_PIXEL;
|
||||
fy1 = fy2;
|
||||
ex1--;
|
||||
}
|
||||
else if ( prod - dx * ONE_PIXEL <= 0 &&
|
||||
prod - dx * ONE_PIXEL + dy * ONE_PIXEL > 0 ) /* up */
|
||||
{
|
||||
prod -= dx * ONE_PIXEL;
|
||||
fx2 = (TPos)FT_UDIV( -prod, dy );
|
||||
fy2 = ONE_PIXEL;
|
||||
ras.cover += ( fy2 - fy1 );
|
||||
ras.area += ( fy2 - fy1 ) * ( fx1 + fx2 );
|
||||
fx1 = fx2;
|
||||
fy1 = 0;
|
||||
ey1++;
|
||||
}
|
||||
else if ( prod - dx * ONE_PIXEL + dy * ONE_PIXEL <= 0 &&
|
||||
prod + dy * ONE_PIXEL >= 0 ) /* right */
|
||||
{
|
||||
prod += dy * ONE_PIXEL;
|
||||
fx2 = ONE_PIXEL;
|
||||
fy2 = (TPos)FT_UDIV( prod, dx );
|
||||
ras.cover += ( fy2 - fy1 );
|
||||
ras.area += ( fy2 - fy1 ) * ( fx1 + fx2 );
|
||||
fx1 = 0;
|
||||
fy1 = fy2;
|
||||
ex1++;
|
||||
}
|
||||
else /* ( prod + dy * ONE_PIXEL < 0 &&
|
||||
prod > 0 ) down */
|
||||
{
|
||||
fx2 = (TPos)FT_UDIV( prod, -dy );
|
||||
fy2 = 0;
|
||||
prod += dx * ONE_PIXEL;
|
||||
ras.cover += ( fy2 - fy1 );
|
||||
ras.area += ( fy2 - fy1 ) * ( fx1 + fx2 );
|
||||
fx1 = fx2;
|
||||
fy1 = ONE_PIXEL;
|
||||
ey1--;
|
||||
}
|
||||
|
||||
gray_set_cell( RAS_VAR_ ex1, ey1 );
|
||||
} while ( ex1 != ex2 || ey1 != ey2 );
|
||||
}
|
||||
|
||||
fx2 = to_x - SUBPIXELS( ex2 );
|
||||
fy2 = to_y - SUBPIXELS( ey2 );
|
||||
|
||||
ras.cover += ( fy2 - fy1 );
|
||||
ras.area += ( fy2 - fy1 ) * ( fx1 + fx2 );
|
||||
|
||||
End:
|
||||
ras.x = to_x;
|
||||
ras.y = to_y;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static void
|
||||
gray_split_conic( FT_Vector* base )
|
||||
|
|
|
@ -46,9 +46,26 @@ re_code_end = re.compile( r"(\s*)}\s*$" )
|
|||
|
||||
|
||||
#
|
||||
# A regular expression to isolate identifiers from other text.
|
||||
# A regular expression to isolate identifiers from other text. Two syntax
|
||||
# forms are supported:
|
||||
#
|
||||
re_identifier = re.compile( r'((?:\w|-)*)' )
|
||||
# <name>
|
||||
# <name>[<id>]
|
||||
#
|
||||
# where both `<name>' and `<id>' consist of alphanumeric characters, `_',
|
||||
# and `-'. Use `<id>' if there are multiple, valid `<name>' entries; in the
|
||||
# index, `<id>' will be appended in parentheses.
|
||||
#
|
||||
# For example,
|
||||
#
|
||||
# stem_darkening[autofit]
|
||||
#
|
||||
# becomes `stem_darkening (autofit)' in the index.
|
||||
#
|
||||
re_identifier = re.compile( r"""
|
||||
((?:\w|-)+
|
||||
(?:\[(?:\w|-)+\])?)
|
||||
""", re.VERBOSE )
|
||||
|
||||
|
||||
#
|
||||
|
|
|
@ -56,6 +56,11 @@ class Formatter:
|
|||
self.block_index = self.identifiers.keys()
|
||||
self.block_index.sort( key = index_key )
|
||||
|
||||
# also add section names to dictionary (without making them appear
|
||||
# in the index)
|
||||
for section in self.sections:
|
||||
self.add_identifier( section.name, section )
|
||||
|
||||
def add_identifier( self, name, block ):
|
||||
if name in self.identifiers:
|
||||
# duplicate name!
|
||||
|
|
|
@ -138,12 +138,24 @@ re_markup_tags = [re_markup_tag1, re_markup_tag2]
|
|||
|
||||
#
|
||||
# A regular expression to detect a cross reference, after markup tags have
|
||||
# been stripped off. Group 1 is the reference, group 2 the rest of the
|
||||
# line.
|
||||
# been stripped off.
|
||||
#
|
||||
# A cross reference consists of letters, digits, or characters `-' and `_'.
|
||||
# Two syntax forms are supported:
|
||||
#
|
||||
re_crossref = re.compile( r'@((?:\w|-)*)(.*)' ) # @foo
|
||||
# @<name>
|
||||
# @<name>[<id>]
|
||||
#
|
||||
# where both `<name>' and `<id>' consist of alphanumeric characters, `_',
|
||||
# and `-'. Use `<id>' if there are multiple, valid `<name>' entries.
|
||||
#
|
||||
# Example: @foo[bar]
|
||||
#
|
||||
re_crossref = re.compile( r"""
|
||||
@
|
||||
(?P<name>(?:\w|-)+
|
||||
(?:\[(?:\w|-)+\])?)
|
||||
(?P<rest>.*)
|
||||
""", re.VERBOSE )
|
||||
|
||||
#
|
||||
# Two regular expressions to detect italic and bold markup, respectively.
|
||||
|
|
|
@ -164,7 +164,8 @@ html_footer = """\
|
|||
"""
|
||||
|
||||
# The header and footer used for each section.
|
||||
section_title_header = "<h1>"
|
||||
section_title_header1 = '<h1 id="'
|
||||
section_title_header2 = '">'
|
||||
section_title_footer = "</h1>"
|
||||
|
||||
# The header and footer used for code segments.
|
||||
|
@ -309,7 +310,14 @@ class HtmlFormatter( Formatter ):
|
|||
def make_block_url( self, block, name = None ):
|
||||
if name == None:
|
||||
name = block.name
|
||||
return self.make_section_url( block.section ) + "#" + name
|
||||
|
||||
try:
|
||||
section_url = self.make_section_url( block.section )
|
||||
except:
|
||||
# we already have a section
|
||||
section_url = self.make_section_url( block )
|
||||
|
||||
return section_url + "#" + name
|
||||
|
||||
def make_html_word( self, word ):
|
||||
"""Analyze a simple word to detect cross-references and markup."""
|
||||
|
@ -317,11 +325,27 @@ class HtmlFormatter( Formatter ):
|
|||
m = re_crossref.match( word )
|
||||
if m:
|
||||
try:
|
||||
name = m.group( 1 )
|
||||
rest = m.group( 2 )
|
||||
name = m.group( 'name' )
|
||||
rest = m.group( 'rest' )
|
||||
block = self.identifiers[name]
|
||||
url = self.make_block_url( block )
|
||||
return '<a href="' + url + '">' + name + '</a>' + rest
|
||||
# display `foo[bar]' as `foo'
|
||||
name = re.sub( r'\[.*\]', '', name )
|
||||
# normalize url, following RFC 3986
|
||||
url = string.replace( url, "[", "(" )
|
||||
url = string.replace( url, "]", ")" )
|
||||
|
||||
try:
|
||||
# for sections, display title
|
||||
url = ( '‘<a href="' + url + '">'
|
||||
+ block.title + '</a>’'
|
||||
+ rest )
|
||||
except:
|
||||
url = ( '<a href="' + url + '">'
|
||||
+ name + '</a>'
|
||||
+ rest )
|
||||
|
||||
return url
|
||||
except:
|
||||
# we detected a cross-reference to an unknown item
|
||||
sys.stderr.write( "WARNING: undefined cross reference"
|
||||
|
@ -417,16 +441,22 @@ class HtmlFormatter( Formatter ):
|
|||
id = block.name
|
||||
|
||||
# link to a field ID if possible
|
||||
for markup in block.markups:
|
||||
if markup.tag == 'values':
|
||||
for field in markup.fields:
|
||||
if field.name:
|
||||
id = name
|
||||
try:
|
||||
for markup in block.markups:
|
||||
if markup.tag == 'values':
|
||||
for field in markup.fields:
|
||||
if field.name:
|
||||
id = name
|
||||
|
||||
result = ( result + prefix
|
||||
+ '<a href="'
|
||||
+ self.make_block_url( block, id )
|
||||
+ '">' + name + '</a>' )
|
||||
except:
|
||||
# sections don't have `markups'; however, we don't
|
||||
# want references to sections here anyway
|
||||
result = result + html_quote( line[:length] )
|
||||
|
||||
result = ( result + prefix
|
||||
+ '<a href="'
|
||||
+ self.make_block_url( block, id )
|
||||
+ '">' + name + '</a>' )
|
||||
else:
|
||||
result = result + html_quote( line[:length] )
|
||||
|
||||
|
@ -490,6 +520,12 @@ class HtmlFormatter( Formatter ):
|
|||
if i < count:
|
||||
bname = self.block_index[r + c * rows]
|
||||
url = self.index_items[bname]
|
||||
# display `foo[bar]' as `foo (bar)'
|
||||
bname = string.replace( bname, "[", " (" )
|
||||
bname = string.replace( bname, "]", ")" )
|
||||
# normalize url, following RFC 3986
|
||||
url = string.replace( url, "[", "(" )
|
||||
url = string.replace( url, "]", ")" )
|
||||
line = ( line + '<td><a href="' + url + '">'
|
||||
+ bname + '</a></td>' )
|
||||
else:
|
||||
|
@ -564,7 +600,9 @@ class HtmlFormatter( Formatter ):
|
|||
def section_enter( self, section ):
|
||||
print self.html_header
|
||||
|
||||
print section_title_header + section.title + section_title_footer
|
||||
print ( section_title_header1 + section.name + section_title_header2
|
||||
+ section.title
|
||||
+ section_title_footer )
|
||||
|
||||
maxwidth = 0
|
||||
for b in section.blocks.values():
|
||||
|
@ -601,7 +639,13 @@ class HtmlFormatter( Formatter ):
|
|||
# even omit it completely)
|
||||
line = line + " "
|
||||
else:
|
||||
line = ( line + '<a href="#' + name + '">'
|
||||
url = name
|
||||
# display `foo[bar]' as `foo'
|
||||
name = re.sub( r'\[.*\]', '', name )
|
||||
# normalize url, following RFC 3986
|
||||
url = string.replace( url, "[", "(" )
|
||||
url = string.replace( url, "]", ")" )
|
||||
line = ( line + '<a href="#' + url + '">'
|
||||
+ name + '</a>' )
|
||||
|
||||
line = line + '</td>'
|
||||
|
@ -620,7 +664,13 @@ class HtmlFormatter( Formatter ):
|
|||
|
||||
# place html anchor if needed
|
||||
if block.name:
|
||||
print( '<h3 id="' + block.name + '">' + block.name + '</h3>' )
|
||||
url = block.name
|
||||
# display `foo[bar]' as `foo'
|
||||
name = re.sub( r'\[.*\]', '', block.name )
|
||||
# normalize url, following RFC 3986
|
||||
url = string.replace( url, "[", "(" )
|
||||
url = string.replace( url, "]", ")" )
|
||||
print( '<h3 id="' + url + '">' + name + '</h3>' )
|
||||
|
||||
# dump the block C source lines now
|
||||
if block.code:
|
||||
|
|
|
@ -117,8 +117,8 @@
|
|||
|
||||
FT_DEFINE_SERVICE_PROPERTIESREC(
|
||||
tt_service_properties,
|
||||
(FT_Properties_SetFunc)tt_property_set,
|
||||
(FT_Properties_GetFunc)tt_property_get )
|
||||
(FT_Properties_SetFunc)tt_property_set, /* set_property */
|
||||
(FT_Properties_GetFunc)tt_property_get ) /* get_property */
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
|
@ -417,13 +417,14 @@
|
|||
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
||||
FT_DEFINE_SERVICE_MULTIMASTERSREC(
|
||||
tt_service_gx_multi_masters,
|
||||
(FT_Get_MM_Func) NULL,
|
||||
(FT_Set_MM_Design_Func) NULL,
|
||||
(FT_Set_MM_Blend_Func) TT_Set_MM_Blend,
|
||||
(FT_Get_MM_Var_Func) TT_Get_MM_Var,
|
||||
(FT_Set_Var_Design_Func)TT_Set_Var_Design )
|
||||
(FT_Get_MM_Func) NULL, /* get_mm */
|
||||
(FT_Set_MM_Design_Func) NULL, /* set_mm_design */
|
||||
(FT_Set_MM_Blend_Func) TT_Set_MM_Blend, /* set_mm_blend */
|
||||
(FT_Get_MM_Var_Func) TT_Get_MM_Var, /* get_mm_var */
|
||||
(FT_Set_Var_Design_Func)TT_Set_Var_Design ) /* set_var_design */
|
||||
#endif
|
||||
|
||||
|
||||
static const FT_Service_TrueTypeEngineRec tt_service_truetype_engine =
|
||||
{
|
||||
#ifdef TT_USE_BYTECODE_INTERPRETER
|
||||
|
@ -441,9 +442,11 @@
|
|||
#endif /* TT_USE_BYTECODE_INTERPRETER */
|
||||
};
|
||||
|
||||
|
||||
FT_DEFINE_SERVICE_TTGLYFREC(
|
||||
tt_service_truetype_glyf,
|
||||
(TT_Glyf_GetLocationFunc)tt_face_get_location )
|
||||
(TT_Glyf_GetLocationFunc)tt_face_get_location ) /* get_location */
|
||||
|
||||
|
||||
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
||||
FT_DEFINE_SERVICEDESCREC5(
|
||||
|
@ -534,31 +537,31 @@
|
|||
0x10000L, /* driver version == 1.0 */
|
||||
0x20000L, /* driver requires FreeType 2.0 or above */
|
||||
|
||||
(void*)0, /* driver specific interface */
|
||||
0, /* module-specific interface */
|
||||
|
||||
tt_driver_init,
|
||||
tt_driver_done,
|
||||
tt_get_interface,
|
||||
tt_driver_init, /* FT_Module_Constructor module_init */
|
||||
tt_driver_done, /* FT_Module_Destructor module_done */
|
||||
tt_get_interface, /* FT_Module_Requester get_interface */
|
||||
|
||||
sizeof ( TT_FaceRec ),
|
||||
sizeof ( TT_SizeRec ),
|
||||
sizeof ( FT_GlyphSlotRec ),
|
||||
|
||||
tt_face_init,
|
||||
tt_face_done,
|
||||
tt_size_init,
|
||||
tt_size_done,
|
||||
tt_slot_init,
|
||||
0, /* FT_Slot_DoneFunc */
|
||||
tt_face_init, /* FT_Face_InitFunc init_face */
|
||||
tt_face_done, /* FT_Face_DoneFunc done_face */
|
||||
tt_size_init, /* FT_Size_InitFunc init_size */
|
||||
tt_size_done, /* FT_Size_DoneFunc done_size */
|
||||
tt_slot_init, /* FT_Slot_InitFunc init_slot */
|
||||
0, /* FT_Slot_DoneFunc done_slot */
|
||||
|
||||
tt_glyph_load,
|
||||
tt_glyph_load, /* FT_Slot_LoadFunc load_glyph */
|
||||
|
||||
tt_get_kerning,
|
||||
0, /* FT_Face_AttachFunc */
|
||||
tt_get_advances,
|
||||
tt_get_kerning, /* FT_Face_GetKerningFunc get_kerning */
|
||||
0, /* FT_Face_AttachFunc attach_file */
|
||||
tt_get_advances, /* FT_Face_GetAdvancesFunc get_advances */
|
||||
|
||||
tt_size_request,
|
||||
TT_SIZE_SELECT
|
||||
tt_size_request, /* FT_Size_RequestFunc request_size */
|
||||
TT_SIZE_SELECT /* FT_Size_SelectFunc select_size */
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include FT_TRUETYPE_TAGS_H
|
||||
#include FT_OUTLINE_H
|
||||
#include FT_TRUETYPE_DRIVER_H
|
||||
#include FT_LIST_H
|
||||
|
||||
#include "ttgload.h"
|
||||
#include "ttpload.h"
|
||||
|
@ -659,6 +660,7 @@
|
|||
} while ( subglyph->flags & MORE_COMPONENTS );
|
||||
|
||||
gloader->current.num_subglyphs = num_subglyphs;
|
||||
FT_TRACE5(( " %d components\n", num_subglyphs ));
|
||||
|
||||
#ifdef TT_USE_BYTECODE_INTERPRETER
|
||||
|
||||
|
@ -1395,6 +1397,11 @@
|
|||
#endif
|
||||
|
||||
|
||||
#ifdef FT_DEBUG_LEVEL_TRACE
|
||||
if ( recurse_count )
|
||||
FT_TRACE5(( " nesting level: %d\n", recurse_count ));
|
||||
#endif
|
||||
|
||||
/* some fonts have an incorrect value of `maxComponentDepth', */
|
||||
/* thus we allow depth 1 to catch the majority of them */
|
||||
if ( recurse_count > 1 &&
|
||||
|
@ -1627,11 +1634,40 @@
|
|||
/* otherwise, load a composite! */
|
||||
else if ( loader->n_contours == -1 )
|
||||
{
|
||||
FT_Memory memory = face->root.memory;
|
||||
|
||||
FT_UInt start_point;
|
||||
FT_UInt start_contour;
|
||||
FT_ULong ins_pos; /* position of composite instructions, if any */
|
||||
|
||||
|
||||
/*
|
||||
* We store the glyph index directly in the `node->data' pointer,
|
||||
* following the glib solution (cf. macro `GUINT_TO_POINTER') with a
|
||||
* double cast to make this portable. Note, however, that this needs
|
||||
* pointers with a width of at least 32 bits.
|
||||
*/
|
||||
|
||||
/* check whether we already have a composite glyph with this index */
|
||||
if ( FT_List_Find( &loader->composites,
|
||||
(void*)(unsigned long)glyph_index ) )
|
||||
{
|
||||
FT_TRACE1(( "TT_Load_Composite_Glyph:"
|
||||
" infinite recursion detected\n" ));
|
||||
error = FT_THROW( Invalid_Composite );
|
||||
goto Exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
FT_ListNode node = NULL;
|
||||
|
||||
|
||||
if ( FT_NEW( node ) )
|
||||
goto Exit;
|
||||
node->data = (void*)(unsigned long)glyph_index;
|
||||
FT_List_Add( &loader->composites, node );
|
||||
}
|
||||
|
||||
start_point = (FT_UInt)gloader->base.outline.n_points;
|
||||
start_contour = (FT_UInt)gloader->base.outline.n_contours;
|
||||
|
||||
|
@ -1659,8 +1695,6 @@
|
|||
char* tags = NULL;
|
||||
short* contours = NULL;
|
||||
|
||||
FT_Memory memory = face->root.memory;
|
||||
|
||||
|
||||
limit = (short)gloader->current.num_subglyphs;
|
||||
|
||||
|
@ -2393,10 +2427,23 @@
|
|||
loader->glyph = (FT_GlyphSlot)glyph;
|
||||
loader->stream = stream;
|
||||
|
||||
loader->composites.head = NULL;
|
||||
loader->composites.tail = NULL;
|
||||
|
||||
return FT_Err_Ok;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
tt_loader_done( TT_Loader loader )
|
||||
{
|
||||
FT_List_Finalize( &loader->composites,
|
||||
NULL,
|
||||
loader->face->root.memory,
|
||||
NULL );
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Function> */
|
||||
|
@ -2453,6 +2500,7 @@
|
|||
/* for the bbox we need the header only */
|
||||
(void)tt_loader_init( &loader, size, glyph, load_flags, TRUE );
|
||||
(void)load_truetype_glyph( &loader, glyph_index, 0, TRUE );
|
||||
tt_loader_done( &loader );
|
||||
glyph->linearHoriAdvance = loader.linear;
|
||||
glyph->linearVertAdvance = loader.vadvance;
|
||||
|
||||
|
@ -2548,6 +2596,8 @@
|
|||
error = compute_glyph_metrics( &loader, glyph_index );
|
||||
}
|
||||
|
||||
tt_loader_done( &loader );
|
||||
|
||||
/* Set the `high precision' bit flag. */
|
||||
/* This is _critical_ to get correct output for monochrome */
|
||||
/* TrueType glyphs at all sizes using the bytecode interpreter. */
|
||||
|
|
116
reactos/lib/3rdparty/freetype/src/truetype/ttgxvar.c
vendored
116
reactos/lib/3rdparty/freetype/src/truetype/ttgxvar.c
vendored
|
@ -112,6 +112,8 @@
|
|||
/* <Input> */
|
||||
/* stream :: The data stream. */
|
||||
/* */
|
||||
/* size :: The size of the table holding the data. */
|
||||
/* */
|
||||
/* <Output> */
|
||||
/* point_cnt :: The number of points read. A zero value means that */
|
||||
/* all points in the glyph will be affected, without */
|
||||
|
@ -123,6 +125,7 @@
|
|||
/* */
|
||||
static FT_UShort*
|
||||
ft_var_readpackedpoints( FT_Stream stream,
|
||||
FT_ULong size,
|
||||
FT_UInt *point_cnt )
|
||||
{
|
||||
FT_UShort *points = NULL;
|
||||
|
@ -149,6 +152,12 @@
|
|||
n |= FT_GET_BYTE();
|
||||
}
|
||||
|
||||
if ( n > size )
|
||||
{
|
||||
FT_TRACE1(( "ft_var_readpackedpoints: number of points too large\n" ));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ( FT_NEW_ARRAY( points, n ) )
|
||||
return NULL;
|
||||
|
||||
|
@ -212,6 +221,8 @@
|
|||
/* <Input> */
|
||||
/* stream :: The data stream. */
|
||||
/* */
|
||||
/* size :: The size of the table holding the data. */
|
||||
/* */
|
||||
/* delta_cnt :: The number of deltas to be read. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
|
@ -222,6 +233,7 @@
|
|||
/* */
|
||||
static FT_Short*
|
||||
ft_var_readpackeddeltas( FT_Stream stream,
|
||||
FT_ULong size,
|
||||
FT_UInt delta_cnt )
|
||||
{
|
||||
FT_Short *deltas = NULL;
|
||||
|
@ -233,6 +245,12 @@
|
|||
FT_UNUSED( error );
|
||||
|
||||
|
||||
if ( delta_cnt > size )
|
||||
{
|
||||
FT_TRACE1(( "ft_var_readpackeddeltas: number of points too large\n" ));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ( FT_NEW_ARRAY( deltas, delta_cnt ) )
|
||||
return NULL;
|
||||
|
||||
|
@ -341,7 +359,8 @@
|
|||
FT_TRACE5(( " axis %d:\n", i ));
|
||||
|
||||
segment->pairCount = FT_GET_USHORT();
|
||||
if ( FT_NEW_ARRAY( segment->correspondence, segment->pairCount ) )
|
||||
if ( (FT_ULong)segment->pairCount * 4 > table_len ||
|
||||
FT_NEW_ARRAY( segment->correspondence, segment->pairCount ) )
|
||||
{
|
||||
/* Failure. Free everything we have done so far. We must do */
|
||||
/* it right now since loading the `avar' table is optional. */
|
||||
|
@ -447,10 +466,6 @@
|
|||
if ( FT_STREAM_READ_FIELDS( gvar_fields, &gvar_head ) )
|
||||
goto Exit;
|
||||
|
||||
blend->tuplecount = gvar_head.globalCoordCount;
|
||||
blend->gv_glyphcnt = gvar_head.glyphCount;
|
||||
offsetToData = gvar_start + gvar_head.offsetToData;
|
||||
|
||||
if ( gvar_head.version != 0x00010000L )
|
||||
{
|
||||
FT_TRACE1(( "bad table version\n" ));
|
||||
|
@ -458,8 +473,6 @@
|
|||
goto Exit;
|
||||
}
|
||||
|
||||
FT_TRACE2(( "loaded\n" ));
|
||||
|
||||
if ( gvar_head.axisCount != (FT_UShort)blend->mmvar->num_axis )
|
||||
{
|
||||
FT_TRACE1(( "ft_var_load_gvar: number of axes in `gvar' and `cvar'\n"
|
||||
|
@ -468,6 +481,33 @@
|
|||
goto Exit;
|
||||
}
|
||||
|
||||
/* rough sanity check, ignoring offsets */
|
||||
if ( (FT_ULong)gvar_head.globalCoordCount * gvar_head.axisCount >
|
||||
table_len / 2 )
|
||||
{
|
||||
FT_TRACE1(( "ft_var_load_gvar:"
|
||||
" invalid number of global coordinates\n" ));
|
||||
error = FT_THROW( Invalid_Table );
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
/* rough sanity check: offsets can be either 2 or 4 bytes, */
|
||||
/* and a single variation needs at least 4 bytes per glyph */
|
||||
if ( (FT_ULong)gvar_head.glyphCount *
|
||||
( ( gvar_head.flags & 1 ) ? 8 : 6 ) > table_len )
|
||||
{
|
||||
FT_TRACE1(( "ft_var_load_gvar: invalid number of glyphs\n" ));
|
||||
error = FT_THROW( Invalid_Table );
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
FT_TRACE2(( "loaded\n" ));
|
||||
|
||||
blend->gvar_size = table_len;
|
||||
blend->tuplecount = gvar_head.globalCoordCount;
|
||||
blend->gv_glyphcnt = gvar_head.glyphCount;
|
||||
offsetToData = gvar_start + gvar_head.offsetToData;
|
||||
|
||||
FT_TRACE5(( "gvar: there are %d shared coordinates:\n",
|
||||
blend->tuplecount ));
|
||||
|
||||
|
@ -1353,13 +1393,25 @@
|
|||
goto FExit;
|
||||
|
||||
tupleCount = FT_GET_USHORT();
|
||||
offsetToData = table_start + FT_GET_USHORT();
|
||||
offsetToData = FT_GET_USHORT();
|
||||
|
||||
/* The documentation implies there are flags packed into the */
|
||||
/* tuplecount, but John Jenkins says that shared points don't apply */
|
||||
/* to `cvar', and no other flags are defined. */
|
||||
/* rough sanity test */
|
||||
if ( offsetToData + tupleCount * 4 > table_len )
|
||||
{
|
||||
FT_TRACE2(( "tt_face_vary_cvt:"
|
||||
" invalid CVT variation array header\n" ));
|
||||
|
||||
FT_TRACE5(( "cvar: there are %d tuples:\n", tupleCount ));
|
||||
error = FT_THROW( Invalid_Table );
|
||||
goto FExit;
|
||||
}
|
||||
|
||||
offsetToData += table_start;
|
||||
|
||||
/* The documentation implies there are flags packed into */
|
||||
/* `tupleCount', but John Jenkins says that shared points don't apply */
|
||||
/* to `cvar', and no other flags are defined. */
|
||||
|
||||
FT_TRACE5(( "cvar: there are %d tuples:\n", tupleCount & 0xFFF ));
|
||||
|
||||
for ( i = 0; i < ( tupleCount & 0xFFF ); i++ )
|
||||
{
|
||||
|
@ -1421,8 +1473,11 @@
|
|||
|
||||
FT_Stream_SeekSet( stream, offsetToData );
|
||||
|
||||
localpoints = ft_var_readpackedpoints( stream, &point_count );
|
||||
localpoints = ft_var_readpackedpoints( stream,
|
||||
table_len,
|
||||
&point_count );
|
||||
deltas = ft_var_readpackeddeltas( stream,
|
||||
table_len,
|
||||
point_count == 0 ? face->cvt_size
|
||||
: point_count );
|
||||
if ( localpoints == NULL || deltas == NULL )
|
||||
|
@ -1819,7 +1874,19 @@
|
|||
goto Fail2;
|
||||
|
||||
tupleCount = FT_GET_USHORT();
|
||||
offsetToData = glyph_start + FT_GET_USHORT();
|
||||
offsetToData = FT_GET_USHORT();
|
||||
|
||||
/* rough sanity test */
|
||||
if ( offsetToData + tupleCount * 4 > blend->gvar_size )
|
||||
{
|
||||
FT_TRACE2(( "TT_Vary_Apply_Glyph_Deltas:"
|
||||
" invalid glyph variation array header\n" ));
|
||||
|
||||
error = FT_THROW( Invalid_Table );
|
||||
goto Fail2;
|
||||
}
|
||||
|
||||
offsetToData += glyph_start;
|
||||
|
||||
if ( tupleCount & GX_TC_TUPLES_SHARE_POINT_NUMBERS )
|
||||
{
|
||||
|
@ -1827,13 +1894,16 @@
|
|||
|
||||
FT_Stream_SeekSet( stream, offsetToData );
|
||||
|
||||
sharedpoints = ft_var_readpackedpoints( stream, &spoint_count );
|
||||
sharedpoints = ft_var_readpackedpoints( stream,
|
||||
blend->gvar_size,
|
||||
&spoint_count );
|
||||
offsetToData = FT_Stream_FTell( stream );
|
||||
|
||||
FT_Stream_SeekSet( stream, here );
|
||||
}
|
||||
|
||||
FT_TRACE5(( "gvar: there are %d tuples:\n", tupleCount ));
|
||||
FT_TRACE5(( "gvar: there are %d tuples:\n",
|
||||
tupleCount & GX_TC_TUPLE_COUNT_MASK ));
|
||||
|
||||
for ( i = 0; i < ( tupleCount & GX_TC_TUPLE_COUNT_MASK ); i++ )
|
||||
{
|
||||
|
@ -1855,6 +1925,9 @@
|
|||
}
|
||||
else if ( ( tupleIndex & GX_TI_TUPLE_INDEX_MASK ) >= blend->tuplecount )
|
||||
{
|
||||
FT_TRACE2(( "TT_Vary_Apply_Glyph_Deltas:"
|
||||
" invalid tuple index\n" ));
|
||||
|
||||
error = FT_THROW( Invalid_Table );
|
||||
goto Fail2;
|
||||
}
|
||||
|
@ -1890,7 +1963,9 @@
|
|||
{
|
||||
FT_Stream_SeekSet( stream, offsetToData );
|
||||
|
||||
localpoints = ft_var_readpackedpoints( stream, &point_count );
|
||||
localpoints = ft_var_readpackedpoints( stream,
|
||||
blend->gvar_size,
|
||||
&point_count );
|
||||
points = localpoints;
|
||||
}
|
||||
else
|
||||
|
@ -1900,9 +1975,11 @@
|
|||
}
|
||||
|
||||
deltas_x = ft_var_readpackeddeltas( stream,
|
||||
blend->gvar_size,
|
||||
point_count == 0 ? n_points
|
||||
: point_count );
|
||||
deltas_y = ft_var_readpackeddeltas( stream,
|
||||
blend->gvar_size,
|
||||
point_count == 0 ? n_points
|
||||
: point_count );
|
||||
|
||||
|
@ -1950,6 +2027,9 @@
|
|||
#endif
|
||||
}
|
||||
|
||||
else if ( localpoints == NULL )
|
||||
; /* failure, ignore it */
|
||||
|
||||
else
|
||||
{
|
||||
#ifdef FT_DEBUG_LEVEL_TRACE
|
||||
|
@ -2021,6 +2101,8 @@
|
|||
FT_TRACE5(( "\n" ));
|
||||
|
||||
Fail2:
|
||||
if ( sharedpoints != ALL_POINTS )
|
||||
FT_FREE( sharedpoints );
|
||||
FT_FREE( tuple_coords );
|
||||
FT_FREE( im_start_coords );
|
||||
FT_FREE( im_end_coords );
|
||||
|
|
|
@ -95,6 +95,8 @@ FT_BEGIN_HEADER
|
|||
FT_UInt gv_glyphcnt;
|
||||
FT_ULong* glyphoffsets;
|
||||
|
||||
FT_ULong gvar_size;
|
||||
|
||||
} GX_BlendRec;
|
||||
|
||||
|
||||
|
|
|
@ -45,15 +45,6 @@
|
|||
#define FT_COMPONENT trace_ttinterp
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* In order to detect infinite loops in the code, we set up a counter */
|
||||
/* within the run loop. A single stroke of interpretation is now */
|
||||
/* limited to a maximum number of opcodes defined below. */
|
||||
/* */
|
||||
#define MAX_RUNNABLE_OPCODES 1000000L
|
||||
|
||||
|
||||
#define SUBPIXEL_HINTING \
|
||||
( ((TT_Driver)FT_FACE_DRIVER( exc->face ))->interpreter_version == \
|
||||
TT_INTERPRETER_VERSION_38 )
|
||||
|
@ -7565,7 +7556,7 @@
|
|||
? 2
|
||||
: 12 - ( *opcode_name[exc->opcode] - '0' ),
|
||||
"#" ));
|
||||
for ( n = 0; n < cnt; n++ )
|
||||
for ( n = 1; n <= cnt; n++ )
|
||||
FT_TRACE7(( " %d", exc->stack[exc->top - n] ));
|
||||
FT_TRACE6(( "\n" ));
|
||||
}
|
||||
|
@ -8230,7 +8221,7 @@
|
|||
|
||||
/* increment instruction counter and check if we didn't */
|
||||
/* run this program for too long (e.g. infinite loops). */
|
||||
if ( ++ins_counter > MAX_RUNNABLE_OPCODES )
|
||||
if ( ++ins_counter > TT_CONFIG_OPTION_MAX_RUNNABLE_OPCODES )
|
||||
return FT_THROW( Execution_Too_Long );
|
||||
|
||||
LSuiteLabel_:
|
||||
|
|
|
@ -1078,7 +1078,15 @@
|
|||
}
|
||||
|
||||
/* Fine, now run the font program! */
|
||||
|
||||
/* In case of an error while executing `fpgm', we intentionally don't */
|
||||
/* clean up immediately – bugs in the `fpgm' are so fundamental that */
|
||||
/* all following hinting calls should fail. Additionally, `fpgm' is */
|
||||
/* to be executed just once; calling it again is completely useless */
|
||||
/* and might even lead to extremely slow behaviour if it is malformed */
|
||||
/* (containing an infinite loop, for example). */
|
||||
error = tt_size_run_fpgm( size, pedantic );
|
||||
return error;
|
||||
|
||||
Exit:
|
||||
if ( error )
|
||||
|
|
|
@ -124,8 +124,9 @@
|
|||
TT_Table entry = face->dir_tables;
|
||||
TT_Table limit = entry + face->num_tables;
|
||||
|
||||
FT_Long pos = (FT_Long)FT_STREAM_POS();
|
||||
FT_Long dist = 0x7FFFFFFFL;
|
||||
FT_Long pos = (FT_Long)FT_STREAM_POS();
|
||||
FT_Long dist = 0x7FFFFFFFL;
|
||||
FT_Bool found = 0;
|
||||
|
||||
|
||||
/* compute the distance to next table in font file */
|
||||
|
@ -135,10 +136,13 @@
|
|||
|
||||
|
||||
if ( diff > 0 && diff < dist )
|
||||
dist = diff;
|
||||
{
|
||||
dist = diff;
|
||||
found = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if ( entry == limit )
|
||||
if ( !found )
|
||||
{
|
||||
/* `loca' is the last table */
|
||||
dist = (FT_Long)stream->size - pos;
|
||||
|
@ -222,7 +226,8 @@
|
|||
if ( pos1 > face->glyf_len )
|
||||
{
|
||||
FT_TRACE1(( "tt_face_get_location:"
|
||||
" too large offset=0x%08lx found for gid=0x%04lx,"
|
||||
" too large offset=0x%08lx found for gid=0x%04lx,\n"
|
||||
" "
|
||||
" exceeding the end of glyf table (0x%08lx)\n",
|
||||
pos1, gindex, face->glyf_len ));
|
||||
*asize = 0;
|
||||
|
@ -232,7 +237,8 @@
|
|||
if ( pos2 > face->glyf_len )
|
||||
{
|
||||
FT_TRACE1(( "tt_face_get_location:"
|
||||
" too large offset=0x%08lx found for gid=0x%04lx,"
|
||||
" too large offset=0x%08lx found for gid=0x%04lx,\n"
|
||||
" "
|
||||
" truncate at the end of glyf table (0x%08lx)\n",
|
||||
pos2, gindex + 1, face->glyf_len ));
|
||||
pos2 = face->glyf_len;
|
||||
|
|
14
reactos/lib/3rdparty/freetype/src/type1/t1afm.c
vendored
14
reactos/lib/3rdparty/freetype/src/type1/t1afm.c
vendored
|
@ -239,9 +239,17 @@
|
|||
AFM_ParserRec parser;
|
||||
AFM_FontInfo fi = NULL;
|
||||
FT_Error error = FT_ERR( Unknown_File_Format );
|
||||
T1_Font t1_font = &( (T1_Face)t1_face )->type1;
|
||||
T1_Face face = (T1_Face)t1_face;
|
||||
T1_Font t1_font = &face->type1;
|
||||
|
||||
|
||||
if ( face->afm_data )
|
||||
{
|
||||
FT_TRACE1(( "T1_Read_Metrics:"
|
||||
" Freeing previously attached metrics data.\n" ));
|
||||
T1_Done_Metrics( memory, (AFM_FontInfo)face->afm_data );
|
||||
}
|
||||
|
||||
if ( FT_NEW( fi ) ||
|
||||
FT_FRAME_ENTER( stream->size ) )
|
||||
goto Exit;
|
||||
|
@ -250,7 +258,7 @@
|
|||
fi->Ascender = t1_font->font_bbox.yMax;
|
||||
fi->Descender = t1_font->font_bbox.yMin;
|
||||
|
||||
psaux = (PSAux_Service)( (T1_Face)t1_face )->psaux;
|
||||
psaux = (PSAux_Service)face->psaux;
|
||||
if ( psaux->afm_parser_funcs )
|
||||
{
|
||||
error = psaux->afm_parser_funcs->init( &parser,
|
||||
|
@ -298,7 +306,7 @@
|
|||
if ( fi->NumKernPair )
|
||||
{
|
||||
t1_face->face_flags |= FT_FACE_FLAG_KERNING;
|
||||
( (T1_Face)t1_face )->afm_data = fi;
|
||||
face->afm_data = fi;
|
||||
fi = NULL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -87,8 +87,8 @@
|
|||
|
||||
static const FT_Service_GlyphDictRec t1_service_glyph_dict =
|
||||
{
|
||||
(FT_GlyphDict_GetNameFunc) t1_get_glyph_name,
|
||||
(FT_GlyphDict_NameIndexFunc)t1_get_name_index
|
||||
(FT_GlyphDict_GetNameFunc) t1_get_glyph_name, /* get_name */
|
||||
(FT_GlyphDict_NameIndexFunc)t1_get_name_index /* name_index */
|
||||
};
|
||||
|
||||
|
||||
|
@ -106,7 +106,7 @@
|
|||
|
||||
static const FT_Service_PsFontNameRec t1_service_ps_name =
|
||||
{
|
||||
(FT_PsName_GetFunc)t1_get_ps_name
|
||||
(FT_PsName_GetFunc)t1_get_ps_name /* get_ps_font_name */
|
||||
};
|
||||
|
||||
|
||||
|
@ -118,11 +118,11 @@
|
|||
#ifndef T1_CONFIG_OPTION_NO_MM_SUPPORT
|
||||
static const FT_Service_MultiMastersRec t1_service_multi_masters =
|
||||
{
|
||||
(FT_Get_MM_Func) T1_Get_Multi_Master,
|
||||
(FT_Set_MM_Design_Func) T1_Set_MM_Design,
|
||||
(FT_Set_MM_Blend_Func) T1_Set_MM_Blend,
|
||||
(FT_Get_MM_Var_Func) T1_Get_MM_Var,
|
||||
(FT_Set_Var_Design_Func)T1_Set_Var_Design
|
||||
(FT_Get_MM_Func) T1_Get_Multi_Master, /* get_mm */
|
||||
(FT_Set_MM_Design_Func) T1_Set_MM_Design, /* set_mm_design */
|
||||
(FT_Set_MM_Blend_Func) T1_Set_MM_Blend, /* set_mm_blend */
|
||||
(FT_Get_MM_Var_Func) T1_Get_MM_Var, /* get_mm_var */
|
||||
(FT_Set_Var_Design_Func)T1_Set_Var_Design /* set_var_design */
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -567,18 +567,18 @@
|
|||
|
||||
static const FT_Service_PsInfoRec t1_service_ps_info =
|
||||
{
|
||||
(PS_GetFontInfoFunc) t1_ps_get_font_info,
|
||||
(PS_GetFontExtraFunc) t1_ps_get_font_extra,
|
||||
(PS_HasGlyphNamesFunc) t1_ps_has_glyph_names,
|
||||
(PS_GetFontPrivateFunc)t1_ps_get_font_private,
|
||||
(PS_GetFontValueFunc) t1_ps_get_font_value,
|
||||
(PS_GetFontInfoFunc) t1_ps_get_font_info, /* ps_get_font_info */
|
||||
(PS_GetFontExtraFunc) t1_ps_get_font_extra, /* ps_get_font_extra */
|
||||
(PS_HasGlyphNamesFunc) t1_ps_has_glyph_names, /* ps_has_glyph_names */
|
||||
(PS_GetFontPrivateFunc)t1_ps_get_font_private, /* ps_get_font_private */
|
||||
(PS_GetFontValueFunc) t1_ps_get_font_value, /* ps_get_font_value */
|
||||
};
|
||||
|
||||
|
||||
#ifndef T1_CONFIG_OPTION_NO_AFM
|
||||
static const FT_Service_KerningRec t1_service_kerning =
|
||||
{
|
||||
T1_Get_Track_Kerning,
|
||||
T1_Get_Track_Kerning, /* get_track */
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -689,36 +689,37 @@
|
|||
0x10000L,
|
||||
0x20000L,
|
||||
|
||||
0, /* format interface */
|
||||
0, /* module-specific interface */
|
||||
|
||||
T1_Driver_Init,
|
||||
T1_Driver_Done,
|
||||
Get_Interface,
|
||||
T1_Driver_Init, /* FT_Module_Constructor module_init */
|
||||
T1_Driver_Done, /* FT_Module_Destructor module_done */
|
||||
Get_Interface, /* FT_Module_Requester get_interface */
|
||||
},
|
||||
|
||||
sizeof ( T1_FaceRec ),
|
||||
sizeof ( T1_SizeRec ),
|
||||
sizeof ( T1_GlyphSlotRec ),
|
||||
|
||||
T1_Face_Init,
|
||||
T1_Face_Done,
|
||||
T1_Size_Init,
|
||||
T1_Size_Done,
|
||||
T1_GlyphSlot_Init,
|
||||
T1_GlyphSlot_Done,
|
||||
T1_Face_Init, /* FT_Face_InitFunc init_face */
|
||||
T1_Face_Done, /* FT_Face_DoneFunc done_face */
|
||||
T1_Size_Init, /* FT_Size_InitFunc init_size */
|
||||
T1_Size_Done, /* FT_Size_DoneFunc done_size */
|
||||
T1_GlyphSlot_Init, /* FT_Slot_InitFunc init_slot */
|
||||
T1_GlyphSlot_Done, /* FT_Slot_DoneFunc done_slot */
|
||||
|
||||
T1_Load_Glyph,
|
||||
T1_Load_Glyph, /* FT_Slot_LoadFunc load_glyph */
|
||||
|
||||
#ifdef T1_CONFIG_OPTION_NO_AFM
|
||||
0, /* FT_Face_GetKerningFunc */
|
||||
0, /* FT_Face_AttachFunc */
|
||||
0, /* FT_Face_GetKerningFunc get_kerning */
|
||||
0, /* FT_Face_AttachFunc attach_file */
|
||||
#else
|
||||
Get_Kerning,
|
||||
T1_Read_Metrics,
|
||||
Get_Kerning, /* FT_Face_GetKerningFunc get_kerning */
|
||||
T1_Read_Metrics, /* FT_Face_AttachFunc attach_file */
|
||||
#endif
|
||||
T1_Get_Advances,
|
||||
T1_Size_Request,
|
||||
0 /* FT_Size_SelectFunc */
|
||||
T1_Get_Advances, /* FT_Face_GetAdvancesFunc get_advances */
|
||||
|
||||
T1_Size_Request, /* FT_Size_RequestFunc request_size */
|
||||
0 /* FT_Size_SelectFunc select_size */
|
||||
};
|
||||
|
||||
|
||||
|
|
18
reactos/lib/3rdparty/freetype/src/type1/t1load.c
vendored
18
reactos/lib/3rdparty/freetype/src/type1/t1load.c
vendored
|
@ -336,6 +336,9 @@
|
|||
mmvar->axis[i].strid = ~0U; /* Does not apply */
|
||||
mmvar->axis[i].tag = ~0U; /* Does not apply */
|
||||
|
||||
if ( !mmvar->axis[i].name )
|
||||
continue;
|
||||
|
||||
if ( ft_strcmp( mmvar->axis[i].name, "Weight" ) == 0 )
|
||||
mmvar->axis[i].tag = FT_MAKE_TAG( 'w', 'g', 'h', 't' );
|
||||
else if ( ft_strcmp( mmvar->axis[i].name, "Width" ) == 0 )
|
||||
|
@ -1420,6 +1423,21 @@
|
|||
}
|
||||
|
||||
num_subrs = (FT_Int)T1_ToInt( parser );
|
||||
if ( num_subrs < 0 )
|
||||
{
|
||||
parser->root.error = FT_THROW( Invalid_File_Format );
|
||||
return;
|
||||
}
|
||||
|
||||
/* we certainly need more than 8 bytes per subroutine */
|
||||
if ( num_subrs > ( parser->root.limit - parser->root.cursor ) >> 3 )
|
||||
{
|
||||
FT_TRACE0(( "parse_subrs: adjusting number of subroutines"
|
||||
" (from %d to %d)\n",
|
||||
num_subrs,
|
||||
( parser->root.limit - parser->root.cursor ) >> 3 ));
|
||||
num_subrs = ( parser->root.limit - parser->root.cursor ) >> 3;
|
||||
}
|
||||
|
||||
/* position the parser right before the `dup' of the first subr */
|
||||
T1_Skip_PS_Token( parser ); /* `array' */
|
||||
|
|
|
@ -90,8 +90,8 @@
|
|||
|
||||
static const FT_Service_GlyphDictRec t42_service_glyph_dict =
|
||||
{
|
||||
(FT_GlyphDict_GetNameFunc) t42_get_glyph_name,
|
||||
(FT_GlyphDict_NameIndexFunc)t42_get_name_index
|
||||
(FT_GlyphDict_GetNameFunc) t42_get_glyph_name, /* get_name */
|
||||
(FT_GlyphDict_NameIndexFunc)t42_get_name_index /* name_index */
|
||||
};
|
||||
|
||||
|
||||
|
@ -110,7 +110,7 @@
|
|||
|
||||
static const FT_Service_PsFontNameRec t42_service_ps_font_name =
|
||||
{
|
||||
(FT_PsName_GetFunc)t42_get_ps_font_name
|
||||
(FT_PsName_GetFunc)t42_get_ps_font_name /* get_ps_font_name */
|
||||
};
|
||||
|
||||
|
||||
|
@ -161,11 +161,12 @@
|
|||
|
||||
static const FT_Service_PsInfoRec t42_service_ps_info =
|
||||
{
|
||||
(PS_GetFontInfoFunc) t42_ps_get_font_info,
|
||||
(PS_GetFontExtraFunc) t42_ps_get_font_extra,
|
||||
(PS_HasGlyphNamesFunc) t42_ps_has_glyph_names,
|
||||
(PS_GetFontPrivateFunc)t42_ps_get_font_private,
|
||||
(PS_GetFontValueFunc) NULL /* not implemented */
|
||||
(PS_GetFontInfoFunc) t42_ps_get_font_info, /* ps_get_font_info */
|
||||
(PS_GetFontExtraFunc) t42_ps_get_font_extra, /* ps_get_font_extra */
|
||||
(PS_HasGlyphNamesFunc) t42_ps_has_glyph_names, /* ps_has_glyph_names */
|
||||
(PS_GetFontPrivateFunc)t42_ps_get_font_private, /* ps_get_font_private */
|
||||
/* not implemented */
|
||||
(PS_GetFontValueFunc) NULL /* ps_get_font_value */
|
||||
};
|
||||
|
||||
|
||||
|
@ -212,32 +213,32 @@
|
|||
0x10000L,
|
||||
0x20000L,
|
||||
|
||||
0, /* format interface */
|
||||
0, /* module-specific interface */
|
||||
|
||||
T42_Driver_Init,
|
||||
T42_Driver_Done,
|
||||
T42_Get_Interface,
|
||||
T42_Driver_Init, /* FT_Module_Constructor module_init */
|
||||
T42_Driver_Done, /* FT_Module_Destructor module_done */
|
||||
T42_Get_Interface, /* FT_Module_Requester get_interface */
|
||||
},
|
||||
|
||||
sizeof ( T42_FaceRec ),
|
||||
sizeof ( T42_SizeRec ),
|
||||
sizeof ( T42_GlyphSlotRec ),
|
||||
|
||||
T42_Face_Init,
|
||||
T42_Face_Done,
|
||||
T42_Size_Init,
|
||||
T42_Size_Done,
|
||||
T42_GlyphSlot_Init,
|
||||
T42_GlyphSlot_Done,
|
||||
T42_Face_Init, /* FT_Face_InitFunc init_face */
|
||||
T42_Face_Done, /* FT_Face_DoneFunc done_face */
|
||||
T42_Size_Init, /* FT_Size_InitFunc init_size */
|
||||
T42_Size_Done, /* FT_Size_DoneFunc done_size */
|
||||
T42_GlyphSlot_Init, /* FT_Slot_InitFunc init_slot */
|
||||
T42_GlyphSlot_Done, /* FT_Slot_DoneFunc done_slot */
|
||||
|
||||
T42_GlyphSlot_Load,
|
||||
T42_GlyphSlot_Load, /* FT_Slot_LoadFunc load_glyph */
|
||||
|
||||
0, /* FT_Face_GetKerningFunc */
|
||||
0, /* FT_Face_AttachFunc */
|
||||
0, /* FT_Face_GetKerningFunc get_kerning */
|
||||
0, /* FT_Face_AttachFunc attach_file */
|
||||
0, /* FT_Face_GetAdvancesFunc get_advances */
|
||||
|
||||
0, /* FT_Face_GetAdvancesFunc */
|
||||
T42_Size_Request,
|
||||
T42_Size_Select
|
||||
T42_Size_Request, /* FT_Size_RequestFunc request_size */
|
||||
T42_Size_Select /* FT_Size_SelectFunc select_size */
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -575,6 +575,9 @@
|
|||
|
||||
while ( parser->root.cursor < limit )
|
||||
{
|
||||
FT_ULong size;
|
||||
|
||||
|
||||
cur = parser->root.cursor;
|
||||
|
||||
if ( *cur == ']' )
|
||||
|
@ -637,7 +640,7 @@
|
|||
|
||||
string_buf = parser->root.cursor + 1; /* one space after `RD' */
|
||||
|
||||
if ( (FT_ULong)( limit - parser->root.cursor ) < string_size )
|
||||
if ( (FT_ULong)( limit - parser->root.cursor ) <= string_size )
|
||||
{
|
||||
FT_ERROR(( "t42_parse_sfnts: too much binary data\n" ));
|
||||
error = FT_THROW( Invalid_File_Format );
|
||||
|
@ -666,6 +669,11 @@
|
|||
goto Fail;
|
||||
}
|
||||
|
||||
/* The whole TTF is now loaded into `string_buf'. We are */
|
||||
/* checking its contents while copying it to `ttf_data'. */
|
||||
|
||||
size = (FT_ULong)( limit - parser->root.cursor );
|
||||
|
||||
for ( n = 0; n < string_size; n++ )
|
||||
{
|
||||
switch ( status )
|
||||
|
@ -683,7 +691,7 @@
|
|||
status = BEFORE_TABLE_DIR;
|
||||
face->ttf_size = 12 + 16 * num_tables;
|
||||
|
||||
if ( (FT_Long)( limit - parser->root.cursor ) < face->ttf_size )
|
||||
if ( (FT_Long)size < face->ttf_size )
|
||||
{
|
||||
FT_ERROR(( "t42_parse_sfnts: invalid data in sfnts array\n" ));
|
||||
error = FT_THROW( Invalid_File_Format );
|
||||
|
@ -714,6 +722,14 @@
|
|||
|
||||
|
||||
len = FT_PEEK_ULONG( p );
|
||||
if ( len > size ||
|
||||
face->ttf_size > (FT_Long)( size - len ) )
|
||||
{
|
||||
FT_ERROR(( "t42_parse_sfnts:"
|
||||
" invalid data in sfnts array\n" ));
|
||||
error = FT_THROW( Invalid_File_Format );
|
||||
goto Fail;
|
||||
}
|
||||
|
||||
/* Pad to a 4-byte boundary length */
|
||||
face->ttf_size += (FT_Long)( ( len + 3 ) & ~3U );
|
||||
|
@ -721,7 +737,6 @@
|
|||
|
||||
status = OTHER_TABLES;
|
||||
|
||||
/* there are no more than 256 tables, so no size check here */
|
||||
if ( FT_REALLOC( face->ttf_data, 12 + 16 * num_tables,
|
||||
face->ttf_size + 1 ) )
|
||||
goto Fail;
|
||||
|
@ -795,6 +810,17 @@
|
|||
error = FT_THROW( Invalid_File_Format );
|
||||
goto Fail;
|
||||
}
|
||||
|
||||
/* we certainly need more than 4 bytes per glyph */
|
||||
if ( loader->num_glyphs > ( limit - parser->root.cursor ) >> 2 )
|
||||
{
|
||||
FT_TRACE0(( "t42_parse_charstrings: adjusting number of glyphs"
|
||||
" (from %d to %d)\n",
|
||||
loader->num_glyphs,
|
||||
( limit - parser->root.cursor ) >> 2 ));
|
||||
loader->num_glyphs = ( limit - parser->root.cursor ) >> 2;
|
||||
}
|
||||
|
||||
}
|
||||
else if ( *parser->root.cursor == '<' )
|
||||
{
|
||||
|
|
|
@ -1121,7 +1121,7 @@
|
|||
|
||||
static const FT_Service_WinFntRec winfnt_service_rec =
|
||||
{
|
||||
winfnt_get_header
|
||||
winfnt_get_header /* get_header */
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -1161,32 +1161,32 @@
|
|||
0x10000L,
|
||||
0x20000L,
|
||||
|
||||
0,
|
||||
0, /* module-specific interface */
|
||||
|
||||
0, /* FT_Module_Constructor */
|
||||
0, /* FT_Module_Destructor */
|
||||
winfnt_get_service
|
||||
0, /* FT_Module_Constructor module_init */
|
||||
0, /* FT_Module_Destructor module_done */
|
||||
winfnt_get_service /* FT_Module_Requester get_interface */
|
||||
},
|
||||
|
||||
sizeof ( FNT_FaceRec ),
|
||||
sizeof ( FT_SizeRec ),
|
||||
sizeof ( FT_GlyphSlotRec ),
|
||||
|
||||
FNT_Face_Init,
|
||||
FNT_Face_Done,
|
||||
0, /* FT_Size_InitFunc */
|
||||
0, /* FT_Size_DoneFunc */
|
||||
0, /* FT_Slot_InitFunc */
|
||||
0, /* FT_Slot_DoneFunc */
|
||||
FNT_Face_Init, /* FT_Face_InitFunc init_face */
|
||||
FNT_Face_Done, /* FT_Face_DoneFunc done_face */
|
||||
0, /* FT_Size_InitFunc init_size */
|
||||
0, /* FT_Size_DoneFunc done_size */
|
||||
0, /* FT_Slot_InitFunc init_slot */
|
||||
0, /* FT_Slot_DoneFunc done_slot */
|
||||
|
||||
FNT_Load_Glyph,
|
||||
FNT_Load_Glyph, /* FT_Slot_LoadFunc load_glyph */
|
||||
|
||||
0, /* FT_Face_GetKerningFunc */
|
||||
0, /* FT_Face_AttachFunc */
|
||||
0, /* FT_Face_GetAdvancesFunc */
|
||||
0, /* FT_Face_GetKerningFunc get_kerning */
|
||||
0, /* FT_Face_AttachFunc attach_file */
|
||||
0, /* FT_Face_GetAdvancesFunc get_advances */
|
||||
|
||||
FNT_Size_Request,
|
||||
FNT_Size_Select
|
||||
FNT_Size_Request, /* FT_Size_RequestFunc request_size */
|
||||
FNT_Size_Select /* FT_Size_SelectFunc select_size */
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ Used Version: 1.1
|
|||
Website: http://www.geocities.com/dborca/opengl/tc.html
|
||||
|
||||
Title: FreeType
|
||||
Used Version: 2.6.1
|
||||
Used Version: 2.6.2
|
||||
Website: http://www.freetype.org
|
||||
|
||||
Title: Mesa3D
|
||||
|
|
Loading…
Reference in a new issue