diff --git a/reactos/lib/3rdparty/freetype/ChangeLog b/reactos/lib/3rdparty/freetype/ChangeLog index fea19b939f5..f5ca59f5e34 100644 --- a/reactos/lib/3rdparty/freetype/ChangeLog +++ b/reactos/lib/3rdparty/freetype/ChangeLog @@ -1,3 +1,1107 @@ +2015-10-04 Werner Lemberg + + * Version 2.6.1 released. + ========================= + + + Tag sources with `VER-2-6-1'. + + * docs/VERSION.DLL: Update documentation and bump version number to + 2.6.1. + + * README, Jamfile (RefDoc), builds/windows/vc2005/freetype.vcproj, + builds/windows/vc2005/index.html, + builds/windows/vc2008/freetype.vcproj, + builds/windows/vc2008/index.html, + builds/windows/vc2010/freetype.vcxproj, + builds/windows/vc2010/index.html, + builds/windows/visualc/freetype.dsp, + builds/windows/visualc/freetype.vcproj, + builds/windows/visualc/index.html, + builds/windows/visualce/freetype.dsp, + builds/windows/visualce/freetype.vcproj, + builds/windows/visualce/index.html, + builds/wince/vc2005-ce/freetype.vcproj, + builds/wince/vc2005-ce/index.html, + builds/wince/vc2008-ce/freetype.vcproj, + builds/wince/vc2008-ce/index.html: s/2.6/2.6.1/, s/26/261/. + + * include/freetype/freetype.h (FREETYPE_PATCH): Set to 1. + + * builds/unix/configure.raw (version_info): Set to 18:1:12. + * CMakeLists.txt (VERSION_PATCH): Set to 1. + + * src/autofit/afmodule.c [AF_DEBUG_AUTOFIT]: Ensure C linking for + dumping functions. + +2015-10-04 Werner Lemberg + + [bzip2, gzip] Avoid access of unitialized memory (#46109). + + * src/bzip2/ftbzip2.c (ft_bzip2_file_fill_input), src/gzip/ftgzip.c + (ft_gzip_file_fill_input): In case of an error, adjust the limit to + avoid copying uninitialized memory. + +2015-10-03 Werner Lemberg + + [bzip2, gzip] Avoid access of unitialized memory (#46109). + + * src/bzip2/ftbzip2.c (ft_bzip2_file_fill_output), src/gzip/ftgzip.c + (ft_gzip_file_fill_output): In case of an error, adjust the limit to + avoid copying uninitialized memory. + +2015-10-01 Alexei Podtelezhnikov + + [smooth] Clean up worker. + + * src/smooth/ftgrays.c (gray_TWorker): Remove never used fields. + +2015-10-01 Werner Lemberg + + [sfnt] Make `tt_cmap4_char_map_linear' more robust (#46078). + + * src/sfnt/ttcmap.c (tt_cmap4_char_map_linear): Take care of + border conditions (i.e., if the loop exits naturally). + +2015-10-01 Werner Lemberg + + * src/autofit/afranges.c (af_deva_nonbase_uniranges): Fix ranges. + They should be a subset of `af_deva_uniranges'. + +2015-10-01 Werner Lemberg + + [sfnt] Make `tt_cmap4_char_map_linear' faster (#46078). + + * src/sfnt/ttcmap.c (tt_cmap4_char_map_linear): Use inner loop to + reject too large glyph indices. + +2015-09-30 Alexei Podtelezhnikov + + [smooth] Clean up worker. + + * src/smooth/ftgrays.c (gray_TWorker): Remove lightly used `last_ey'. + (gray_start_cell, gray_render_line): Update. + +2015-09-30 Werner Lemberg + + [autofit] Replace `no-base' with `non-base'. + + * src/autofit/*: Do it. + +2015-09-30 Werner Lemberg + + [sfnt] Rewrite `tt_cmap4_char_map_linear' (#46078). + + * src/sfnt/ttcmap.c (tt_cmap4_char_map_linear): Add code to better + skip invalid segments. + If searching the next character, provide a more efficient logic to + speed up the code. + +2015-09-30 Werner Lemberg + + [truetype] Adjust number of glyphs for malformed `loca' tables. + + * src/truetype/ttpload.c (tt_face_load_loca): Implement it. + +2015-09-29 Werner Lemberg + + [pshinter] Avoid harmless overflow (#45984). + + * src/pshinter/pshglob.c (psh_blues_set_zones): Fix it. + +2015-09-28 Werner Lemberg + + [autofit] Add support for Lao script. + + Thanks to Danh Hong for guidance with blue zone + characters! + + * src/autofit/afblue.dat: Add blue zone data for Lao. + + * src/autofit/afblue.c, src/autofit/afblue.h: Regenerated. + + * src/autofit/afscript.h: Add Lao standard characters. + + * src/autofit/afranges.c: Add Lao data. + + * src/autofit/afstyles.h: Add Lao data. + +2015-09-27 suzuki toshiya + + [base] Fix a leak by broken sfnt-PS or resource fork (#46028). + + open_face_from_buffer() frees passed buffer if valid font + is not found. But if copying to the buffer is failed, + the allocated buffer should be freed within the caller. + + * src/base/ftobjs.c (open_face_PS_from_sfnt_stream): Free + the buffer `sfnt_ps' if an error caused before calling + open_face_from_buffer(). + (Mac_Read_sfnt_Resource): Free the buffer `sfnt_data' if + an error caused before calling open_face_from_buffer(); + +2015-09-27 suzuki toshiya + + [mac] Fix buffer size calculation for LWFN font. + + * src/base/ftmac.c (read_lwfn): Cast post_size to FT_ULong + to prevent confused copy by too large chunk size. + +2015-09-26 Alexei Podtelezhnikov + + * src/smooth/ftgrays.c (PIXEL_MASK): Remove unused macro. + +2015-09-26 Werner Lemberg + + [autofit] Minor tracing improvement. + + * src/autofit/aflatin.c (af_latin_metrics_scale_dim): Don't emit + blue zones header line if there are no blue zones. + +2015-09-26 Werner Lemberg + + [bzip2, gzip, lzw] Harmonize function signatures with prototype. + + Suggested by Hin-Tak Leung. + + * src/bzip2/ftbzip2.c (ft_bzip2_stream_io), src/gzip/ftgzip.c + (ft_gzip_stream_io), src/lzw/ftlzw.c (ft_lzw_stream_io): Do it. + +2015-09-26 Hin-Tak Leung + + Add new FT_LOAD_COMPUTE_METRICS load flag. + + * include/freetype/freetype.h (FT_LOAD_COMPUTE_METRICS): New macro. + * src/truetype/ttgload.c (compute_glyph_metrics): Usage. + +2015-09-26 Werner Lemberg + + * src/base/ftobjs.c (Mac_Read_sfnt_Resource): Add cast. + +2015-09-25 Werner Lemberg + + [type1] Protect against invalid number of glyphs (#46029). + + * src/type1/t1load.c (parse_charstrings): Check number of + `CharStrings' dictionary entries against size of data stream. + +2015-09-23 Werner Lemberg + + [sfnt] Better checks for invalid cmaps (2/2) (#46019). + + While the current code in `FT_Get_Next_Char' correctly rejects + out-of-bounds glyph indices, it can be extremely slow for malformed + cmaps that use 32bit values. This commit tries to improve that. + + * src/sfnt/ttcmap.c (tt_cmap8_char_next, tt_cmap12_next, + tt_cmap12_char_map_binary, tt_cmap13_next, + tt_cmap13_char_map_binary): Reject glyph indices larger than or + equal to the number of glyphs. + +2015-09-23 Werner Lemberg + + [base, sfnt] Better checks for invalid cmaps (1/2). + + * src/base/ftobjs.c (FT_Get_Char_Index): Don't return out-of-bounds + glyph indices. + (FT_Get_First_Char): Updated. + + * src/sfnt/ttcmap.c (tt_cmap6_char_next): Don't return character + codes greater than 0xFFFF. + + (tt_cmap8_char_index): Avoid integer overflow in computation of + glyph index. + (tt_cmap8_char_next): Avoid integer overflows in computation of + both next character code and glyph index. + + (tt_cmap10_char_index): Fix unsigned integer logic. + (tt_cmap10_char_next): Avoid integer overflow in computation of + next character code. + + (tt_cmap12_next): Avoid integer overflows in computation of both + next character code and glyph index. + (tt_cmap12_char_map_binary): Ditto. + (tt_cmap12_char_next): Simplify. + + (tt_cmap13_char_map_binary): Avoid integer overflow in computation + of next character code. + (tt_cmap13_char_next): Simplify. + +2015-09-21 suzuki toshiya + + [base] Check too long POST and sfnt resource (#45919). + + * src/base/ftbase.h (FT_MAC_RFORK_MAX_LEN): Maximum length of the + resource fork for Mac OS. Resource forks larger than 16 MB can be + written but can't be handled correctly, at least in Carbon routine. + See https://support.microsoft.com/en-us/kb/130437. + + * src/base/ftobjs.c (Mac_Read_POST_Resource): No need to use `0x' + prefix for `%p' formatter. + + * src/base/ftbase.c (Mac_Read_POST_Resource): Check the fragment and + total size of the concatenated POST resource before buffer + allocation. + (Mac_Read_sfnt_Resource): Check the declared size of sfnt resource + before buffer allocation. + + * src/base/ftmac.c (read_lwfn, FT_New_Face_From_SFNT): Check the + total resource size before buffer allocation. + +2015-09-19 Werner Lemberg + + [sfnt] Improve handling of invalid SFNT table entries (#45987). + + This patch fixes weaknesses in function `tt_face_load_font_dir'. + + - It incorrectly assumed that valid tables are always at the + beginning. As a consequence, some valid tables after invalid + entries (which are ignored) were never seen. + + - Duplicate table entries (this is, having the same tag) were not + rejected. + + - The number of valid tables was sometimes too large, leading to + access of invalid tables. + + * src/sfnt/ttload.c (check_table_dir): Add argument to return number + of valid tables. + Add another tracing message. + (tt_face_load_font_dir): Only allocate table array for valid + entries as returned by `check_table_dir'. + Reject duplicate tables and adjust number of valid tables + accordingly. + +2015-09-19 Werner Lemberg + + [pcf] Improve `FT_ABS' fix from 2015-09-17 (#45999). + + * src/pcf/pcfread.c (pcf_load_font): Do first the cast to FT_Short, + then take the absolute value. + Also apply FT_ABS to `height'. + +2015-09-17 Werner Lemberg + + [type42] Fix memory leak (#45989). + + * src/type42/t42parse.c (t42_parse_charstrings): Allow only a single + `CharStrings' array. + +2015-09-17 Werner Lemberg + + [psaux] Fix memory leak (#45986). + + * src/psaux/psobjs.c (ps_parser_load_field) : + Free `temp' in case of error. + +2015-09-17 Werner Lemberg + + [psaux] Improve tracing message. + + * src/psaux/psobjs.c (ps_parser_load_field) : + Handle plural correctly. + +2015-09-17 Werner Lemberg + + [pcf] Fix integer overflows (#45985). + + * src/pcf/pcfread.c (pcf_load_font): Use FT_MulDiv. + +2015-09-17 Werner Lemberg + + [pcf] Use FT_ABS for some property values (#45893). + + * src/pcf/pcfread.c (pcf_load_font): Take absolute values for + AVERAGE_WIDTH, POINT_SIZE, PIXEL_SIZE, RESOLUTION_X, and + RESOLUTION_Y. In tracing mode, add warnings. + +2015-09-16 Werner Lemberg + + Minor fixes for some clang warnings. + + * src/base/ftoutln.c (FT_Outline_EmboldenXY): Cast, possible missing + initialization. + + * src/truetype/ttgload.c (TT_Process_Composite_Component): Cast. + +2015-09-15 Werner Lemberg + + [type1, type42] Fix memory leaks (#45966). + + * src/type1/t1load.c (parse_blend_axis_types): Handle multiple axis + names. + (parse_blend_design_map): Allow only a single design map. + (parse_encoding): Handle multiple encoding vectors. + + * src/type42/t42parse.c (t42_parse_encoding): Handle multiple + encoding vectors. + +2015-09-15 Werner Lemberg + + [truetype] Fix integer type (#45965). + + * src/truetype/ttobjs.c (tt_synth_sfnt_checksum): Implement it. + +2015-09-15 Werner Lemberg + + * src/pcf/pcfread.c (pcf_load_font): Fix integer overflow (#45964). + +2015-09-15 Werner Lemberg + + [type1, type42] Check encoding array size (#45961). + + * src/type1/t1load.c (parse_encoding), src/type42/t42parse.c + (t42_parse_encoding): Do it. + +2015-09-14 Alexei Podtelezhnikov + + * src/base/ftcalc.c (FT_MulFix) [FT_LONG64]: Improve. + +2015-09-14 Werner Lemberg + + [type1] Fix another potential buffer overflow (#45955). + + * src/type1/t1parse (T1_Get_Private_Dict): Assure that check for + `eexec' doesn't exceed `limit'. + +2015-09-13 Werner Lemberg + + Replace `mkinstalldirs' with AC_PROG_MKDIR_P. + + * builds/unix/mkinstalldirs: Removed, no longer needed. + + * builds/unix/configure.raw: Call `AC_PROG_MKDIR_P'. + Update pwd call for `$INSTALL'. + + * builds/unix/unix-def.in (MKINSTALLDIRS): Use `@MKDIR_P@'. + + * autogen.sh: Updated. + +2015-09-13 Werner Lemberg + + [winfonts] Check alignment shift count for resource data (#45938). + + * src/winfonts/winfnt.c (fnt_face_get_dll_font): Implement it. + +2015-09-13 Werner Lemberg + + [type1] Fix potential buffer overflow (#45923). + + * src/type1/t1parse.c (T1_Get_Private_Dict): Assure `cur' doesn't + point to end of file buffer. + +2015-09-13 Werner Lemberg + + [gzip] Fix access of small compressed files (#45937). + + * src/gzip/ftgzip.c (ft_gzip_stream_close): Avoid memory leak. + + (ft_gzip_get_uncompressed_file): Correct byte order while reading + unsigned long value. Without this change, the whole optimization of + accessing small files in `FT_Stream_OpenGzip' is never executed! As + a consequence, access to PCF files in general (which are normally + small files) should be much improved now as originally intended. + +2015-09-11 Werner Lemberg + + [psaux] Fix potential buffer overflow (#45922). + + * src/psaux/psobjs.c (ps_parser_skip_PS_token): If a token is + enclosed in balanced expressions, ensure that the cursor position + doesn't get larger than the current limit. + +2015-09-11 Werner Lemberg + + [base] Avoid crash while tracing `load_mac_face'. + + Reported in Savannah bug #45919. + + * src/base/ftobjs.c (load_mac_face): Honour FT_OPEN_MEMORY while + tracing. + +2015-09-11 Werner Lemberg + + [type42] Fix endless loop (#45920). + + * src/type42/t42parse.c (t42_parse_encoding): Synchronize with + type1's `parse_encoding'. + +2015-09-10 Werner Lemberg + + [docmaker] Allow `-' in bold and italic markup. + + * src/tools/docmaker/sources.py (re_italic, re_bold): Adjust + accordingly. + +2015-09-09 Alexei Podtelezhnikov + + * src/base/ftcalc.c (FT_RoundFix): Improve. + +2015-09-09 Wojciech Mamrak + + * src/base/ftcalc.c (FT_CeilFix, FT_FloorFix): Normalize. + + This commit makes the functions behave as expected, this is, + rounding towards plus or minus infinity. + +2015-09-07 Alexei Podtelezhnikov + + * src/smooth/ftgrays.c (gray_render_line): Simplify clipping. + +2015-09-04 Alexei Podtelezhnikov + + [raster,smooth] Microoptimizations. + + * src/raster/ftraster.c (Insert_Y_Turn, Finalize_Profile_Table, + Beziier_Up, ): Use do-while loops. + + * src/smooth/ftgrays.c (gray_render_scanline, gray_render_line, + gray_convert_glyph): Ditto. + +2015-09-04 Werner Lemberg + + [autofit] Redesign code ranges (2/2). + + This commit adds two fallback scripts (`latb', `latp') and + implements support for the no-base character ranges introduced in + the previous commit. + + * src/autofit/aftypes.h (AF_ScriptClassRec): Add + `script_uni_nobase_ranges' field. + (AF_DEFINE_SCRIPT_CLASS): Updated. + + * src/autofit/afscript.h, src/autofit/afstyles.h: Add `latb' and + `latp' fallback scripts. + + * src/autofit/afblue.dat: Add blue zones for Latin subscript and + superscript fallback scripts. + + * src/autofit/afblue.c, src/autofit/afblue.h: Regenerated. + + * src/autofit/afglobal.h (AF_NOBASE): New style flag for no-base + characters. + (AF_STYLE_MASK): Updated. + + * src/autofit/afglobal.c (SCRIPT): Updated. + (af_face_globals_compute_style_coverage): Handle new style flag. + + * src/autofit/aflatin.c (af_latin_hints_apply): Handle new style + flag. + + * src/autofit/afranges.h (SCRIPT): Use it to export no-base ranges. + +2015-09-04 Werner Lemberg + + [autofit] Redesign code ranges (1/2). + + This patch introduces auxiliary code ranges that identify no-base + characters; they refer to glyphs of a script that should be hinted + without alignments to blue zones (mostly diacritics). + + It also splits off ranges for fallback scripts that handle subscript + and superscript characters not covered by OpenType features. For + example, this greatly helps improve the hinting of various phonetic + alphabets, which contain a large amount characters that look like + superscript glyphs. + + Finally, code ranges are updated to Unicode 8.0, and enclosed + characters are removed in general since they normally look better if + they stay unhinted. + + * src/autofit/afranges.c (af_latn_uniranges): Updated to Unicode + 8.0. + Split off superscript-like and subscript-like glyphs into... + + (af_latb_uniranges, af_latp_uniranges): ... these two new arrays. + + (af_xxxx_nobase_uniranges): New arrays that hold no-base characters + of the corresponding character ranges. + +2015-09-03 Werner Lemberg + + [autofit] Pass glyph index to hinting function. + + No functionality change yet. + + * src/autofit/aftypes.h (AF_WritingSystem_ApplyHintsFunc): Pass + glyph index. + + * src/autofit/afcjk.c, src/autofit/afcjk.h (af_cjk_hints_apply), + src/autofit/afdummy.c (af_dummy_hints_apply), src/autofit/afindic.c + (af_indic_hints_apply), src/autofit/aflatin.c + (af_latin_hints_apply), src/autofit/aflatin2.c + (af_latin2_hints_apply), src/autofit/afloader.c (af_loader_load_g): + Updated. + +2015-08-30 Werner Lemberg + + [autofit] Code clean-up. + + * src/autofit/afglobal.h (AF_STYLE_MASK): New macro. + (AF_STYLE_UNASSIGNED): Use AF_STYLE_MASK for definition. + + * src/autofit/afglobal.c (af_face_globals_compute_style_coverage): + Updated. + +2015-08-30 Werner Lemberg + + [autofit] Make glyph style array use 16bit values. + + * include/freetype/ftautoh.h (FT_Prop_GlyphToScriptMap): Use + `FT_UShort' for `map' field. + + * src/autofit/afglobal.c (af_face_globals_compute_style_coverage, + af_face_globals_new), src/autofit/hbshim.c, src/autofit/hbshim.h + (af_get_coverage): Use FT_UShort for `glyph_styles' array. + + * src/autofit/afglobal.h (AF_STYLE_UNASSIGNED, AF_DIGIT): Extend to + 16 bits. + (AF_FaceGlobalsRec): Use `FT_UShort' for `glyph_styles' field. + +2015-08-26 Werner Lemberg + + * builds/unix/configure.raw: Need harfbuzz >= 0.9.21 (#45828). + +2015-08-25 Werner Lemberg + + [base] Improve kerning tracing and documentation. + + * src/base/ftobjs.c (FT_Get_Kerning): Emit tracing message if + scaled-down kerning values differ. + +2015-08-18 Werner Lemberg + + [raster] Remove last remnants of `raster5' driver. + + * src/raster/ftrend1.h (ft_raster5_renderer_class): Removed. + + * src/raster/rastpic.c, src/raster/rastpic.h + (ft_raster5_renderer_class_pic_init, + ft_raster5_renderer_class_pic_free): Removed. + +2015-08-17 Alexei Podtelezhnikov + + [base] Improve emboldener (#45596). + + * src/base/ftoutln.c (FT_Outline_EmboldenXY): Correct displacement + of zero-lenght segments. + +2015-08-16 Alexei Podtelezhnikov + + [base] Reoptimize arithmetic. + + * src/base/ftcalc.c (FT_MulDiv, FT_MulFix) [!FT_LONG64]: Remove + special cases that slow down the general use. + +2015-08-15 pazer + + Fix C++ compilation (#45762). + + * src/base/ftstroke.c (ft_outline_glyph_class): Use + FT_CALLBACK_TABLE. + +2015-08-14 Alexei Podtelezhnikov + + [truetype] Clean up. + + * src/truetype/ttgload.c (TT_Process_Composite_Component): Use + `FT_Outline_Transform' and `FT_Outline_Translate'. + (translate_array): Dropped. + +2015-08-14 Andreas Enge + + * builds/unix/detect.mk (CONFIG_SHELL): Don't handle it (#44261). + +2015-08-13 Werner Lemberg + + [truetype] Introduce named instance access to GX fonts. + + For functions querying a face, bits 16-30 of the face index can hold + the named instance index if we have a GX font. The indices start + with value 1; value 0 indicates font access without GX variation + data. + + * include/freetype/freetype.h (FT_FaceRec): Update documentation. + * include/freetype/internal/sfnt.h: Ditto. + + * src/sfnt/sfobjs.c (sfnt_init_face) + [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Get number of named instances and + do argument checks. + (sfnt_load_face): Updated. + + * src/truetype/ttobjs.c (tt_face_init) + [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Use named instance, overwriting + the style name. + + * src/base/ftobjs.c (open_face_from_buffer, + open_face_PS_from_sfnt_stream): Updated. + * src/bdf/bdfdrivr.c (BDF_Face_Init): Updated. + * src/cff/cffload.c (cff_font_load): Updated. + + * src/cff/cffobjs.c (cff_face_init): Make function exit early for + pure CFF fonts if `font_index < 0'. + Updated. + + * src/cid/cidobjs.c (cid_face_init): Updated. + * src/pcf/pcfdrivr.c (PCF_Face_Init): Updated. + * src/pfr/pfrobjs.c (pfr_face_init): Updated. + * src/type1/t1objs.c (T1_Face_Init): Updated. + * src/type42/t42objs.c (T42_Face_Init): Updated. + * src/winfonts/winfnt.c (fnt_face_get_dll_font, FNT_Face_Init): + Updated. + + * docs/CHANGES: Updated. + +2015-08-12 Alexei Podtelezhnikov + + [type1,cff,cid] Streamline font matrix application. + + * src/type1/t1gload.c (T1_Load_Glyph): Directly modify advances only + if font matrix is not trivial. + * src/cff/cffgload.c (cff_slot_load): Ditto. + * sff/cid/cidgload.c (cid_slot_load_glyph): Ditto for advances and the + entire outline. + +2015-08-11 Werner Lemberg + + [builds/unix] Minor. + + * builds/unix/configure.raw: + s/lib{priv,staticconf}/libs{priv,staticconf}/ for orthogonality with + similarly named uppercase variables. + +2015-08-10 Alexei Podtelezhnikov + + [type1,cid,type42] Minor improvements. + + * src/type1/t1load.c (t1_parse_font_matrix): Scale units per EM only + when necessary. Refresh comments. + * src/cid/cidload.c (cid_parse_font_matrix): Ditto. + * src/type42/t42parse.c (t42_parse_font_matrix): Refresh comments. + +2015-08-08 Werner Lemberg + + [type42] Fix glyph access. + + This is a severe bug: We've missed one level of indirection, as + described in the Type 42 specification. As a result, ftview + sometimes showed incorrect glyphs for given glyph names, and even + displayed `error 0x0006' (invalid argument!) in case the number of + glyph indices differed between the Type 42 font and the embedded + TTF. + + Apparently, noone ever noticed it; this shows how much Type 42 fonts + are in use... + + * src/type42/t42objs.c (T42_GlyphSlot_Load): Map Type 42 glyph index + to embedded TTF's glyph index. + +2015-08-08 Werner Lemberg + + [type42] Minor clean-up. + + * src/type42/t42parse.c (t42_parse_font_matrix): Remove unused + variable. + +2015-08-06 Alexei Podtelezhnikov + + [type42] Parse FontMatrix according to specifications. + + * src/type42/t42parse.c (t42_parse_font_matrix): Type 42 FontMatrix + does not need scaling by 1000. Units_per_EM are taken from the + embedded TrueType. + +2015-08-06 Werner Lemberg + + [autofit] Improve Arabic hinting. + + Problem reported by Titus Nemeth (by using + ttfautohint). + + * src/autofit/afblue.dat: Add neutral blue zone for the tatweel + character. + + * src/autofit/afblue.c, src/autofit/afblue.h: Regenerated. + +2015-08-05 Alexei Podtelezhnikov + + [truetype] Clean up types. + + * src/truetype/ttobjs.c (TT_Size): Move declaration from here. + * include/freetype/internal/tttypes.h (TT_Size): ... to here. + (TT_LoaderRec): Switch to appropriate types for `face' and `size'. + * src/truetype/ttgload.c: Remove corresponding type casts. + * src/truetype/ttsubpix.c: Ditto. + +2015-08-05 Werner Lemberg + + [autofit] Improve recognition of flat vs. rounded segments. + + Lower the flatness threshold from upem/8 to upem/14, making the + auto-hinter accept shorter elements. + + Synchronize flat/round stem selection algorithm with blue zone code. + + * src/autofit/aflatin.c (FLAT_THRESHOLD): New macro. + (af_latin_metrics_init_blues): Use it. + (af_latin_hints_compute_segments): Collect information on maximum + and minimum coordinates of `on' points; use this to add a constraint + for the flat/round decision similar to + `af_latin_metrics_init_blues'. + +2015-08-04 Werner Lemberg + + Another left-shift bug (#45681). + + * src/base/ftobjs.c (IsMacBinary): Only accept positive values for + `dlen'. + +2015-08-03 Alexei Podtelezhnikov + + [base] Fix `ft_corner_orientation'. + + Remove casting from `FT_Long' to `FT_Int' that might change the sign + of the return value and make it faster too. + + * src/base/ftcalc.c (ft_corner_orientation): On 32-bit systems, stay + with 32-bit arithmetic when safe. Use plain math on 64-bit systems. + * src/pshinter/pshalgo.c: Remove old unused code. + +2015-08-03 Werner Lemberg + + * src/truetype/ttgload.c (load_truetype_glyph) + [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Fix crash for composite glyphs + having a depth greater than 1. + +2015-08-03 Werner Lemberg + + Fix typo in clang bug from 2015-07-31 (#45678). + + * src/base/ftrfork.c (FT_Raccess_Get_HeaderInfo): Fix inequality. + +2015-08-02 Werner Lemberg + + * CMakeLists.txt: Improve shared library support. + + Based on a patch from John Cary . + +2015-08-02 Werner Lemberg + + * builds/unix/freetype-config.in (enable_shared): Remove. Unused. + +2015-08-02 Werner Lemberg + + Fix more invalid left-shifts. + + * src/pfr/pfrgload.c (pfr_glyph_load_compound): Use multiplication, + not left-shift. + + * src/truetype/ttgxvar.c (ft_var_load_avar, ft_var_load_gvar, + tt_face_vary_cvt, TT_Vary_Apply_Glyph_Deltas): Use multiplication, + not left-shift. + +2015-07-31 Werner Lemberg + + Fix some bugs found by clang's `-fsanitize=undefined' (#45661). + + * src/base/ftrfork.c (FT_Raccess_Get_HeaderInfo): Only accept + positive values from header. + Check overflow. + + * src/base/ftoutln.c (SCALED): Correctly handle left-shift of + negative values. + + * src/bdf/bdf.h (_bdf_glyph_modified, _bdf_set_glyph_modified, + _bdf_clear_glyph_modified): Use unsigned long constant. + + * src/bdf/bdfdrivr.c (BDF_Size_Select, BDF_Glyph_Load): Don't + left-shift values that can be negative. + + * src/pcf/pcfdrivr.c (PCF_Size_Select, PCF_Glyph_Load): Don't + left-shift values that can be negative. + + * src/raster/ftraster.c (SCALED): Correctly handle left-shift of + negative values. + + * src/sfnt/ttsbit.c (tt_face_load_strike_metrics): Don't left-shift + values that can be negative. + + * src/truetype/ttgload.c (TT_Load_Composite_Glyph, + compute_glyph_metrics, load_sbit_image): Don't left-shift values + that can be negative. + +2015-07-31 Werner Lemberg + + Define FT_LONG_MAX. + + * include/freetype/config/ftstdlib.h (FT_LONG_MAX): New macro. + * src/cff/cf2arrst.c (cf2_arrstack_setNumElements): Use it. + +2015-07-28 Alexei Podtelezhnikov + + * src/base/ftcalc.c (FT_Vector_NormLen): Clarify. + +2015-07-27 Alexei Podtelezhnikov + + * src/base/ftcalc.c (FT_Vector_NormLen): Explicate type conversions. + +2015-07-26 Matthias Clasen + + [cff] Don't use `hmtx' table for LSB (#45520). + + * src/cff/cffgload.c (cff_slot_load): Use `htmx' table for advance + width only. Bug introduced 2015-04-10. + +2015-07-09 Werner Lemberg + + Better support of user-supplied C++ namespaces. + + See + + http://lists.nongnu.org/archive/html/freetype-devel/2015-07/msg00008.html + + for a rationale. + + * src/autofit/afpic.h, src/base/basepic.h, src/cff/cffpic.h, + src/pshinter/pshpic.h, src/psnames/pspic.h, src/raster/rastpic.h, + src/sfnt/sfntpic.h, src/smooth/ftspic.h, src/truetype/ttpic.h + (FT_BEGIN_HEADER, FT_END_HEADER): Move macro calls to not enclose + header files that contain FT_{BEGIN,END}_HEADER macros by + themselves. + + * src/autofit/aftypes.h [FT_DEBUG_AUTOFIT]: Include + FT_CONFIG_STANDARD_LIBRARY_H earlier. + + * src/truetype/ttpic.h: Include FT_INTERNL_PIC_H. + +2015-07-07 Werner Lemberg + + [sfnt] Make `tt_face_get_name' member of the SFNT interface. + + * include/freetype/internal/sfnt.h (TT_Get_Name_Func): New + prototype. + (SFNT_Interface, FT_DEFINE_SFNT_INTERFACE): New member `get_name'. + + * src/sfnt/sfdriver.c (sfnt_interface): Updated. + + * src/sfnt/sfobjs.c (tt_face_get_name): Tag it with `LOCAL_DEF'. + * src/sfnt/sfobjs.h: Add prototype for it. + +2015-06-30 Werner Lemberg + + Fix some clang compiler warnings. + + * src/base/ftoutln.c (FT_Outline_EmboldenXY), src/cff/cf2intrp.c + (cf2_interpT2CharString), src/truetype/ttgload.c + (load_truetype_glyph), src/truetype/ttgxvar.c (tt_handle_deltas), + src/truetype/ttinterp.c (Ins_INSTCTRL): Fix signedness issues. + +2015-06-29 Alexei Podtelezhnikov + + [truetype] Speed up bytecode interpreter. + + * src/truetype/ttinterp.c (Normalize): Use `FT_Vector_NormLen'. + +2015-06-29 Alexei Podtelezhnikov + + [base] Speed up emboldening. + + * src/base/ftoutln.c (FT_Outline_EmboldenXY): Use + `FT_Vector_NormLen'. + +2015-06-29 Alexei Podtelezhnikov + + [base] Implement fast vector normalization. + + The function uses Newton's iterations instead of dividing vector + components by its length, which needs a square root. This is, + literally, a bit less accurate but a lot faster. + + * src/base/ftcalc.c (FT_Vector_NormLen): New function. + +2015-06-28 Werner Lemberg + + * CMakeLists.txt: Always create `ftconfig.h'. + + For non-UNIX builds, the file stays unmodified. However, it's + better to have the main configuration files at the same place + regardless of the OS. + +2015-06-28 Werner Lemberg + + * CMakeLists.txt: Improve MSVC support (#43737). + +2015-06-28 Werner Lemberg + + [cmake] Check for libraries and create `ftoption.h'. + + * builds/FindHarfBuzz.cmake: New file, taken from + + https://trac.webkit.org/browser/trunk/Source/cmake/FindHarfBuzz.cmake + + * CMakeLists.Txt: Add path to local cmake modules. + Find dependencies for zlib, bzip2, libpng, and harfbuzz. + Create `ftoption.h' file. + Set up include and linker stuff for libraries. + +2015-06-28 Werner Lemberg + + * CMakeLists.txt: Fix creation of `ftconfig.h'. + Check for UNIX header files using `check_include_file'. + Set up correct header include directories. + +2015-06-28 Werner Lemberg + + * CMakeLists.txt: Disallow in-source builds. + +2015-06-27 Werner Lemberg + + * src/tools/docmaker/utils.py (check_output): Add missing `\n'. + +2015-06-26 Werner Lemberg + + * CMakeLists.txt: Select platform-dependent `ftdebug.c'. + +2015-06-25 Werner Lemberg + + * CMakeLists.txt: Use cmake functions for generating `ftconfig.h'. + Additionally, do this for UNIX only. + +2015-06-25 Werner Lemberg + + * CMakeLists.txt (BASE_SRCS): Use `ftbase.c' and `psnames.c'. + +2015-06-25 Werner Lemberg + + Another adjustment to header locations. + + This change is a result of a discussion thread on freetype-devel + + http://lists.nongnu.org/archive/html/freetype-devel/2015-06/msg00041.html + + Re-introduce the `freetype2' subdirectory for all FreeType header + files after installation, and rename the `freetype2' subdirectory in + the git repository to `freetype'. + + * include/freetype2: Renamed to... + * include/freetype: This. + + * CMakeLists.txt (PUBLIC_HEADERS, PUBLIC_CONFIG_HEADERS, + PRIVATE_HEADERS): Updated. + Update creation of `ftconfig.h'. + Install generated `ftconfig.h'. + + * Jamfile (HDRMACRO, RefDoc), autogen.sh: Updated. + + * builds/amiga/include/config/ftconfig.h, builds/freetype.mk + (PUBLIC_DIR), builds/symbian/bld.inf, builds/toplevel.mk (work), + builds/unix/freetype2.in: Updated. + + * builds/unix/freetype-config.in: Updated. + * builds/unix/configure.raw: Don't check for `rmdir'. + * builds/unix/unix-def.in (DELDIR): Use `rm -rf', which is portable + according to the autoconf info manual. + * builds/unix/install.mk (install, uninstall, + distclean_project_unix): Update and simplify. + + * builds/wince/*, builds/windows/*: Updated. + + * devel/ft2build.h, include/ft2build.h: Updated. + + * include/freetype2/config/ftheader.h, + include/freetype2/internal/ftserv.h, + include/freetype2/internal/internal.h: Update all header file + macros. + + * src/tools/chktrcmp.py (TRACE_DEF_FILES): Updated. + + * docs/*: Updated. + +2015-06-24 Alexei Podtelezhnikov + + * src/bdf/bdflib.c (_bdf_parse_start): Disallow 0 bpp. + +2015-06-24 Alexei Podtelezhnikov + + * src/bdf/bdflib.c (_bdf_parse_start): Simplify bpp parsing. + +2015-06-23 Werner Lemberg + + s/TYPEOF/FT_TYPEOF/ (#45376). + + * builds/unix/ftconfig.in, builds/vms/ftconfig.in, + include/freetype2/config/ftconfig.h, + include/freetype2/internal/ftobjs.h, src/autofit/afwarp.h: Do it. + +2015-06-22 Werner Lemberg + + Fix Savannah bug #45097. + + We no longer `pollute' the namespace of possible header file names; + instead we move `ft2build.h' up by one level so that it gets + installed in the default include directory (e.g., + /usr/local/include). After this commit, only `ft2build.h' stays in + the compiler's include path. + + No visible changes for the user who follows the standard FreeType + header inclusion rules. + + * include/*: Move to ... + * include/freetype2/*: This directory, except `ft2build.h'. + + * CMakeLists.txt (PUBLIC_HEADERS, PUBLIC_CONFIG_HEADERS, + PRIVATE_HEADERS), Jamfile (HDRMACRO, RefDoc), autogen.sh: Updated. + + * builds/amiga/include/config/ftconfig.h, builds/freetype.mk + (PUBLIC_DIR), builds/symbian/bld.inf, builds/toplevel.mk (work), + builds/unix/install.mk (install, uninstall), + builds/unix/freetype2.in: Updated. + + * builds/unix/freetype-config.in: Updated. + Emit -I directory only if it is not `/usr/include'. + + * builds/wince/*, builds/windows/*: Updated. + + * devel/ft2build.h, include/ft2build.h: Updated. + + * include/freetype2/config/ftheader.h, + include/freetype2/internal/ftserv.h, + include/freetype2/internal/internal.h: Update all header file + macros. + + * src/tools/chktrcmp.py (TRACE_DEF_FILES): Updated. + +2015-06-21 Werner Lemberg + + Make Jam support work again. + + This is just very basic stuff and just a little bit tested on + GNU/Linux only. I won't delve into this since I'm not a Jam user. + + * Jamfile: Call `HDRMACRO' for `ftserv.h' also. + (DEFINES): Replace with... + (CCFLAGS): ... this. + + * src/Jamfile: Don't call `HDRMACRO' for `internal.h'; this is + already handled in the top-level Jamfile. + + * src/autofit/Jamfile (DEFINES): Replace with... + (CCFLAGS): ... this. + (_sources): Add missing files. + + * src/cache/Jamfile: Don't call `HDRMACRO' for `ftcache.h'; it no + longer contains macro header definitions. + + * src/base/Jamfile, src/cff/Jamfile, src/sfnt/Jamfile, + src/truetype/Jamfile (_sources): Add missing files. + +2015-06-16 Werner Lemberg + + Fix Savannah bug #45326. + + * src/sfnt/sfntpic.h (SFNT_SERVICES_GET): Remove duplicate + definitions. + 2015-06-07 Werner Lemberg * Version 2.6 released. @@ -30,8 +1134,8 @@ (FREETYPE_PATCH): Set to 0. * builds/unix/configure.raw (version_info): Set to 18:0:12. - * CMakeLists.txt (VERSION_MINOR): Set to 0. - (VERSION_PATCH): Set to 6. + * CMakeLists.txt (VERSION_MINOR): Set to 6. + (VERSION_PATCH): Set to 0. * src/autofit/afmodule.c [!FT_MAKE_OPTION_SINGLE_OBJECT]: Add declarations for dumping functions. diff --git a/reactos/lib/3rdparty/freetype/README b/reactos/lib/3rdparty/freetype/README index ff207451438..ed62e1dee76 100644 --- a/reactos/lib/3rdparty/freetype/README +++ b/reactos/lib/3rdparty/freetype/README @@ -1,5 +1,5 @@ - FreeType 2.6 - ============ + FreeType 2.6.1 + ============== Homepage: http://www.freetype.org @@ -24,9 +24,9 @@ and download one of the following files. - freetype-doc-2.6.tar.bz2 - freetype-doc-2.6.tar.gz - ftdoc26.zip + freetype-doc-2.6.1.tar.bz2 + freetype-doc-2.6.1.tar.gz + ftdoc261.zip To view the documentation online, go to @@ -42,6 +42,7 @@ general use and discussion: freetype@nongnu.org engine internals, porting, etc.: freetype-devel@nongnu.org announcements: freetype-announce@nongnu.org + git repository tracker: freetype-commit@nongnu.org The lists are moderated; see diff --git a/reactos/lib/3rdparty/freetype/autogen.sh b/reactos/lib/3rdparty/freetype/autogen.sh index 9729af42d0d..8f05b2da7ef 100644 --- a/reactos/lib/3rdparty/freetype/autogen.sh +++ b/reactos/lib/3rdparty/freetype/autogen.sh @@ -139,7 +139,7 @@ check_tool_version $LIBTOOLIZE libtoolize LIBTOOLIZE 2.2.4 check_tool_version $AUTOCONF autoconf AUTOCONF 2.62 # This sets freetype_major, freetype_minor, and freetype_patch. -eval `sed -nf version.sed include/freetype.h` +eval `sed -nf version.sed include/freetype/freetype.h` # We set freetype-patch to an empty value if it is zero. if test "$freetype_patch" = ".0"; then @@ -156,7 +156,6 @@ run aclocal -I . --force run $LIBTOOLIZE --force --copy --install run autoconf --force -chmod +x mkinstalldirs chmod +x install-sh cd ../.. diff --git a/reactos/lib/3rdparty/freetype/devel/ft2build.h b/reactos/lib/3rdparty/freetype/devel/ft2build.h index 8e9653dbdde..b9eade2dd33 100644 --- a/reactos/lib/3rdparty/freetype/devel/ft2build.h +++ b/reactos/lib/3rdparty/freetype/devel/ft2build.h @@ -32,7 +32,7 @@ #define FT_CONFIG_OPTIONS_H -#include +#include #endif /* __FT2BUILD_H__ */ diff --git a/reactos/lib/3rdparty/freetype/devel/ftoption.h b/reactos/lib/3rdparty/freetype/devel/ftoption.h index ed63aa0cf1a..eda772e84a4 100644 --- a/reactos/lib/3rdparty/freetype/devel/ftoption.h +++ b/reactos/lib/3rdparty/freetype/devel/ftoption.h @@ -38,9 +38,9 @@ FT_BEGIN_HEADER /* library from a single source directory. */ /* */ /* - You can put a copy of this file in your build directory, more */ - /* precisely in `$BUILD/config/ftoption.h', where `$BUILD' is the */ - /* name of a directory that is included _before_ the FreeType include */ - /* path during compilation. */ + /* precisely in `$BUILD/freetype/config/ftoption.h', where `$BUILD' */ + /* is the name of a directory that is included _before_ the FreeType */ + /* include path during compilation. */ /* */ /* The default FreeType Makefiles and Jamfiles use the build */ /* directory `builds/' by default, but you can easily change */ @@ -51,7 +51,7 @@ FT_BEGIN_HEADER /* locate this file during the build. For example, */ /* */ /* #define FT_CONFIG_OPTIONS_H */ - /* #include */ + /* #include */ /* */ /* will use `$BUILD/myftoptions.h' instead of this file for macro */ /* definitions. */ @@ -59,7 +59,7 @@ FT_BEGIN_HEADER /* Note also that you can similarly pre-define the macro */ /* FT_CONFIG_MODULES_H used to locate the file listing of the modules */ /* that are statically linked to the library at compile time. By */ - /* default, this file is . */ + /* default, this file is . */ /* */ /* We highly recommend using the third method whenever possible. */ /* */ diff --git a/reactos/lib/3rdparty/freetype/include/config/ftconfig.h b/reactos/lib/3rdparty/freetype/include/freetype/config/ftconfig.h similarity index 98% rename from reactos/lib/3rdparty/freetype/include/config/ftconfig.h rename to reactos/lib/3rdparty/freetype/include/freetype/config/ftconfig.h index e1b5c0619ea..d4d79936df1 100644 --- a/reactos/lib/3rdparty/freetype/include/config/ftconfig.h +++ b/reactos/lib/3rdparty/freetype/include/freetype/config/ftconfig.h @@ -335,9 +335,9 @@ FT_BEGIN_HEADER #if ( __GNUC__ >= 2 || \ defined( __IBM__TYPEOF__ ) || \ ( __SUNPRO_C >= 0x5110 && !__STDC__ ) ) -#define TYPEOF( type ) (__typeof__ (type)) +#define FT_TYPEOF( type ) (__typeof__ (type)) #else -#define TYPEOF( type ) /* empty */ +#define FT_TYPEOF( type ) /* empty */ #endif @@ -387,9 +387,9 @@ FT_BEGIN_HEADER #ifndef FT_EXPORT #ifdef __cplusplus -#define FT_EXPORT( x ) extern "C" x __cdecl +#define FT_EXPORT( x ) extern "C" x #else -#define FT_EXPORT( x ) extern x __cdecl +#define FT_EXPORT( x ) extern x #endif #endif /* !FT_EXPORT */ @@ -398,9 +398,9 @@ FT_BEGIN_HEADER #ifndef FT_EXPORT_DEF #ifdef __cplusplus -#define FT_EXPORT_DEF( x ) extern "C" x __cdecl +#define FT_EXPORT_DEF( x ) extern "C" x #else -#define FT_EXPORT_DEF( x ) extern x __cdecl +#define FT_EXPORT_DEF( x ) extern x #endif #endif /* !FT_EXPORT_DEF */ diff --git a/reactos/lib/3rdparty/freetype/include/config/ftheader.h b/reactos/lib/3rdparty/freetype/include/freetype/config/ftheader.h similarity index 89% rename from reactos/lib/3rdparty/freetype/include/config/ftheader.h rename to reactos/lib/3rdparty/freetype/include/freetype/config/ftheader.h index 4906bc1f28b..55f833db0fb 100644 --- a/reactos/lib/3rdparty/freetype/include/config/ftheader.h +++ b/reactos/lib/3rdparty/freetype/include/freetype/config/ftheader.h @@ -107,7 +107,7 @@ * */ #ifndef FT_CONFIG_CONFIG_H -#define FT_CONFIG_CONFIG_H +#define FT_CONFIG_CONFIG_H #endif @@ -122,7 +122,7 @@ * */ #ifndef FT_CONFIG_STANDARD_LIBRARY_H -#define FT_CONFIG_STANDARD_LIBRARY_H +#define FT_CONFIG_STANDARD_LIBRARY_H #endif @@ -137,7 +137,7 @@ * */ #ifndef FT_CONFIG_OPTIONS_H -#define FT_CONFIG_OPTIONS_H +#define FT_CONFIG_OPTIONS_H #endif @@ -153,7 +153,7 @@ * */ #ifndef FT_CONFIG_MODULES_H -#define FT_CONFIG_MODULES_H +#define FT_CONFIG_MODULES_H #endif /* */ @@ -170,7 +170,7 @@ * base FreeType~2 API. * */ -#define FT_FREETYPE_H +#define FT_FREETYPE_H /************************************************************************* @@ -185,7 +185,7 @@ * It is included by @FT_FREETYPE_H. * */ -#define FT_ERRORS_H +#define FT_ERRORS_H /************************************************************************* @@ -198,7 +198,7 @@ * list of FreeType~2 module error offsets (and messages). * */ -#define FT_MODULE_ERRORS_H +#define FT_MODULE_ERRORS_H /************************************************************************* @@ -214,7 +214,7 @@ * It is included by @FT_FREETYPE_H. * */ -#define FT_SYSTEM_H +#define FT_SYSTEM_H /************************************************************************* @@ -230,7 +230,7 @@ * It is included by @FT_FREETYPE_H. * */ -#define FT_IMAGE_H +#define FT_IMAGE_H /************************************************************************* @@ -245,7 +245,7 @@ * It is included by @FT_FREETYPE_H. * */ -#define FT_TYPES_H +#define FT_TYPES_H /************************************************************************* @@ -260,7 +260,7 @@ * (Most applications will never need to include this file.) * */ -#define FT_LIST_H +#define FT_LIST_H /************************************************************************* @@ -273,7 +273,7 @@ * scalable outline management API of FreeType~2. * */ -#define FT_OUTLINE_H +#define FT_OUTLINE_H /************************************************************************* @@ -286,7 +286,7 @@ * API which manages multiple @FT_Size objects per face. * */ -#define FT_SIZES_H +#define FT_SIZES_H /************************************************************************* @@ -299,7 +299,7 @@ * module management API of FreeType~2. * */ -#define FT_MODULE_H +#define FT_MODULE_H /************************************************************************* @@ -312,7 +312,7 @@ * renderer module management API of FreeType~2. * */ -#define FT_RENDER_H +#define FT_RENDER_H /************************************************************************* @@ -325,7 +325,7 @@ * structures and macros related to the auto-hinting module. * */ -#define FT_AUTOHINTER_H +#define FT_AUTOHINTER_H /************************************************************************* @@ -338,7 +338,7 @@ * structures and macros related to the CFF driver module. * */ -#define FT_CFF_DRIVER_H +#define FT_CFF_DRIVER_H /************************************************************************* @@ -351,7 +351,7 @@ * structures and macros related to the TrueType driver module. * */ -#define FT_TRUETYPE_DRIVER_H +#define FT_TRUETYPE_DRIVER_H /************************************************************************* @@ -364,7 +364,7 @@ * types and API specific to the Type~1 format. * */ -#define FT_TYPE1_TABLES_H +#define FT_TYPE1_TABLES_H /************************************************************************* @@ -379,7 +379,7 @@ * definitions, taken from the TrueType and OpenType specifications. * */ -#define FT_TRUETYPE_IDS_H +#define FT_TRUETYPE_IDS_H /************************************************************************* @@ -392,7 +392,7 @@ * types and API specific to the TrueType (as well as OpenType) format. * */ -#define FT_TRUETYPE_TABLES_H +#define FT_TRUETYPE_TABLES_H /************************************************************************* @@ -406,7 +406,7 @@ * SFNT-based font formats (i.e., TrueType and OpenType). * */ -#define FT_TRUETYPE_TAGS_H +#define FT_TRUETYPE_TAGS_H /************************************************************************* @@ -420,7 +420,7 @@ * face. * */ -#define FT_BDF_H +#define FT_BDF_H /************************************************************************* @@ -434,7 +434,7 @@ * face. * */ -#define FT_CID_H +#define FT_CID_H /************************************************************************* @@ -447,7 +447,7 @@ * definitions of an API which supports gzip-compressed files. * */ -#define FT_GZIP_H +#define FT_GZIP_H /************************************************************************* @@ -460,7 +460,7 @@ * definitions of an API which supports LZW-compressed files. * */ -#define FT_LZW_H +#define FT_LZW_H /************************************************************************* @@ -473,7 +473,7 @@ * definitions of an API which supports bzip2-compressed files. * */ -#define FT_BZIP2_H +#define FT_BZIP2_H /************************************************************************* @@ -486,7 +486,7 @@ * definitions of an API which supports Windows FNT files. * */ -#define FT_WINFONTS_H +#define FT_WINFONTS_H /************************************************************************* @@ -499,7 +499,7 @@ * API of the optional glyph management component. * */ -#define FT_GLYPH_H +#define FT_GLYPH_H /************************************************************************* @@ -512,7 +512,7 @@ * API of the optional bitmap conversion component. * */ -#define FT_BITMAP_H +#define FT_BITMAP_H /************************************************************************* @@ -525,7 +525,7 @@ * API of the optional exact bounding box computation routines. * */ -#define FT_BBOX_H +#define FT_BBOX_H /************************************************************************* @@ -538,7 +538,7 @@ * API of the optional FreeType~2 cache sub-system. * */ -#define FT_CACHE_H +#define FT_CACHE_H /************************************************************************* @@ -612,7 +612,7 @@ * compiled on the Mac (note that the base API still works though). * */ -#define FT_MAC_H +#define FT_MAC_H /************************************************************************* @@ -625,7 +625,7 @@ * optional multiple-masters management API of FreeType~2. * */ -#define FT_MULTIPLE_MASTERS_H +#define FT_MULTIPLE_MASTERS_H /************************************************************************* @@ -639,7 +639,7 @@ * SFNT-based font formats (i.e., TrueType and OpenType). * */ -#define FT_SFNT_NAMES_H +#define FT_SFNT_NAMES_H /************************************************************************* @@ -653,7 +653,7 @@ * GPOS, GSUB, JSTF). * */ -#define FT_OPENTYPE_VALIDATE_H +#define FT_OPENTYPE_VALIDATE_H /************************************************************************* @@ -667,7 +667,7 @@ * mort, morx, bsln, just, kern, opbd, trak, prop). * */ -#define FT_GX_VALIDATE_H +#define FT_GX_VALIDATE_H /************************************************************************* @@ -680,7 +680,7 @@ * FreeType~2 API which accesses PFR-specific data. * */ -#define FT_PFR_H +#define FT_PFR_H /************************************************************************* @@ -692,7 +692,7 @@ * A macro used in #include statements to name the file containing the * FreeType~2 API which provides functions to stroke outline paths. */ -#define FT_STROKER_H +#define FT_STROKER_H /************************************************************************* @@ -704,7 +704,7 @@ * A macro used in #include statements to name the file containing the * FreeType~2 API which performs artificial obliquing and emboldening. */ -#define FT_SYNTHESIS_H +#define FT_SYNTHESIS_H /************************************************************************* @@ -716,7 +716,7 @@ * A macro used in #include statements to name the file containing the * FreeType~2 API which provides functions specific to font formats. */ -#define FT_FONT_FORMATS_H +#define FT_FONT_FORMATS_H /* deprecated */ #define FT_XFREE86_H FT_FONT_FORMATS_H @@ -732,7 +732,7 @@ * FreeType~2 API which performs trigonometric computations (e.g., * cosines and arc tangents). */ -#define FT_TRIGONOMETRY_H +#define FT_TRIGONOMETRY_H /************************************************************************* @@ -744,7 +744,7 @@ * A macro used in #include statements to name the file containing the * FreeType~2 API which performs color filtering for subpixel rendering. */ -#define FT_LCD_FILTER_H +#define FT_LCD_FILTER_H /************************************************************************* @@ -756,7 +756,7 @@ * A macro used in #include statements to name the file containing the * FreeType~2 API which performs color filtering for subpixel rendering. */ -#define FT_UNPATENTED_HINTING_H +#define FT_UNPATENTED_HINTING_H /************************************************************************* @@ -768,7 +768,7 @@ * A macro used in #include statements to name the file containing the * FreeType~2 API which performs color filtering for subpixel rendering. */ -#define FT_INCREMENTAL_H +#define FT_INCREMENTAL_H /************************************************************************* @@ -780,7 +780,7 @@ * A macro used in #include statements to name the file containing the * FreeType~2 API which returns entries from the TrueType GASP table. */ -#define FT_GASP_H +#define FT_GASP_H /************************************************************************* @@ -792,30 +792,30 @@ * A macro used in #include statements to name the file containing the * FreeType~2 API which returns individual and ranged glyph advances. */ -#define FT_ADVANCES_H +#define FT_ADVANCES_H /* */ -#define FT_ERROR_DEFINITIONS_H +#define FT_ERROR_DEFINITIONS_H /* The internals of the cache sub-system are no longer exposed. We */ /* default to FT_CACHE_H at the moment just in case, but we know of */ /* no rogue client that uses them. */ /* */ -#define FT_CACHE_MANAGER_H -#define FT_CACHE_INTERNAL_MRU_H -#define FT_CACHE_INTERNAL_MANAGER_H -#define FT_CACHE_INTERNAL_CACHE_H -#define FT_CACHE_INTERNAL_GLYPH_H -#define FT_CACHE_INTERNAL_IMAGE_H -#define FT_CACHE_INTERNAL_SBITS_H +#define FT_CACHE_MANAGER_H +#define FT_CACHE_INTERNAL_MRU_H +#define FT_CACHE_INTERNAL_MANAGER_H +#define FT_CACHE_INTERNAL_CACHE_H +#define FT_CACHE_INTERNAL_GLYPH_H +#define FT_CACHE_INTERNAL_IMAGE_H +#define FT_CACHE_INTERNAL_SBITS_H -#define FT_INCREMENTAL_H +#define FT_INCREMENTAL_H -#define FT_TRUETYPE_UNPATENTED_H +#define FT_TRUETYPE_UNPATENTED_H /* @@ -823,7 +823,7 @@ * only when building the library. */ #ifdef FT2_BUILD_LIBRARY -#define FT_INTERNAL_INTERNAL_H +#define FT_INTERNAL_INTERNAL_H #include FT_INTERNAL_INTERNAL_H #endif /* FT2_BUILD_LIBRARY */ diff --git a/reactos/lib/3rdparty/freetype/include/config/ftmodule.h b/reactos/lib/3rdparty/freetype/include/freetype/config/ftmodule.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/config/ftmodule.h rename to reactos/lib/3rdparty/freetype/include/freetype/config/ftmodule.h diff --git a/reactos/lib/3rdparty/freetype/include/config/ftoption.h b/reactos/lib/3rdparty/freetype/include/freetype/config/ftoption.h similarity index 99% rename from reactos/lib/3rdparty/freetype/include/config/ftoption.h rename to reactos/lib/3rdparty/freetype/include/freetype/config/ftoption.h index 1536c723691..4970945d153 100644 --- a/reactos/lib/3rdparty/freetype/include/config/ftoption.h +++ b/reactos/lib/3rdparty/freetype/include/freetype/config/ftoption.h @@ -38,9 +38,9 @@ FT_BEGIN_HEADER /* library from a single source directory. */ /* */ /* - You can put a copy of this file in your build directory, more */ - /* precisely in `$BUILD/config/ftoption.h', where `$BUILD' is the */ - /* name of a directory that is included _before_ the FreeType include */ - /* path during compilation. */ + /* precisely in `$BUILD/freetype/config/ftoption.h', where `$BUILD' */ + /* is the name of a directory that is included _before_ the FreeType */ + /* include path during compilation. */ /* */ /* The default FreeType Makefiles and Jamfiles use the build */ /* directory `builds/' by default, but you can easily change */ @@ -51,7 +51,7 @@ FT_BEGIN_HEADER /* locate this file during the build. For example, */ /* */ /* #define FT_CONFIG_OPTIONS_H */ - /* #include */ + /* #include */ /* */ /* will use `$BUILD/myftoptions.h' instead of this file for macro */ /* definitions. */ @@ -59,7 +59,7 @@ FT_BEGIN_HEADER /* Note also that you can similarly pre-define the macro */ /* FT_CONFIG_MODULES_H used to locate the file listing of the modules */ /* that are statically linked to the library at compile time. By */ - /* default, this file is . */ + /* default, this file is . */ /* */ /* We highly recommend using the third method whenever possible. */ /* */ diff --git a/reactos/lib/3rdparty/freetype/include/config/ftstdlib.h b/reactos/lib/3rdparty/freetype/include/freetype/config/ftstdlib.h similarity index 99% rename from reactos/lib/3rdparty/freetype/include/config/ftstdlib.h rename to reactos/lib/3rdparty/freetype/include/freetype/config/ftstdlib.h index 8ef43c04b92..4b471d4d15d 100644 --- a/reactos/lib/3rdparty/freetype/include/config/ftstdlib.h +++ b/reactos/lib/3rdparty/freetype/include/freetype/config/ftstdlib.h @@ -64,6 +64,7 @@ #define FT_INT_MAX INT_MAX #define FT_INT_MIN INT_MIN #define FT_UINT_MAX UINT_MAX +#define FT_LONG_MAX LONG_MAX #define FT_ULONG_MAX ULONG_MAX diff --git a/reactos/lib/3rdparty/freetype/include/freetype.h b/reactos/lib/3rdparty/freetype/include/freetype/freetype.h similarity index 95% rename from reactos/lib/3rdparty/freetype/include/freetype.h rename to reactos/lib/3rdparty/freetype/include/freetype/freetype.h index bca93e5b8fd..b6247f510f0 100644 --- a/reactos/lib/3rdparty/freetype/include/freetype.h +++ b/reactos/lib/3rdparty/freetype/include/freetype/freetype.h @@ -876,17 +876,36 @@ FT_BEGIN_HEADER /* font formats can have multiple faces in */ /* a font file. */ /* */ - /* face_index :: The index of the face in the font file. It */ - /* is set to~0 if there is only one face in */ + /* face_index :: This field holds two different values. */ + /* Bits 0-15 are the index of the face in the */ + /* font file (starting with value~0). They */ + /* are set to~0 if there is only one face in */ /* the font file. */ /* */ + /* Bits 16-30 are relevant to GX variation */ + /* fonts only, holding the named instance */ + /* index for the current face index (starting */ + /* with value~1; value~0 indicates font access */ + /* without GX variation data). For non-GX */ + /* fonts, bits 16-30 are ignored. If we have */ + /* the third named instance of face~4, say, */ + /* `face_index' is set to 0x00030004. */ + /* */ + /* Bit 31 is always zero (this is, */ + /* `face_index' is always a positive value). */ + /* */ /* face_flags :: A set of bit flags that give important */ /* information about the face; see */ /* @FT_FACE_FLAG_XXX for the details. */ /* */ - /* style_flags :: A set of bit flags indicating the style of */ - /* the face; see @FT_STYLE_FLAG_XXX for the */ - /* details. */ + /* style_flags :: The lower 16~bits contain a set of bit */ + /* flags indicating the style of the face; see */ + /* @FT_STYLE_FLAG_XXX for the details. Bits */ + /* 16-30 hold the number of named instances */ + /* available for the current face if we have a */ + /* GX variation (sub)font. Bit 31 is always */ + /* zero (this is, `style_flags' is always a */ + /* positive value). */ /* */ /* num_glyphs :: The number of glyphs in the face. If the */ /* face is scalable and has sbits (see */ @@ -1392,7 +1411,7 @@ FT_BEGIN_HEADER /* FT_STYLE_FLAG_XXX */ /* */ /* */ - /* A list of bit-flags used to indicate the style of a given face. */ + /* A list of bit flags used to indicate the style of a given face. */ /* These are used in the `style_flags' field of @FT_FaceRec. */ /* */ /* */ @@ -1824,7 +1843,7 @@ FT_BEGIN_HEADER /* FT_OPEN_XXX */ /* */ /* */ - /* A list of bit-field constants used within the `flags' field of the */ + /* A list of bit field constants used within the `flags' field of the */ /* @FT_Open_Args structure. */ /* */ /* */ @@ -1971,13 +1990,12 @@ FT_BEGIN_HEADER /* */ /* pathname :: A path to the font file. */ /* */ - /* face_index :: The index of the face within the font. The first */ - /* face has index~0. */ + /* face_index :: See @FT_Open_Face for a detailed description of this */ + /* parameter. */ /* */ /* */ /* aface :: A handle to a new face object. If `face_index' is */ /* greater than or equal to zero, it must be non-NULL. */ - /* See @FT_Open_Face for more details. */ /* */ /* */ /* FreeType error code. 0~means success. */ @@ -2010,13 +2028,12 @@ FT_BEGIN_HEADER /* */ /* file_size :: The size of the memory chunk used by the font data. */ /* */ - /* face_index :: The index of the face within the font. The first */ - /* face has index~0. */ + /* face_index :: See @FT_Open_Face for a detailed description of this */ + /* parameter. */ /* */ /* */ /* aface :: A handle to a new face object. If `face_index' is */ /* greater than or equal to zero, it must be non-NULL. */ - /* See @FT_Open_Face for more details. */ /* */ /* */ /* FreeType error code. 0~means success. */ @@ -2048,13 +2065,43 @@ FT_BEGIN_HEADER /* args :: A pointer to an `FT_Open_Args' structure that must */ /* be filled by the caller. */ /* */ - /* face_index :: The index of the face within the font. The first */ - /* face has index~0. */ + /* face_index :: This field holds two different values. Bits 0-15 */ + /* are the index of the face in the font file (starting */ + /* with value~0). Set it to~0 if there is only one */ + /* face in the font file. */ + /* */ + /* Bits 16-30 are relevant to GX variation fonts only, */ + /* specifying the named instance index for the current */ + /* face index (starting with value~1; value~0 makes */ + /* FreeType ignore named instances). For non-GX fonts, */ + /* bits 16-30 are ignored. Assuming that you want to */ + /* access the third named instance in face~4, */ + /* `face_index' should be set to 0x00030004. If you */ + /* want to access face~4 without GX variation handling, */ + /* simply set `face_index' to value~4. */ + /* */ + /* FT_Open_Face and its siblings can be used to quickly */ + /* check whether the font format of a given font */ + /* resource is supported by FreeType. In general, if */ + /* the `face_index' argument is negative, the */ + /* function's return value is~0 if the font format is */ + /* recognized, or non-zero otherwise. The function */ + /* allocates a more or less empty face handle in */ + /* `*aface' (if `aface' isn't NULL); the only two */ + /* useful fields in this special case are */ + /* `face->num_faces' and `face->style_flags'. For any */ + /* negative value of `face_index', `face->num_faces' */ + /* gives the number of faces within the font file. For */ + /* the negative value `-(N+1)' (with `N' a 16-bit */ + /* value), bits 16-30 in `face->style_flags' give the */ + /* number of named instances in face `N' if we have a */ + /* GX variation font (or zero otherwise). After */ + /* examination, the returned @FT_Face structure should */ + /* be deallocated with a call to @FT_Done_Face. */ /* */ /* */ /* aface :: A handle to a new face object. If `face_index' is */ /* greater than or equal to zero, it must be non-NULL. */ - /* See note below. */ /* */ /* */ /* FreeType error code. 0~means success. */ @@ -2064,16 +2111,6 @@ FT_BEGIN_HEADER /* slot for the face object that can be accessed directly through */ /* `face->glyph'. */ /* */ - /* FT_Open_Face can be used to quickly check whether the font */ - /* format of a given font resource is supported by FreeType. If the */ - /* `face_index' field is negative, the function's return value is~0 */ - /* if the font format is recognized, or non-zero otherwise; */ - /* the function returns a more or less empty face handle in `*aface' */ - /* (if `aface' isn't NULL). The only useful field in this special */ - /* case is `face->num_faces' that gives the number of faces within */ - /* the font file. After examination, the returned @FT_Face structure */ - /* should be deallocated with a call to @FT_Done_Face. */ - /* */ /* Each new face object created with this function also owns a */ /* default @FT_Size object, accessible as `face->size'. */ /* */ @@ -2084,6 +2121,74 @@ FT_BEGIN_HEADER /* See the discussion of reference counters in the description of */ /* @FT_Reference_Face. */ /* */ + /* To loop over all faces, use code similar to the following snippet */ + /* (omitting the error handling). */ + /* */ + /* { */ + /* ... */ + /* FT_Face face; */ + /* FT_Long i, num_faces; */ + /* */ + /* */ + /* error = FT_Open_Face( library, args, -1, &face ); */ + /* if ( error ) { ... } */ + /* */ + /* num_faces = face->num_faces; */ + /* FT_Done_Face( face ); */ + /* */ + /* for ( i = 0; i < num_faces; i++ ) */ + /* { */ + /* ... */ + /* error = FT_Open_Face( library, args, i, &face ); */ + /* ... */ + /* FT_Done_Face( face ); */ + /* ... */ + /* } */ + /* } */ + /* */ + /* To loop over all valid values for `face_index', use something */ + /* similar to the following snippet, again without error handling. */ + /* The code accesses all faces immediately (thus only a single call */ + /* of `FT_Open_Face' within the do-loop), with and without named */ + /* instances. */ + /* */ + /* { */ + /* ... */ + /* FT_Face face; */ + /* */ + /* FT_Long num_faces = 0; */ + /* FT_Long num_instances = 0; */ + /* */ + /* FT_Long face_idx = 0; */ + /* FT_Long instance_idx = 0; */ + /* */ + /* */ + /* do */ + /* { */ + /* FT_Long id = ( instance_idx << 16 ) + face_idx; */ + /* */ + /* */ + /* error = FT_Open_Face( library, args, id, &face ); */ + /* if ( error ) { ... } */ + /* */ + /* num_faces = face->num_faces; */ + /* num_instances = face->style_flags >> 16; */ + /* */ + /* ... */ + /* */ + /* FT_Done_Face( face ); */ + /* */ + /* if ( instance_idx < num_instances ) */ + /* instance_idx++; */ + /* else */ + /* { */ + /* face_idx++; */ + /* instance_idx = 0; */ + /* } */ + /* */ + /* } while ( face_idx < num_faces ) */ + /* } */ + /* */ FT_EXPORT( FT_Error ) FT_Open_Face( FT_Library library, const FT_Open_Args* args, @@ -2521,7 +2626,7 @@ FT_BEGIN_HEADER * FT_LOAD_XXX * * @description: - * A list of bit-field constants used with @FT_Load_Glyph to indicate + * A list of bit field constants used with @FT_Load_Glyph to indicate * what kind of operations to perform during glyph loading. * * @values: @@ -2638,6 +2743,16 @@ FT_BEGIN_HEADER * bitmaps transparently. Those bitmaps will be in the * @FT_PIXEL_MODE_GRAY format. * + * FT_LOAD_COMPUTE_METRICS :: + * This flag sets computing glyph metrics without the use of bundled + * metrics tables (for example, the `hdmx' table in TrueType fonts). + * Well-behaving fonts have optimized bundled metrics and these should + * be used. This flag is mainly used by font validating or font + * editing applications, which need to ignore, verify, or edit those + * tables. + * + * Currently, this flag is only implemented for TrueType fonts. + * * FT_LOAD_CROP_BITMAP :: * Ignored. Deprecated. * @@ -2683,6 +2798,7 @@ FT_BEGIN_HEADER #define FT_LOAD_NO_AUTOHINT ( 1L << 15 ) /* Bits 16..19 are used by `FT_LOAD_TARGET_' */ #define FT_LOAD_COLOR ( 1L << 20 ) +#define FT_LOAD_COMPUTE_METRICS ( 1L << 21 ) /* */ @@ -2927,15 +3043,22 @@ FT_BEGIN_HEADER /* @FT_Get_Kerning. */ /* */ /* */ - /* FT_KERNING_DEFAULT :: Return scaled and grid-fitted kerning */ - /* distances (value is~0). */ + /* FT_KERNING_DEFAULT :: Return grid-fitted kerning distances in */ + /* pixels (value is~0). Whether they are */ + /* scaled depends on @FT_LOAD_NO_SCALE. */ /* */ - /* FT_KERNING_UNFITTED :: Return scaled but un-grid-fitted kerning */ - /* distances. */ + /* FT_KERNING_UNFITTED :: Return un-grid-fitted kerning distances in */ + /* 26.6 fractional pixels. Whether they are */ + /* scaled depends on @FT_LOAD_NO_SCALE. */ /* */ /* FT_KERNING_UNSCALED :: Return the kerning vector in original font */ /* units. */ /* */ + /* */ + /* FT_KERNING_DEFAULT returns full pixel values; it also makes */ + /* FreeType heuristically scale down kerning distances at small ppem */ + /* values so that they don't become too big. */ + /* */ typedef enum FT_Kerning_Mode_ { FT_KERNING_DEFAULT = 0, @@ -2972,9 +3095,10 @@ FT_BEGIN_HEADER /* kerning vector. */ /* */ /* */ - /* akerning :: The kerning vector. This is either in font units */ - /* or in pixels (26.6 format) for scalable formats, */ - /* and in pixels for fixed-sizes formats. */ + /* akerning :: The kerning vector. This is either in font units, */ + /* fractional pixels (26.6 format), or pixels for */ + /* scalable formats, and in pixels for fixed-sizes */ + /* formats. */ /* */ /* */ /* FreeType error code. 0~means success. */ @@ -3259,6 +3383,13 @@ FT_BEGIN_HEADER /* } */ /* } */ /* */ + /* Be aware that character codes can have values up to 0xFFFFFFFF; */ + /* this might happen for non-Unicode or malformed cmaps. However, */ + /* even with regular Unicode encoding, so-called `last resort fonts' */ + /* (using SFNT cmap format 13, see function @FT_Get_CMap_Format) */ + /* normally have entries for all Unicode characters up to 0x1FFFFF, */ + /* which can cause *a lot* of iterations. */ + /* */ /* Note that `*agindex' is set to~0 if the charmap is empty. The */ /* result itself can be~0 in two cases: if the charmap is empty or */ /* if the value~0 is the first valid character code. */ @@ -3454,6 +3585,9 @@ FT_BEGIN_HEADER /* bitmaps available in the font, then the font is unembeddable. */ /* */ /* */ + /* The flags are ORed together, thus more than a single value can be */ + /* returned. */ + /* */ /* While the fsType flags can indicate that a font may be embedded, a */ /* license with the font vendor may be separately required to use the */ /* font in this way. */ @@ -3839,7 +3973,8 @@ FT_BEGIN_HEADER /* a :: The number to be rounded. */ /* */ /* */ - /* The result of `(a + 0x8000) & -0x10000'. */ + /* `a' rounded to nearest 16.16 fixed integer, halfway cases away */ + /* from zero. */ /* */ FT_EXPORT( FT_Fixed ) FT_RoundFix( FT_Fixed a ); @@ -3858,7 +3993,7 @@ FT_BEGIN_HEADER /* a :: The number for which the ceiling function is to be computed. */ /* */ /* */ - /* The result of `(a + 0x10000 - 1) & -0x10000'. */ + /* `a' rounded towards plus infinity. */ /* */ FT_EXPORT( FT_Fixed ) FT_CeilFix( FT_Fixed a ); @@ -3877,7 +4012,7 @@ FT_BEGIN_HEADER /* a :: The number for which the floor function is to be computed. */ /* */ /* */ - /* The result of `a & -0x10000'. */ + /* `a' rounded towards minus infinity. */ /* */ FT_EXPORT( FT_Fixed ) FT_FloorFix( FT_Fixed a ); @@ -3958,7 +4093,7 @@ FT_BEGIN_HEADER */ #define FREETYPE_MAJOR 2 #define FREETYPE_MINOR 6 -#define FREETYPE_PATCH 0 +#define FREETYPE_PATCH 1 /*************************************************************************/ diff --git a/reactos/lib/3rdparty/freetype/include/ftadvanc.h b/reactos/lib/3rdparty/freetype/include/freetype/ftadvanc.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/ftadvanc.h rename to reactos/lib/3rdparty/freetype/include/freetype/ftadvanc.h diff --git a/reactos/lib/3rdparty/freetype/include/ftautoh.h b/reactos/lib/3rdparty/freetype/include/freetype/ftautoh.h similarity index 99% rename from reactos/lib/3rdparty/freetype/include/ftautoh.h rename to reactos/lib/3rdparty/freetype/include/freetype/ftautoh.h index cf7b76f4920..ab39c219952 100644 --- a/reactos/lib/3rdparty/freetype/include/ftautoh.h +++ b/reactos/lib/3rdparty/freetype/include/freetype/ftautoh.h @@ -247,8 +247,8 @@ FT_BEGIN_HEADER */ typedef struct FT_Prop_GlyphToScriptMap_ { - FT_Face face; - FT_Byte* map; + FT_Face face; + FT_UShort* map; } FT_Prop_GlyphToScriptMap; diff --git a/reactos/lib/3rdparty/freetype/include/ftbbox.h b/reactos/lib/3rdparty/freetype/include/freetype/ftbbox.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/ftbbox.h rename to reactos/lib/3rdparty/freetype/include/freetype/ftbbox.h diff --git a/reactos/lib/3rdparty/freetype/include/ftbdf.h b/reactos/lib/3rdparty/freetype/include/freetype/ftbdf.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/ftbdf.h rename to reactos/lib/3rdparty/freetype/include/freetype/ftbdf.h diff --git a/reactos/lib/3rdparty/freetype/include/ftbitmap.h b/reactos/lib/3rdparty/freetype/include/freetype/ftbitmap.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/ftbitmap.h rename to reactos/lib/3rdparty/freetype/include/freetype/ftbitmap.h diff --git a/reactos/lib/3rdparty/freetype/include/ftbzip2.h b/reactos/lib/3rdparty/freetype/include/freetype/ftbzip2.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/ftbzip2.h rename to reactos/lib/3rdparty/freetype/include/freetype/ftbzip2.h diff --git a/reactos/lib/3rdparty/freetype/include/ftcache.h b/reactos/lib/3rdparty/freetype/include/freetype/ftcache.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/ftcache.h rename to reactos/lib/3rdparty/freetype/include/freetype/ftcache.h diff --git a/reactos/lib/3rdparty/freetype/include/ftcffdrv.h b/reactos/lib/3rdparty/freetype/include/freetype/ftcffdrv.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/ftcffdrv.h rename to reactos/lib/3rdparty/freetype/include/freetype/ftcffdrv.h diff --git a/reactos/lib/3rdparty/freetype/include/ftchapters.h b/reactos/lib/3rdparty/freetype/include/freetype/ftchapters.h similarity index 89% rename from reactos/lib/3rdparty/freetype/include/ftchapters.h rename to reactos/lib/3rdparty/freetype/include/freetype/ftchapters.h index d333761c81b..ab4389530ef 100644 --- a/reactos/lib/3rdparty/freetype/include/ftchapters.h +++ b/reactos/lib/3rdparty/freetype/include/freetype/ftchapters.h @@ -119,3 +119,17 @@ /* lcd_filtering */ /* */ /***************************************************************************/ + +/***************************************************************************/ +/* */ +/* */ +/* error_codes */ +/* */ +/* */ +/* Error Codes */ +/* */ +/* <Sections> */ +/* error_enumerations */ +/* error_code_values */ +/* */ +/***************************************************************************/ diff --git a/reactos/lib/3rdparty/freetype/include/ftcid.h b/reactos/lib/3rdparty/freetype/include/freetype/ftcid.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/ftcid.h rename to reactos/lib/3rdparty/freetype/include/freetype/ftcid.h diff --git a/reactos/lib/3rdparty/freetype/include/fterrdef.h b/reactos/lib/3rdparty/freetype/include/freetype/fterrdef.h similarity index 82% rename from reactos/lib/3rdparty/freetype/include/fterrdef.h rename to reactos/lib/3rdparty/freetype/include/freetype/fterrdef.h index 1bf0751b173..d865da7127c 100644 --- a/reactos/lib/3rdparty/freetype/include/fterrdef.h +++ b/reactos/lib/3rdparty/freetype/include/freetype/fterrdef.h @@ -16,18 +16,43 @@ /***************************************************************************/ - /*******************************************************************/ - /*******************************************************************/ - /***** *****/ - /***** LIST OF ERROR CODES/MESSAGES *****/ - /***** *****/ - /*******************************************************************/ - /*******************************************************************/ + /*************************************************************************/ + /* */ + /* <Section> */ + /* error_code_values */ + /* */ + /* <Title> */ + /* Error Code Values */ + /* */ + /* <Abstract> */ + /* All possible error codes returned by FreeType functions. */ + /* */ + /* <Description> */ + /* The list below is taken verbatim from the file `fterrdef.h' */ + /* (loaded automatically by including `FT_FREETYPE_H'). The first */ + /* argument of the `FT_ERROR_DEF_' macro is the error label; by */ + /* default, the prefix `FT_Err_' gets added so that you get error */ + /* names like `FT_Err_Cannot_Open_Resource'. The second argument is */ + /* the error code, and the last argument an error string, which is not */ + /* used by FreeType. */ + /* */ + /* Within your application you should *only* use error names and */ + /* *never* its numeric values! The latter might (and actually do) */ + /* change in forthcoming FreeType versions. */ + /* */ + /* Macro `FT_NOERRORDEF_' defines `FT_Err_Ok', which is always zero. */ + /* See the `Error Enumerations' subsection how to automatically */ + /* generate a list of error strings. */ + /* */ + /*************************************************************************/ - /* You need to define both FT_ERRORDEF_ and FT_NOERRORDEF_ before */ - /* including this file. */ - + /*************************************************************************/ + /* */ + /* <Enum> */ + /* FT_Err_XXX */ + /* */ + /*************************************************************************/ /* generic errors */ @@ -245,5 +270,7 @@ FT_ERRORDEF_( Corrupted_Font_Glyphs, 0xBA, "Font glyphs corrupted or missing fields" ) + /* */ + /* END */ diff --git a/reactos/lib/3rdparty/freetype/include/fterrors.h b/reactos/lib/3rdparty/freetype/include/freetype/fterrors.h similarity index 61% rename from reactos/lib/3rdparty/freetype/include/fterrors.h rename to reactos/lib/3rdparty/freetype/include/freetype/fterrors.h index 376bee6f86a..0507b9ad7dc 100644 --- a/reactos/lib/3rdparty/freetype/include/fterrors.h +++ b/reactos/lib/3rdparty/freetype/include/freetype/fterrors.h @@ -18,68 +18,86 @@ /*************************************************************************/ /* */ - /* This special header file is used to define the handling of FT2 */ - /* enumeration constants. It can also be used to generate error message */ - /* strings with a small macro trick explained below. */ + /* <Section> */ + /* error_enumerations */ /* */ - /* I - Error Formats */ - /* ----------------- */ + /* <Title> */ + /* Error Enumerations */ + /* */ + /* <Abstract> */ + /* How to handle errors and error strings. */ + /* */ + /* <Description> */ + /* The header file `fterrors.h' (which is automatically included by */ + /* `freetype.h' defines the handling of FreeType's enumeration */ + /* constants. It can also be used to generate error message strings */ + /* with a small macro trick explained below. */ + /* */ + /* *Error* *Formats* */ /* */ /* The configuration macro FT_CONFIG_OPTION_USE_MODULE_ERRORS can be */ - /* defined in ftoption.h in order to make the higher byte indicate */ + /* defined in `ftoption.h' in order to make the higher byte indicate */ /* the module where the error has happened (this is not compatible */ - /* with standard builds of FreeType 2). See the file `ftmoderr.h' for */ - /* more details. */ + /* with standard builds of FreeType 2, however). See the file */ + /* `ftmoderr.h' for more details. */ /* */ + /* *Error* *Message* *Strings* */ /* */ - /* II - Error Message strings */ - /* -------------------------- */ - /* */ - /* The error definitions below are made through special macros that */ - /* allow client applications to build a table of error message strings */ - /* if they need it. The strings are not included in a normal build of */ - /* FreeType 2 to save space (most client applications do not use */ - /* them). */ + /* Error definitions are set up with special macros that allow client */ + /* applications to build a table of error message strings. The */ + /* strings are not included in a normal build of FreeType 2 to */ + /* save space (most client applications do not use them). */ /* */ /* To do so, you have to define the following macros before including */ - /* this file: */ - /* */ - /* FT_ERROR_START_LIST :: */ - /* This macro is called before anything else to define the start of */ - /* the error list. It is followed by several FT_ERROR_DEF calls */ - /* (see below). */ - /* */ - /* FT_ERROR_DEF( e, v, s ) :: */ - /* This macro is called to define one single error. */ - /* `e' is the error code identifier (e.g. FT_Err_Invalid_Argument). */ - /* `v' is the error numerical value. */ - /* `s' is the corresponding error string. */ - /* */ - /* FT_ERROR_END_LIST :: */ - /* This macro ends the list. */ - /* */ - /* Additionally, you have to undefine __FTERRORS_H__ before #including */ /* this file. */ /* */ - /* Here is a simple example: */ + /* { */ + /* FT_ERROR_START_LIST */ + /* } */ /* */ + /* This macro is called before anything else to define the start of */ + /* the error list. It is followed by several FT_ERROR_DEF calls. */ + /* */ + /* { */ + /* FT_ERROR_DEF( e, v, s ) */ + /* } */ + /* */ + /* This macro is called to define one single error. `e' is the error */ + /* code identifier (e.g., `Invalid_Argument'), `v' is the error's */ + /* numerical value, and `s' is the corresponding error string. */ + /* */ + /* { */ + /* FT_ERROR_END_LIST */ + /* } */ + /* */ + /* This macro ends the list. */ + /* */ + /* Additionally, you have to undefine `__FTERRORS_H__' before */ + /* #including this file. */ + /* */ + /* Here is a simple example. */ + /* */ + /* { */ + /* #undef __FTERRORS_H__ */ + /* #define FT_ERRORDEF( e, v, s ) { e, s }, */ + /* #define FT_ERROR_START_LIST { */ + /* #define FT_ERROR_END_LIST { 0, NULL } }; */ + /* */ + /* const struct */ /* { */ - /* #undef __FTERRORS_H__ */ - /* #define FT_ERRORDEF( e, v, s ) { e, s }, */ - /* #define FT_ERROR_START_LIST { */ - /* #define FT_ERROR_END_LIST { 0, 0 } }; */ + /* int err_code; */ + /* const char* err_msg; */ + /* } ft_errors[] = */ /* */ - /* const struct */ - /* { */ - /* int err_code; */ - /* const char* err_msg; */ - /* } ft_errors[] = */ + /* #include FT_ERRORS_H */ + /* } */ /* */ - /* #include FT_ERRORS_H */ - /* } */ + /* Note that `FT_Err_Ok' is _not_ defined with `FT_ERRORDEF' but with */ + /* `FT_NOERRORDEF'; it is always zero. */ /* */ /*************************************************************************/ + /* */ #ifndef __FTERRORS_H__ #define __FTERRORS_H__ diff --git a/reactos/lib/3rdparty/freetype/include/ftfntfmt.h b/reactos/lib/3rdparty/freetype/include/freetype/ftfntfmt.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/ftfntfmt.h rename to reactos/lib/3rdparty/freetype/include/freetype/ftfntfmt.h diff --git a/reactos/lib/3rdparty/freetype/include/ftgasp.h b/reactos/lib/3rdparty/freetype/include/freetype/ftgasp.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/ftgasp.h rename to reactos/lib/3rdparty/freetype/include/freetype/ftgasp.h diff --git a/reactos/lib/3rdparty/freetype/include/ftglyph.h b/reactos/lib/3rdparty/freetype/include/freetype/ftglyph.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/ftglyph.h rename to reactos/lib/3rdparty/freetype/include/freetype/ftglyph.h diff --git a/reactos/lib/3rdparty/freetype/include/ftgxval.h b/reactos/lib/3rdparty/freetype/include/freetype/ftgxval.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/ftgxval.h rename to reactos/lib/3rdparty/freetype/include/freetype/ftgxval.h diff --git a/reactos/lib/3rdparty/freetype/include/ftgzip.h b/reactos/lib/3rdparty/freetype/include/freetype/ftgzip.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/ftgzip.h rename to reactos/lib/3rdparty/freetype/include/freetype/ftgzip.h diff --git a/reactos/lib/3rdparty/freetype/include/ftimage.h b/reactos/lib/3rdparty/freetype/include/freetype/ftimage.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/ftimage.h rename to reactos/lib/3rdparty/freetype/include/freetype/ftimage.h diff --git a/reactos/lib/3rdparty/freetype/include/ftincrem.h b/reactos/lib/3rdparty/freetype/include/freetype/ftincrem.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/ftincrem.h rename to reactos/lib/3rdparty/freetype/include/freetype/ftincrem.h diff --git a/reactos/lib/3rdparty/freetype/include/ftlcdfil.h b/reactos/lib/3rdparty/freetype/include/freetype/ftlcdfil.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/ftlcdfil.h rename to reactos/lib/3rdparty/freetype/include/freetype/ftlcdfil.h diff --git a/reactos/lib/3rdparty/freetype/include/ftlist.h b/reactos/lib/3rdparty/freetype/include/freetype/ftlist.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/ftlist.h rename to reactos/lib/3rdparty/freetype/include/freetype/ftlist.h diff --git a/reactos/lib/3rdparty/freetype/include/ftlzw.h b/reactos/lib/3rdparty/freetype/include/freetype/ftlzw.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/ftlzw.h rename to reactos/lib/3rdparty/freetype/include/freetype/ftlzw.h diff --git a/reactos/lib/3rdparty/freetype/include/ftmac.h b/reactos/lib/3rdparty/freetype/include/freetype/ftmac.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/ftmac.h rename to reactos/lib/3rdparty/freetype/include/freetype/ftmac.h diff --git a/reactos/lib/3rdparty/freetype/include/ftmm.h b/reactos/lib/3rdparty/freetype/include/freetype/ftmm.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/ftmm.h rename to reactos/lib/3rdparty/freetype/include/freetype/ftmm.h diff --git a/reactos/lib/3rdparty/freetype/include/ftmodapi.h b/reactos/lib/3rdparty/freetype/include/freetype/ftmodapi.h similarity index 99% rename from reactos/lib/3rdparty/freetype/include/ftmodapi.h rename to reactos/lib/3rdparty/freetype/include/freetype/ftmodapi.h index 2ef3f467492..544279a68af 100644 --- a/reactos/lib/3rdparty/freetype/include/ftmodapi.h +++ b/reactos/lib/3rdparty/freetype/include/freetype/ftmodapi.h @@ -63,7 +63,7 @@ FT_BEGIN_HEADER /* psaux */ /* pshinter */ /* psnames */ - /* raster1, raster5 */ + /* raster1 */ /* sfnt */ /* smooth, smooth-lcd, smooth-lcdv */ /* truetype */ diff --git a/reactos/lib/3rdparty/freetype/include/ftmoderr.h b/reactos/lib/3rdparty/freetype/include/freetype/ftmoderr.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/ftmoderr.h rename to reactos/lib/3rdparty/freetype/include/freetype/ftmoderr.h diff --git a/reactos/lib/3rdparty/freetype/include/ftotval.h b/reactos/lib/3rdparty/freetype/include/freetype/ftotval.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/ftotval.h rename to reactos/lib/3rdparty/freetype/include/freetype/ftotval.h diff --git a/reactos/lib/3rdparty/freetype/include/ftoutln.h b/reactos/lib/3rdparty/freetype/include/freetype/ftoutln.h similarity index 99% rename from reactos/lib/3rdparty/freetype/include/ftoutln.h rename to reactos/lib/3rdparty/freetype/include/freetype/ftoutln.h index 106cfde06d3..b6ec70de8cf 100644 --- a/reactos/lib/3rdparty/freetype/include/ftoutln.h +++ b/reactos/lib/3rdparty/freetype/include/freetype/ftoutln.h @@ -354,8 +354,8 @@ FT_BEGIN_HEADER /* */ /* { */ /* FT_Load_Glyph( face, index, FT_LOAD_DEFAULT ); */ - /* if ( face->slot->format == FT_GLYPH_FORMAT_OUTLINE ) */ - /* FT_Outline_Embolden( &face->slot->outline, strength ); */ + /* if ( face->glyph->format == FT_GLYPH_FORMAT_OUTLINE ) */ + /* FT_Outline_Embolden( &face->glyph->outline, strength ); */ /* } */ /* */ /* To get meaningful results, font scaling values must be set with */ diff --git a/reactos/lib/3rdparty/freetype/include/ftpfr.h b/reactos/lib/3rdparty/freetype/include/freetype/ftpfr.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/ftpfr.h rename to reactos/lib/3rdparty/freetype/include/freetype/ftpfr.h diff --git a/reactos/lib/3rdparty/freetype/include/ftrender.h b/reactos/lib/3rdparty/freetype/include/freetype/ftrender.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/ftrender.h rename to reactos/lib/3rdparty/freetype/include/freetype/ftrender.h diff --git a/reactos/lib/3rdparty/freetype/include/ftsizes.h b/reactos/lib/3rdparty/freetype/include/freetype/ftsizes.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/ftsizes.h rename to reactos/lib/3rdparty/freetype/include/freetype/ftsizes.h diff --git a/reactos/lib/3rdparty/freetype/include/ftsnames.h b/reactos/lib/3rdparty/freetype/include/freetype/ftsnames.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/ftsnames.h rename to reactos/lib/3rdparty/freetype/include/freetype/ftsnames.h diff --git a/reactos/lib/3rdparty/freetype/include/ftstroke.h b/reactos/lib/3rdparty/freetype/include/freetype/ftstroke.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/ftstroke.h rename to reactos/lib/3rdparty/freetype/include/freetype/ftstroke.h diff --git a/reactos/lib/3rdparty/freetype/include/ftsynth.h b/reactos/lib/3rdparty/freetype/include/freetype/ftsynth.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/ftsynth.h rename to reactos/lib/3rdparty/freetype/include/freetype/ftsynth.h diff --git a/reactos/lib/3rdparty/freetype/include/ftsystem.h b/reactos/lib/3rdparty/freetype/include/freetype/ftsystem.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/ftsystem.h rename to reactos/lib/3rdparty/freetype/include/freetype/ftsystem.h diff --git a/reactos/lib/3rdparty/freetype/include/fttrigon.h b/reactos/lib/3rdparty/freetype/include/freetype/fttrigon.h similarity index 98% rename from reactos/lib/3rdparty/freetype/include/fttrigon.h rename to reactos/lib/3rdparty/freetype/include/freetype/fttrigon.h index 3d821ba16ad..485ec515874 100644 --- a/reactos/lib/3rdparty/freetype/include/fttrigon.h +++ b/reactos/lib/3rdparty/freetype/include/freetype/fttrigon.h @@ -225,8 +225,8 @@ FT_BEGIN_HEADER * * @description: * Return the unit vector corresponding to a given angle. After the - * call, the value of `vec.x' will be `sin(angle)', and the value of - * `vec.y' will be `cos(angle)'. + * call, the value of `vec.x' will be `cos(angle)', and the value of + * `vec.y' will be `sin(angle)'. * * This function is useful to retrieve both the sinus and cosinus of a * given angle quickly. diff --git a/reactos/lib/3rdparty/freetype/include/ftttdrv.h b/reactos/lib/3rdparty/freetype/include/freetype/ftttdrv.h similarity index 71% rename from reactos/lib/3rdparty/freetype/include/ftttdrv.h rename to reactos/lib/3rdparty/freetype/include/freetype/ftttdrv.h index f56040b8288..dc0081a0b96 100644 --- a/reactos/lib/3rdparty/freetype/include/ftttdrv.h +++ b/reactos/lib/3rdparty/freetype/include/freetype/ftttdrv.h @@ -52,6 +52,83 @@ FT_BEGIN_HEADER * * The TrueType driver's module name is `truetype'. * + * We start with a list of definitions, kindly provided by Greg + * Hitchcock. + * + * _Bi-Level_ _Rendering_ + * + * Monochromatic rendering, exclusively used in the early days of + * TrueType by both Apple and Microsoft. Microsoft's GDI interface + * supported hinting of the right-side bearing point, such that the + * advance width could be non-linear. Most often this was done to + * achieve some level of glyph symmetry. To enable reasonable + * performance (e.g., not having to run hinting on all glyphs just to + * get the widths) there was a bit in the head table indicating if the + * side bearing was hinted, and additional tables, `hdmx' and `LTSH', to + * cache hinting widths across multiple sizes and device aspect ratios. + * + * _Font_ _Smoothing_ + * + * Microsoft's GDI implementation of anti-aliasing. Not traditional + * anti-aliasing as the outlines were hinted before the sampling. The + * widths matched the bi-level rendering. + * + * _ClearType_ _Rendering_ + * + * Technique that uses physical subpixels to improve rendering on LCD + * (and other) displays. Because of the higher resolution, many methods + * of improving symmetry in glyphs through hinting the right-side + * bearing were no longer necessary. This lead to what GDI calls + * `natural widths' ClearType, see + * http://www.beatstamm.com/typography/RTRCh4.htm#Sec21. Since hinting + * has extra resolution, most non-linearity went away, but it is still + * possible for hints to change the advance widths in this mode. + * + * _ClearType_ _Compatible_ _Widths_ + * + * One of the earliest challenges with ClearType was allowing the + * implementation in GDI to be selected without requiring all UI and + * documents to reflow. To address this, a compatible method of + * rendering ClearType was added where the font hints are executed once + * to determine the width in bi-level rendering, and then re-run in + * ClearType, with the difference in widths being absorbed in the font + * hints for ClearType (mostly in the white space of hints); see + * http://www.beatstamm.com/typography/RTRCh4.htm#Sec20. Somewhat by + * definition, compatible width ClearType allows for non-linear widths, + * but only when the bi-level version has non-linear widths. + * + * _ClearType_ _Subpixel_ _Positioning_ + * + * One of the nice benefits of ClearType is the ability to more crisply + * display fractional widths; unfortunately, the GDI model of integer + * bitmaps did not support this. However, the WPF and Direct Write + * frameworks do support fractional widths. DWrite calls this `natural + * mode', not to be confused with GDI's `natural widths'. Subpixel + * positioning, in the current implementation of Direct Write, + * unfortunately does not support hinted advance widths, see + * http://www.beatstamm.com/typography/RTRCh4.htm#Sec22. Note that the + * TrueType interpreter fully allows the advance width to be adjusted in + * this mode, just the DWrite client will ignore those changes. + * + * _ClearType_ _Backwards_ _Compatibility_ + * + * This is a set of exceptions made in the TrueType interpreter to + * minimize hinting techniques that were problematic with the extra + * resolution of ClearType; see + * http://www.beatstamm.com/typography/RTRCh4.htm#Sec1 and + * http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx. + * This technique is not to be confused with ClearType compatible + * widths. ClearType backwards compatibility has no direct impact on + * changing advance widths, but there might be an indirect impact on + * disabling some deltas. This could be worked around in backwards + * compatibility mode. + * + * _Native_ _ClearType_ _Mode_ + * + * (Not to be confused with `natural widths'.) This mode removes all + * the exceptions in the TrueType interpreter when running with + * ClearType. Any issues on widths would still apply, though. + * */ diff --git a/reactos/lib/3rdparty/freetype/include/fttypes.h b/reactos/lib/3rdparty/freetype/include/freetype/fttypes.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/fttypes.h rename to reactos/lib/3rdparty/freetype/include/freetype/fttypes.h diff --git a/reactos/lib/3rdparty/freetype/include/ftwinfnt.h b/reactos/lib/3rdparty/freetype/include/freetype/ftwinfnt.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/ftwinfnt.h rename to reactos/lib/3rdparty/freetype/include/freetype/ftwinfnt.h diff --git a/reactos/lib/3rdparty/freetype/include/internal/autohint.h b/reactos/lib/3rdparty/freetype/include/freetype/internal/autohint.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/internal/autohint.h rename to reactos/lib/3rdparty/freetype/include/freetype/internal/autohint.h diff --git a/reactos/lib/3rdparty/freetype/include/internal/ftcalc.h b/reactos/lib/3rdparty/freetype/include/freetype/internal/ftcalc.h similarity index 96% rename from reactos/lib/3rdparty/freetype/include/internal/ftcalc.h rename to reactos/lib/3rdparty/freetype/include/freetype/internal/ftcalc.h index 75752c3d99a..67ade7e5f94 100644 --- a/reactos/lib/3rdparty/freetype/include/internal/ftcalc.h +++ b/reactos/lib/3rdparty/freetype/include/freetype/internal/ftcalc.h @@ -299,6 +299,18 @@ FT_BEGIN_HEADER FT_Long scaling ); + /* + * This function normalizes a vector and returns its original length. + * The normalized vector is a 16.16 fixed-point unit vector with length + * close to 0x10000. The accuracy of the returned length is limited to + * 16 bits also. The function utilizes quick inverse square root + * approximation without divisions and square roots relying on Newton's + * iterations instead. + */ + FT_BASE( FT_UInt32 ) + FT_Vector_NormLen( FT_Vector* vector ); + + /* * Return -1, 0, or +1, depending on the orientation of a given corner. * We use the Cartesian coordinate system, with positive vertical values diff --git a/reactos/lib/3rdparty/freetype/include/internal/ftdebug.h b/reactos/lib/3rdparty/freetype/include/freetype/internal/ftdebug.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/internal/ftdebug.h rename to reactos/lib/3rdparty/freetype/include/freetype/internal/ftdebug.h diff --git a/reactos/lib/3rdparty/freetype/include/internal/ftdriver.h b/reactos/lib/3rdparty/freetype/include/freetype/internal/ftdriver.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/internal/ftdriver.h rename to reactos/lib/3rdparty/freetype/include/freetype/internal/ftdriver.h diff --git a/reactos/lib/3rdparty/freetype/include/internal/ftgloadr.h b/reactos/lib/3rdparty/freetype/include/freetype/internal/ftgloadr.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/internal/ftgloadr.h rename to reactos/lib/3rdparty/freetype/include/freetype/internal/ftgloadr.h diff --git a/reactos/lib/3rdparty/freetype/include/internal/ftmemory.h b/reactos/lib/3rdparty/freetype/include/freetype/internal/ftmemory.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/internal/ftmemory.h rename to reactos/lib/3rdparty/freetype/include/freetype/internal/ftmemory.h diff --git a/reactos/lib/3rdparty/freetype/include/internal/ftobjs.h b/reactos/lib/3rdparty/freetype/include/freetype/internal/ftobjs.h similarity index 99% rename from reactos/lib/3rdparty/freetype/include/internal/ftobjs.h rename to reactos/lib/3rdparty/freetype/include/freetype/internal/ftobjs.h index 37317a43c97..da5582dc3fc 100644 --- a/reactos/lib/3rdparty/freetype/include/internal/ftobjs.h +++ b/reactos/lib/3rdparty/freetype/include/freetype/internal/ftobjs.h @@ -83,12 +83,12 @@ FT_BEGIN_HEADER x > y ? x + ( 3 * y >> 3 ) \ : y + ( 3 * x >> 3 ) ) - /* we use the TYPEOF macro to suppress signedness compilation warnings */ -#define FT_PAD_FLOOR( x, n ) ( (x) & ~TYPEOF( x )( (n)-1 ) ) + /* we use FT_TYPEOF to suppress signedness compilation warnings */ +#define FT_PAD_FLOOR( x, n ) ( (x) & ~FT_TYPEOF( x )( (n)-1 ) ) #define FT_PAD_ROUND( x, n ) FT_PAD_FLOOR( (x) + ((n)/2), n ) #define FT_PAD_CEIL( x, n ) FT_PAD_FLOOR( (x) + ((n)-1), n ) -#define FT_PIX_FLOOR( x ) ( (x) & ~TYPEOF( x )63 ) +#define FT_PIX_FLOOR( x ) ( (x) & ~FT_TYPEOF( x )63 ) #define FT_PIX_ROUND( x ) FT_PIX_FLOOR( (x) + 32 ) #define FT_PIX_CEIL( x ) FT_PIX_FLOOR( (x) + 63 ) diff --git a/reactos/lib/3rdparty/freetype/include/internal/ftpic.h b/reactos/lib/3rdparty/freetype/include/freetype/internal/ftpic.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/internal/ftpic.h rename to reactos/lib/3rdparty/freetype/include/freetype/internal/ftpic.h diff --git a/reactos/lib/3rdparty/freetype/include/internal/ftrfork.h b/reactos/lib/3rdparty/freetype/include/freetype/internal/ftrfork.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/internal/ftrfork.h rename to reactos/lib/3rdparty/freetype/include/freetype/internal/ftrfork.h diff --git a/reactos/lib/3rdparty/freetype/include/internal/ftserv.h b/reactos/lib/3rdparty/freetype/include/freetype/internal/ftserv.h similarity index 96% rename from reactos/lib/3rdparty/freetype/include/internal/ftserv.h rename to reactos/lib/3rdparty/freetype/include/freetype/internal/ftserv.h index 8f837e47568..11a0c7f3de5 100644 --- a/reactos/lib/3rdparty/freetype/include/internal/ftserv.h +++ b/reactos/lib/3rdparty/freetype/include/freetype/internal/ftserv.h @@ -734,24 +734,24 @@ FT_BEGIN_HEADER * The header files containing the services. */ -#define FT_SERVICE_BDF_H <internal/services/svbdf.h> -#define FT_SERVICE_CID_H <internal/services/svcid.h> -#define FT_SERVICE_GLYPH_DICT_H <internal/services/svgldict.h> -#define FT_SERVICE_GX_VALIDATE_H <internal/services/svgxval.h> -#define FT_SERVICE_KERNING_H <internal/services/svkern.h> -#define FT_SERVICE_MULTIPLE_MASTERS_H <internal/services/svmm.h> -#define FT_SERVICE_OPENTYPE_VALIDATE_H <internal/services/svotval.h> -#define FT_SERVICE_PFR_H <internal/services/svpfr.h> -#define FT_SERVICE_POSTSCRIPT_CMAPS_H <internal/services/svpscmap.h> -#define FT_SERVICE_POSTSCRIPT_INFO_H <internal/services/svpsinfo.h> -#define FT_SERVICE_POSTSCRIPT_NAME_H <internal/services/svpostnm.h> -#define FT_SERVICE_PROPERTIES_H <internal/services/svprop.h> -#define FT_SERVICE_SFNT_H <internal/services/svsfnt.h> -#define FT_SERVICE_TRUETYPE_ENGINE_H <internal/services/svtteng.h> -#define FT_SERVICE_TT_CMAP_H <internal/services/svttcmap.h> -#define FT_SERVICE_WINFNT_H <internal/services/svwinfnt.h> -#define FT_SERVICE_FONT_FORMAT_H <internal/services/svfntfmt.h> -#define FT_SERVICE_TRUETYPE_GLYF_H <internal/services/svttglyf.h> +#define FT_SERVICE_BDF_H <freetype/internal/services/svbdf.h> +#define FT_SERVICE_CID_H <freetype/internal/services/svcid.h> +#define FT_SERVICE_GLYPH_DICT_H <freetype/internal/services/svgldict.h> +#define FT_SERVICE_GX_VALIDATE_H <freetype/internal/services/svgxval.h> +#define FT_SERVICE_KERNING_H <freetype/internal/services/svkern.h> +#define FT_SERVICE_MULTIPLE_MASTERS_H <freetype/internal/services/svmm.h> +#define FT_SERVICE_OPENTYPE_VALIDATE_H <freetype/internal/services/svotval.h> +#define FT_SERVICE_PFR_H <freetype/internal/services/svpfr.h> +#define FT_SERVICE_POSTSCRIPT_CMAPS_H <freetype/internal/services/svpscmap.h> +#define FT_SERVICE_POSTSCRIPT_INFO_H <freetype/internal/services/svpsinfo.h> +#define FT_SERVICE_POSTSCRIPT_NAME_H <freetype/internal/services/svpostnm.h> +#define FT_SERVICE_PROPERTIES_H <freetype/internal/services/svprop.h> +#define FT_SERVICE_SFNT_H <freetype/internal/services/svsfnt.h> +#define FT_SERVICE_TRUETYPE_ENGINE_H <freetype/internal/services/svtteng.h> +#define FT_SERVICE_TT_CMAP_H <freetype/internal/services/svttcmap.h> +#define FT_SERVICE_WINFNT_H <freetype/internal/services/svwinfnt.h> +#define FT_SERVICE_FONT_FORMAT_H <freetype/internal/services/svfntfmt.h> +#define FT_SERVICE_TRUETYPE_GLYF_H <freetype/internal/services/svttglyf.h> /* */ diff --git a/reactos/lib/3rdparty/freetype/include/internal/ftstream.h b/reactos/lib/3rdparty/freetype/include/freetype/internal/ftstream.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/internal/ftstream.h rename to reactos/lib/3rdparty/freetype/include/freetype/internal/ftstream.h diff --git a/reactos/lib/3rdparty/freetype/include/internal/fttrace.h b/reactos/lib/3rdparty/freetype/include/freetype/internal/fttrace.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/internal/fttrace.h rename to reactos/lib/3rdparty/freetype/include/freetype/internal/fttrace.h diff --git a/reactos/lib/3rdparty/freetype/include/internal/ftvalid.h b/reactos/lib/3rdparty/freetype/include/freetype/internal/ftvalid.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/internal/ftvalid.h rename to reactos/lib/3rdparty/freetype/include/freetype/internal/ftvalid.h diff --git a/reactos/lib/3rdparty/freetype/include/internal/internal.h b/reactos/lib/3rdparty/freetype/include/freetype/internal/internal.h similarity index 61% rename from reactos/lib/3rdparty/freetype/include/internal/internal.h rename to reactos/lib/3rdparty/freetype/include/freetype/internal/internal.h index 1c1fd0ee15d..809ce59c92f 100644 --- a/reactos/lib/3rdparty/freetype/include/internal/internal.h +++ b/reactos/lib/3rdparty/freetype/include/freetype/internal/internal.h @@ -24,28 +24,28 @@ /*************************************************************************/ -#define FT_INTERNAL_OBJECTS_H <internal/ftobjs.h> -#define FT_INTERNAL_PIC_H <internal/ftpic.h> -#define FT_INTERNAL_STREAM_H <internal/ftstream.h> -#define FT_INTERNAL_MEMORY_H <internal/ftmemory.h> -#define FT_INTERNAL_DEBUG_H <internal/ftdebug.h> -#define FT_INTERNAL_CALC_H <internal/ftcalc.h> -#define FT_INTERNAL_DRIVER_H <internal/ftdriver.h> -#define FT_INTERNAL_TRACE_H <internal/fttrace.h> -#define FT_INTERNAL_GLYPH_LOADER_H <internal/ftgloadr.h> -#define FT_INTERNAL_SFNT_H <internal/sfnt.h> -#define FT_INTERNAL_SERVICE_H <internal/ftserv.h> -#define FT_INTERNAL_RFORK_H <internal/ftrfork.h> -#define FT_INTERNAL_VALIDATE_H <internal/ftvalid.h> +#define FT_INTERNAL_OBJECTS_H <freetype/internal/ftobjs.h> +#define FT_INTERNAL_PIC_H <freetype/internal/ftpic.h> +#define FT_INTERNAL_STREAM_H <freetype/internal/ftstream.h> +#define FT_INTERNAL_MEMORY_H <freetype/internal/ftmemory.h> +#define FT_INTERNAL_DEBUG_H <freetype/internal/ftdebug.h> +#define FT_INTERNAL_CALC_H <freetype/internal/ftcalc.h> +#define FT_INTERNAL_DRIVER_H <freetype/internal/ftdriver.h> +#define FT_INTERNAL_TRACE_H <freetype/internal/fttrace.h> +#define FT_INTERNAL_GLYPH_LOADER_H <freetype/internal/ftgloadr.h> +#define FT_INTERNAL_SFNT_H <freetype/internal/sfnt.h> +#define FT_INTERNAL_SERVICE_H <freetype/internal/ftserv.h> +#define FT_INTERNAL_RFORK_H <freetype/internal/ftrfork.h> +#define FT_INTERNAL_VALIDATE_H <freetype/internal/ftvalid.h> -#define FT_INTERNAL_TRUETYPE_TYPES_H <internal/tttypes.h> -#define FT_INTERNAL_TYPE1_TYPES_H <internal/t1types.h> +#define FT_INTERNAL_TRUETYPE_TYPES_H <freetype/internal/tttypes.h> +#define FT_INTERNAL_TYPE1_TYPES_H <freetype/internal/t1types.h> -#define FT_INTERNAL_POSTSCRIPT_AUX_H <internal/psaux.h> -#define FT_INTERNAL_POSTSCRIPT_HINTS_H <internal/pshints.h> -#define FT_INTERNAL_POSTSCRIPT_GLOBALS_H <internal/psglobal.h> +#define FT_INTERNAL_POSTSCRIPT_AUX_H <freetype/internal/psaux.h> +#define FT_INTERNAL_POSTSCRIPT_HINTS_H <freetype/internal/pshints.h> +#define FT_INTERNAL_POSTSCRIPT_GLOBALS_H <freetype/internal/psglobal.h> -#define FT_INTERNAL_AUTOHINT_H <internal/autohint.h> +#define FT_INTERNAL_AUTOHINT_H <freetype/internal/autohint.h> #if defined( _MSC_VER ) /* Visual C++ (and Intel C++) */ diff --git a/reactos/lib/3rdparty/freetype/include/internal/psaux.h b/reactos/lib/3rdparty/freetype/include/freetype/internal/psaux.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/internal/psaux.h rename to reactos/lib/3rdparty/freetype/include/freetype/internal/psaux.h diff --git a/reactos/lib/3rdparty/freetype/include/internal/pshints.h b/reactos/lib/3rdparty/freetype/include/freetype/internal/pshints.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/internal/pshints.h rename to reactos/lib/3rdparty/freetype/include/freetype/internal/pshints.h diff --git a/reactos/lib/3rdparty/freetype/include/internal/services/svbdf.h b/reactos/lib/3rdparty/freetype/include/freetype/internal/services/svbdf.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/internal/services/svbdf.h rename to reactos/lib/3rdparty/freetype/include/freetype/internal/services/svbdf.h diff --git a/reactos/lib/3rdparty/freetype/include/internal/services/svcid.h b/reactos/lib/3rdparty/freetype/include/freetype/internal/services/svcid.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/internal/services/svcid.h rename to reactos/lib/3rdparty/freetype/include/freetype/internal/services/svcid.h diff --git a/reactos/lib/3rdparty/freetype/include/internal/services/svfntfmt.h b/reactos/lib/3rdparty/freetype/include/freetype/internal/services/svfntfmt.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/internal/services/svfntfmt.h rename to reactos/lib/3rdparty/freetype/include/freetype/internal/services/svfntfmt.h diff --git a/reactos/lib/3rdparty/freetype/include/internal/services/svgldict.h b/reactos/lib/3rdparty/freetype/include/freetype/internal/services/svgldict.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/internal/services/svgldict.h rename to reactos/lib/3rdparty/freetype/include/freetype/internal/services/svgldict.h diff --git a/reactos/lib/3rdparty/freetype/include/internal/services/svgxval.h b/reactos/lib/3rdparty/freetype/include/freetype/internal/services/svgxval.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/internal/services/svgxval.h rename to reactos/lib/3rdparty/freetype/include/freetype/internal/services/svgxval.h diff --git a/reactos/lib/3rdparty/freetype/include/internal/services/svkern.h b/reactos/lib/3rdparty/freetype/include/freetype/internal/services/svkern.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/internal/services/svkern.h rename to reactos/lib/3rdparty/freetype/include/freetype/internal/services/svkern.h diff --git a/reactos/lib/3rdparty/freetype/include/internal/services/svmm.h b/reactos/lib/3rdparty/freetype/include/freetype/internal/services/svmm.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/internal/services/svmm.h rename to reactos/lib/3rdparty/freetype/include/freetype/internal/services/svmm.h diff --git a/reactos/lib/3rdparty/freetype/include/internal/services/svotval.h b/reactos/lib/3rdparty/freetype/include/freetype/internal/services/svotval.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/internal/services/svotval.h rename to reactos/lib/3rdparty/freetype/include/freetype/internal/services/svotval.h diff --git a/reactos/lib/3rdparty/freetype/include/internal/services/svpfr.h b/reactos/lib/3rdparty/freetype/include/freetype/internal/services/svpfr.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/internal/services/svpfr.h rename to reactos/lib/3rdparty/freetype/include/freetype/internal/services/svpfr.h diff --git a/reactos/lib/3rdparty/freetype/include/internal/services/svpostnm.h b/reactos/lib/3rdparty/freetype/include/freetype/internal/services/svpostnm.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/internal/services/svpostnm.h rename to reactos/lib/3rdparty/freetype/include/freetype/internal/services/svpostnm.h diff --git a/reactos/lib/3rdparty/freetype/include/internal/services/svprop.h b/reactos/lib/3rdparty/freetype/include/freetype/internal/services/svprop.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/internal/services/svprop.h rename to reactos/lib/3rdparty/freetype/include/freetype/internal/services/svprop.h diff --git a/reactos/lib/3rdparty/freetype/include/internal/services/svpscmap.h b/reactos/lib/3rdparty/freetype/include/freetype/internal/services/svpscmap.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/internal/services/svpscmap.h rename to reactos/lib/3rdparty/freetype/include/freetype/internal/services/svpscmap.h diff --git a/reactos/lib/3rdparty/freetype/include/internal/services/svpsinfo.h b/reactos/lib/3rdparty/freetype/include/freetype/internal/services/svpsinfo.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/internal/services/svpsinfo.h rename to reactos/lib/3rdparty/freetype/include/freetype/internal/services/svpsinfo.h diff --git a/reactos/lib/3rdparty/freetype/include/internal/services/svsfnt.h b/reactos/lib/3rdparty/freetype/include/freetype/internal/services/svsfnt.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/internal/services/svsfnt.h rename to reactos/lib/3rdparty/freetype/include/freetype/internal/services/svsfnt.h diff --git a/reactos/lib/3rdparty/freetype/include/internal/services/svttcmap.h b/reactos/lib/3rdparty/freetype/include/freetype/internal/services/svttcmap.h similarity index 95% rename from reactos/lib/3rdparty/freetype/include/internal/services/svttcmap.h rename to reactos/lib/3rdparty/freetype/include/freetype/internal/services/svttcmap.h index 4351a9ae05b..cd95b9ab81f 100644 --- a/reactos/lib/3rdparty/freetype/include/internal/services/svttcmap.h +++ b/reactos/lib/3rdparty/freetype/include/freetype/internal/services/svttcmap.h @@ -48,11 +48,12 @@ FT_BEGIN_HEADER /* `ttnameid.h'. */ /* */ /* format :: */ - /* The cmap format. OpenType 1.5 defines the formats 0 (byte */ + /* The cmap format. OpenType 1.6 defines the formats 0 (byte */ /* encoding table), 2~(high-byte mapping through table), 4~(segment */ /* mapping to delta values), 6~(trimmed table mapping), 8~(mixed */ /* 16-bit and 32-bit coverage), 10~(trimmed array), 12~(segmented */ - /* coverage), and 14 (Unicode Variation Sequences). */ + /* coverage), 13~(last resort font), and 14 (Unicode Variation */ + /* Sequences). */ /* */ typedef struct TT_CMapInfo_ { diff --git a/reactos/lib/3rdparty/freetype/include/internal/services/svtteng.h b/reactos/lib/3rdparty/freetype/include/freetype/internal/services/svtteng.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/internal/services/svtteng.h rename to reactos/lib/3rdparty/freetype/include/freetype/internal/services/svtteng.h diff --git a/reactos/lib/3rdparty/freetype/include/internal/services/svttglyf.h b/reactos/lib/3rdparty/freetype/include/freetype/internal/services/svttglyf.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/internal/services/svttglyf.h rename to reactos/lib/3rdparty/freetype/include/freetype/internal/services/svttglyf.h diff --git a/reactos/lib/3rdparty/freetype/include/internal/services/svwinfnt.h b/reactos/lib/3rdparty/freetype/include/freetype/internal/services/svwinfnt.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/internal/services/svwinfnt.h rename to reactos/lib/3rdparty/freetype/include/freetype/internal/services/svwinfnt.h diff --git a/reactos/lib/3rdparty/freetype/include/internal/sfnt.h b/reactos/lib/3rdparty/freetype/include/freetype/internal/sfnt.h similarity index 94% rename from reactos/lib/3rdparty/freetype/include/internal/sfnt.h rename to reactos/lib/3rdparty/freetype/include/freetype/internal/sfnt.h index 97ce390c356..30f53bf09ce 100644 --- a/reactos/lib/3rdparty/freetype/include/internal/sfnt.h +++ b/reactos/lib/3rdparty/freetype/include/freetype/internal/sfnt.h @@ -44,7 +44,9 @@ FT_BEGIN_HEADER /* face :: A handle to the target face object. */ /* */ /* face_index :: The index of the TrueType font, if we are opening a */ - /* collection. */ + /* collection, in bits 0-15. The numbered instance */ + /* index~+~1 of a GX (sub)font, if applicable, in bits */ + /* 16-30. */ /* */ /* num_params :: The number of additional parameters. */ /* */ @@ -87,7 +89,9 @@ FT_BEGIN_HEADER /* face :: A handle to the target face object. */ /* */ /* face_index :: The index of the TrueType font, if we are opening a */ - /* collection. */ + /* collection, in bits 0-15. The numbered instance */ + /* index~+~1 of a GX (sub)font, if applicable, in bits */ + /* 16-30. */ /* */ /* num_params :: The number of additional parameters. */ /* */ @@ -424,6 +428,33 @@ FT_BEGIN_HEADER FT_UShort* aadvance ); + /*************************************************************************/ + /* */ + /* <FuncType> */ + /* TT_Get_Name_Func */ + /* */ + /* <Description> */ + /* From the `name' table, return a given ENGLISH name record in */ + /* ASCII. */ + /* */ + /* <Input> */ + /* face :: A handle to the source face object. */ + /* */ + /* nameid :: The name id of the name record to return. */ + /* */ + /* <InOut> */ + /* name :: The address of an allocated string pointer. NULL if */ + /* no name is present. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + typedef FT_Error + (*TT_Get_Name_Func)( TT_Face face, + FT_UShort nameid, + FT_String** name ); + + /*************************************************************************/ /* */ /* <FuncType> */ @@ -556,6 +587,8 @@ FT_BEGIN_HEADER TT_Get_Metrics_Func get_metrics; + TT_Get_Name_Func get_name; + } SFNT_Interface; @@ -594,7 +627,8 @@ FT_BEGIN_HEADER free_eblc_, \ set_sbit_strike_, \ load_strike_metrics_, \ - get_metrics_ ) \ + get_metrics_, \ + get_name_ ) \ static const SFNT_Interface class_ = \ { \ goto_table_, \ @@ -626,6 +660,7 @@ FT_BEGIN_HEADER set_sbit_strike_, \ load_strike_metrics_, \ get_metrics_, \ + get_name_, \ }; #else /* FT_CONFIG_OPTION_PIC */ @@ -663,7 +698,8 @@ FT_BEGIN_HEADER free_eblc_, \ set_sbit_strike_, \ load_strike_metrics_, \ - get_metrics_ ) \ + get_metrics_, \ + get_name_ ) \ void \ FT_Init_Class_ ## class_( FT_Library library, \ SFNT_Interface* clazz ) \ @@ -699,6 +735,7 @@ FT_BEGIN_HEADER clazz->set_sbit_strike = set_sbit_strike_; \ clazz->load_strike_metrics = load_strike_metrics_; \ clazz->get_metrics = get_metrics_; \ + clazz->get_name = get_name_; \ } #endif /* FT_CONFIG_OPTION_PIC */ diff --git a/reactos/lib/3rdparty/freetype/include/internal/t1types.h b/reactos/lib/3rdparty/freetype/include/freetype/internal/t1types.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/internal/t1types.h rename to reactos/lib/3rdparty/freetype/include/freetype/internal/t1types.h diff --git a/reactos/lib/3rdparty/freetype/include/internal/tttypes.h b/reactos/lib/3rdparty/freetype/include/freetype/internal/tttypes.h similarity index 99% rename from reactos/lib/3rdparty/freetype/include/internal/tttypes.h rename to reactos/lib/3rdparty/freetype/include/freetype/internal/tttypes.h index 31dd0aac699..1507a7c57a0 100644 --- a/reactos/lib/3rdparty/freetype/include/internal/tttypes.h +++ b/reactos/lib/3rdparty/freetype/include/freetype/internal/tttypes.h @@ -1457,11 +1457,23 @@ FT_BEGIN_HEADER /* handle to execution context */ typedef struct TT_ExecContextRec_* TT_ExecContext; + + /*************************************************************************/ + /* */ + /* <Type> */ + /* TT_Size */ + /* */ + /* <Description> */ + /* A handle to a TrueType size object. */ + /* */ + typedef struct TT_SizeRec_* TT_Size; + + /* glyph loader structure */ typedef struct TT_LoaderRec_ { - FT_Face face; - FT_Size size; + TT_Face face; + TT_Size size; FT_GlyphSlot glyph; FT_GlyphLoader gloader; diff --git a/reactos/lib/3rdparty/freetype/include/t1tables.h b/reactos/lib/3rdparty/freetype/include/freetype/t1tables.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/t1tables.h rename to reactos/lib/3rdparty/freetype/include/freetype/t1tables.h diff --git a/reactos/lib/3rdparty/freetype/include/ttnameid.h b/reactos/lib/3rdparty/freetype/include/freetype/ttnameid.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/ttnameid.h rename to reactos/lib/3rdparty/freetype/include/freetype/ttnameid.h diff --git a/reactos/lib/3rdparty/freetype/include/tttables.h b/reactos/lib/3rdparty/freetype/include/freetype/tttables.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/tttables.h rename to reactos/lib/3rdparty/freetype/include/freetype/tttables.h diff --git a/reactos/lib/3rdparty/freetype/include/tttags.h b/reactos/lib/3rdparty/freetype/include/freetype/tttags.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/tttags.h rename to reactos/lib/3rdparty/freetype/include/freetype/tttags.h diff --git a/reactos/lib/3rdparty/freetype/include/ttunpat.h b/reactos/lib/3rdparty/freetype/include/freetype/ttunpat.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/ttunpat.h rename to reactos/lib/3rdparty/freetype/include/freetype/ttunpat.h diff --git a/reactos/lib/3rdparty/freetype/include/ft2build.h b/reactos/lib/3rdparty/freetype/include/ft2build.h index 09c19d42a76..419b80ae44d 100644 --- a/reactos/lib/3rdparty/freetype/include/ft2build.h +++ b/reactos/lib/3rdparty/freetype/include/ft2build.h @@ -34,7 +34,7 @@ #ifndef __FT2BUILD_H__ #define __FT2BUILD_H__ -#include <config/ftheader.h> +#include <freetype/config/ftheader.h> #endif /* __FT2BUILD_H__ */ diff --git a/reactos/lib/3rdparty/freetype/modules.cfg b/reactos/lib/3rdparty/freetype/modules.cfg index 9ba66dfc81f..2984e512442 100644 --- a/reactos/lib/3rdparty/freetype/modules.cfg +++ b/reactos/lib/3rdparty/freetype/modules.cfg @@ -19,7 +19,7 @@ # activate a module, remove the comment character. # # Note that many modules and components are further controlled with macros -# in the file `include/config/ftoption.h'. +# in the file `include/freetype/config/ftoption.h'. #### @@ -85,7 +85,7 @@ HINTING_MODULES += autofit HINTING_MODULES += pshinter # The TrueType hinting engine doesn't have a module of its own but is -# controlled in file include/config/ftoption.h +# controlled in file include/freetype/config/ftoption.h # (TT_CONFIG_OPTION_BYTECODE_INTERPRETER and friends). @@ -106,7 +106,7 @@ RASTER_MODULES += smooth # FreeType's cache sub-system (quite stable but still in beta -- this means # that its public API is subject to change if necessary). See -# include/ftcache.h. Needs ftglyph.c. +# include/freetype/ftcache.h. Needs ftglyph.c. AUX_MODULES += cache # TrueType GX/AAT table validation. Needs ftgxval.c below. @@ -114,17 +114,17 @@ AUX_MODULES += cache # Support for streams compressed with gzip (files with suffix .gz). # -# See include/ftgzip.h for the API. +# See include/freetype/ftgzip.h for the API. AUX_MODULES += gzip # Support for streams compressed with LZW (files with suffix .Z). # -# See include/ftlzw.h for the API. +# See include/freetype/ftlzw.h for the API. AUX_MODULES += lzw # Support for streams compressed with bzip2 (files with suffix .bz2). # -# See include/ftbzip2.h for the API. +# See include/freetype/ftbzip2.h for the API. AUX_MODULES += bzip2 # OpenType table validation. Needs ftotval.c below. @@ -149,95 +149,95 @@ AUX_MODULES += psnames # Exact bounding box calculation. # -# See include/ftbbox.h for the API. +# See include/freetype/ftbbox.h for the API. BASE_EXTENSIONS += ftbbox.c # Access BDF-specific strings. Needs BDF font driver. # -# See include/ftbdf.h for the API. +# See include/freetype/ftbdf.h for the API. BASE_EXTENSIONS += ftbdf.c # Utility functions for converting 1bpp, 2bpp, 4bpp, and 8bpp bitmaps into # 8bpp format, and for emboldening of bitmap glyphs. # -# See include/ftbitmap.h for the API. +# See include/freetype/ftbitmap.h for the API. BASE_EXTENSIONS += ftbitmap.c # Access CID font information. # -# See include/ftcid.h for the API. +# See include/freetype/ftcid.h for the API. BASE_EXTENSIONS += ftcid.c # Support functions for font formats. # -# See include/ftfntfmt.h for the API. +# See include/freetype/ftfntfmt.h for the API. BASE_EXTENSIONS += ftfntfmt.c # Access FSType information. Needs fttype1.c. # -# See include/freetype.h for the API. +# See include/freetype/freetype.h for the API. BASE_EXTENSIONS += ftfstype.c # Support for GASP table queries. # -# See include/ftgasp.h for the API. +# See include/freetype/ftgasp.h for the API. BASE_EXTENSIONS += ftgasp.c # Convenience functions to handle glyphs. Needs ftbitmap.c. # -# See include/ftglyph.h for the API. +# See include/freetype/ftglyph.h for the API. BASE_EXTENSIONS += ftglyph.c # Interface for gxvalid module. # -# See include/ftgxval.h for the API. +# See include/freetype/ftgxval.h for the API. BASE_EXTENSIONS += ftgxval.c # Support for LCD color filtering of subpixel bitmaps. # -# See include/ftlcdfil.h for the API. +# See include/freetype/ftlcdfil.h for the API. BASE_EXTENSIONS += ftlcdfil.c # Multiple Master font interface. # -# See include/ftmm.h for the API. +# See include/freetype/ftmm.h for the API. BASE_EXTENSIONS += ftmm.c # Interface for otvalid module. # -# See include/ftotval.h for the API. +# See include/freetype/ftotval.h for the API. BASE_EXTENSIONS += ftotval.c # Support for FT_Face_CheckTrueTypePatents. # -# See include/freetype.h for the API. +# See include/freetype/freetype.h for the API. BASE_EXTENSIONS += ftpatent.c # Interface for accessing PFR-specific data. Needs PFR font driver. # -# See include/ftpfr.h for the API. +# See include/freetype/ftpfr.h for the API. BASE_EXTENSIONS += ftpfr.c # Path stroker. Needs ftglyph.c. # -# See include/ftstroke.h for the API. +# See include/freetype/ftstroke.h for the API. BASE_EXTENSIONS += ftstroke.c # Support for synthetic embolding and slanting of fonts. Needs ftbitmap.c. # -# See include/ftsynth.h for the API. +# See include/freetype/ftsynth.h for the API. BASE_EXTENSIONS += ftsynth.c # Interface to access data specific to PostScript Type 1 and Type 2 (CFF) # fonts. # -# See include/t1tables.h for the API. +# See include/freetype/t1tables.h for the API. BASE_EXTENSIONS += fttype1.c # Interface for accessing data specific to Windows FNT files. Needs winfnt # driver. # -# See include/ftwinfnt.h for the API. +# See include/freetype/ftwinfnt.h for the API. BASE_EXTENSIONS += ftwinfnt.c #### diff --git a/reactos/lib/3rdparty/freetype/src/autofit/afblue.c b/reactos/lib/3rdparty/freetype/src/autofit/afblue.c index e2b24519a53..b871e0c651e 100644 --- a/reactos/lib/3rdparty/freetype/src/autofit/afblue.c +++ b/reactos/lib/3rdparty/freetype/src/autofit/afblue.c @@ -30,6 +30,8 @@ '\0', '\xD8', '\xAA', '\xD8', '\xAB', '\xD8', '\xB7', '\xD8', '\xB8', '\xD9', '\x83', /* ت Ø« Ø· ظ Ùƒ */ '\0', + '\xD9', '\x80', /* Ù€ */ + '\0', '\xD0', '\x91', '\xD0', '\x92', '\xD0', '\x95', '\xD0', '\x9F', '\xD0', '\x97', '\xD0', '\x9E', '\xD0', '\xA1', '\xD0', '\xAD', /* БВЕПЗОСЭ */ '\0', '\xD0', '\x91', '\xD0', '\x92', '\xD0', '\x95', '\xD0', '\xA8', '\xD0', '\x97', '\xD0', '\x9E', '\xD0', '\xA1', '\xD0', '\xAD', /* БВЕШЗОСЭ */ @@ -62,6 +64,16 @@ '\0', '\xD7', '\xA7', '\xD7', '\x9A', '\xD7', '\x9F', '\xD7', '\xA3', '\xD7', '\xA5', /* קךןףץ */ '\0', + '\xE0', '\xBA', '\xB2', '\xE0', '\xBA', '\x94', '\xE0', '\xBA', '\xAD', '\xE0', '\xBA', '\xA1', '\xE0', '\xBA', '\xA5', '\xE0', '\xBA', '\xA7', '\xE0', '\xBA', '\xA3', '\xE0', '\xBA', '\x87', /* າ ດ ອ ມ ລ ວ ຣ ງ */ + '\0', + '\xE0', '\xBA', '\xB2', '\xE0', '\xBA', '\xAD', '\xE0', '\xBA', '\x9A', '\xE0', '\xBA', '\x8D', '\xE0', '\xBA', '\xA3', '\xE0', '\xBA', '\xAE', '\xE0', '\xBA', '\xA7', '\xE0', '\xBA', '\xA2', /* າ ອ ບ ຠຣ ຮ ວ ຢ */ + '\0', + '\xE0', '\xBA', '\x9B', '\xE0', '\xBA', '\xA2', '\xE0', '\xBA', '\x9F', '\xE0', '\xBA', '\x9D', /* ປ ຢ ຟ ຠ*/ + '\0', + '\xE0', '\xBB', '\x82', '\xE0', '\xBB', '\x84', '\xE0', '\xBB', '\x83', /* ໂ ໄ ໃ */ + '\0', + '\xE0', '\xBA', '\x87', '\xE0', '\xBA', '\x8A', '\xE0', '\xBA', '\x96', '\xE0', '\xBA', '\xBD', '\xE0', '\xBB', '\x86', '\xE0', '\xBA', '\xAF', /* ງ ຊ ຖ ຽ ໆ ຯ */ + '\0', 'T', 'H', 'E', 'Z', 'O', 'C', 'Q', 'S', /* THEZOCQS */ '\0', 'H', 'E', 'Z', 'L', 'O', 'C', 'U', 'S', /* HEZLOCUS */ @@ -72,6 +84,26 @@ '\0', 'p', 'q', 'g', 'j', 'y', /* pqgjy */ '\0', + '\xE2', '\x82', '\x80', '\xE2', '\x82', '\x83', '\xE2', '\x82', '\x85', '\xE2', '\x82', '\x87', '\xE2', '\x82', '\x88', /* ₀₃₅₇₈ */ + '\0', + '\xE2', '\x82', '\x80', '\xE2', '\x82', '\x81', '\xE2', '\x82', '\x82', '\xE2', '\x82', '\x83', '\xE2', '\x82', '\x88', /* â‚€â‚₂₃₈ */ + '\0', + '\xE1', '\xB5', '\xA2', '\xE2', '\xB1', '\xBC', '\xE2', '\x82', '\x95', '\xE2', '\x82', '\x96', '\xE2', '\x82', '\x97', /* ᵢⱼₕₖₗ */ + '\0', + '\xE2', '\x82', '\x90', '\xE2', '\x82', '\x91', '\xE2', '\x82', '\x92', '\xE2', '\x82', '\x93', '\xE2', '\x82', '\x99', '\xE2', '\x82', '\x9B', '\xE1', '\xB5', '\xA5', '\xE1', '\xB5', '\xA4', '\xE1', '\xB5', '\xA3', /* â‚ₑₒₓₙₛᵥᵤᵣ */ + '\0', + '\xE1', '\xB5', '\xA6', '\xE1', '\xB5', '\xA7', '\xE1', '\xB5', '\xA8', '\xE1', '\xB5', '\xA9', '\xE2', '\x82', '\x9A', /* ᵦᵧᵨᵩₚ */ + '\0', + '\xE2', '\x81', '\xB0', '\xC2', '\xB3', '\xE2', '\x81', '\xB5', '\xE2', '\x81', '\xB7', '\xE1', '\xB5', '\x80', '\xE1', '\xB4', '\xB4', '\xE1', '\xB4', '\xB1', '\xE1', '\xB4', '\xBC', /* â°Â³âµâ·áµ€á´´á´±á´¼ */ + '\0', + '\xE2', '\x81', '\xB0', '\xC2', '\xB9', '\xC2', '\xB2', '\xC2', '\xB3', '\xE1', '\xB4', '\xB1', '\xE1', '\xB4', '\xB8', '\xE1', '\xB4', '\xBC', '\xE1', '\xB5', '\x81', /* â°Â¹Â²Â³á´±á´¸á´¼áµ */ + '\0', + '\xE1', '\xB5', '\x87', '\xE1', '\xB5', '\x88', '\xE1', '\xB5', '\x8F', '\xCA', '\xB0', '\xCA', '\xB2', '\xE1', '\xB6', '\xA0', '\xE2', '\x81', '\xB1', /* ᵇᵈáµÊ°Ê²á¶ â± */ + '\0', + '\xE1', '\xB5', '\x89', '\xE1', '\xB5', '\x92', '\xCA', '\xB3', '\xCB', '\xA2', '\xCB', '\xA3', '\xE1', '\xB6', '\x9C', '\xE1', '\xB6', '\xBB', /* ᵉᵒʳˢˣᶜᶻ */ + '\0', + '\xE1', '\xB5', '\x96', '\xCA', '\xB8', '\xE1', '\xB5', '\x8D', /* ᵖʸᵠ*/ + '\0', '\xE0', '\xB0', '\x87', '\xE0', '\xB0', '\x8C', '\xE0', '\xB0', '\x99', '\xE0', '\xB0', '\x9E', '\xE0', '\xB0', '\xA3', '\xE0', '\xB0', '\xB1', '\xE0', '\xB1', '\xAF', /* à°‡ à°Œ à°™ à°ž à°£ à°± ౯ */ '\0', '\xE0', '\xB0', '\x85', '\xE0', '\xB0', '\x95', '\xE0', '\xB0', '\x9A', '\xE0', '\xB0', '\xB0', '\xE0', '\xB0', '\xBD', '\xE0', '\xB1', '\xA8', '\xE0', '\xB1', '\xAC', /* à°… à°• à°š à°° à°½ ౨ ౬ */ @@ -139,9 +171,10 @@ af_blue_stringsets[] = { /* */ - { AF_BLUE_STRING_ARABIC_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, - { AF_BLUE_STRING_ARABIC_JOIN, 0 }, - { AF_BLUE_STRING_MAX, 0 }, + { AF_BLUE_STRING_ARABIC_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_ARABIC_BOTTOM, 0 }, + { AF_BLUE_STRING_ARABIC_JOIN, AF_BLUE_PROPERTY_LATIN_NEUTRAL }, + { AF_BLUE_STRING_MAX, 0 }, { AF_BLUE_STRING_CYRILLIC_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_CYRILLIC_CAPITAL_BOTTOM, 0 }, { AF_BLUE_STRING_CYRILLIC_SMALL, AF_BLUE_PROPERTY_LATIN_TOP | @@ -170,6 +203,13 @@ { AF_BLUE_STRING_HEBREW_BOTTOM, 0 }, { AF_BLUE_STRING_HEBREW_DESCENDER, 0 }, { AF_BLUE_STRING_MAX, 0 }, + { AF_BLUE_STRING_LAO_TOP, AF_BLUE_PROPERTY_LATIN_TOP | + AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, + { AF_BLUE_STRING_LAO_BOTTOM, 0 }, + { AF_BLUE_STRING_LAO_ASCENDER, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_LAO_LARGE_ASCENDER, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_LAO_DESCENDER, 0 }, + { AF_BLUE_STRING_MAX, 0 }, { AF_BLUE_STRING_LATIN_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_LATIN_CAPITAL_BOTTOM, 0 }, { AF_BLUE_STRING_LATIN_SMALL_F_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, @@ -178,6 +218,22 @@ { AF_BLUE_STRING_LATIN_SMALL, 0 }, { AF_BLUE_STRING_LATIN_SMALL_DESCENDER, 0 }, { AF_BLUE_STRING_MAX, 0 }, + { AF_BLUE_STRING_LATIN_SUBS_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_LATIN_SUBS_CAPITAL_BOTTOM, 0 }, + { AF_BLUE_STRING_LATIN_SUBS_SMALL_F_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_LATIN_SUBS_SMALL, AF_BLUE_PROPERTY_LATIN_TOP | + AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, + { AF_BLUE_STRING_LATIN_SUBS_SMALL, 0 }, + { AF_BLUE_STRING_LATIN_SUBS_SMALL_DESCENDER, 0 }, + { AF_BLUE_STRING_MAX, 0 }, + { AF_BLUE_STRING_LATIN_SUPS_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_LATIN_SUPS_CAPITAL_BOTTOM, 0 }, + { AF_BLUE_STRING_LATIN_SUPS_SMALL_F_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_LATIN_SUPS_SMALL, AF_BLUE_PROPERTY_LATIN_TOP | + AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, + { AF_BLUE_STRING_LATIN_SUPS_SMALL, 0 }, + { AF_BLUE_STRING_LATIN_SUPS_SMALL_DESCENDER, 0 }, + { AF_BLUE_STRING_MAX, 0 }, { AF_BLUE_STRING_TELUGU_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_TELUGU_BOTTOM, 0 }, { AF_BLUE_STRING_MAX, 0 }, diff --git a/reactos/lib/3rdparty/freetype/src/autofit/afblue.dat b/reactos/lib/3rdparty/freetype/src/autofit/afblue.dat index fd5684e4a50..1b52378ed3e 100644 --- a/reactos/lib/3rdparty/freetype/src/autofit/afblue.dat +++ b/reactos/lib/3rdparty/freetype/src/autofit/afblue.dat @@ -69,8 +69,15 @@ AF_BLUE_STRING_ENUM AF_BLUE_STRINGS_ARRAY AF_BLUE_STRING_MAX_LEN: AF_BLUE_STRING_ARABIC_TOP "ا Ø¥ Ù„ Ùƒ Ø· ظ" - AF_BLUE_STRING_ARABIC_JOIN + AF_BLUE_STRING_ARABIC_BOTTOM "ت Ø« Ø· ظ Ùƒ" + // We don't necessarily have access to medial forms via Unicode in case + // Arabic presentational forms are missing. The only character that is + // guaranteed to have the same vertical position with joining (this is, + // non-isolated) forms is U+0640, ARABIC TATWEEL, which must join both + // round and flat curves. + AF_BLUE_STRING_ARABIC_JOIN + "Ù€" AF_BLUE_STRING_CYRILLIC_CAPITAL_TOP "БВЕПЗОСЭ" @@ -113,6 +120,17 @@ AF_BLUE_STRING_ENUM AF_BLUE_STRINGS_ARRAY AF_BLUE_STRING_MAX_LEN: AF_BLUE_STRING_HEBREW_DESCENDER "קךןףץ" + AF_BLUE_STRING_LAO_TOP + "າ ດ ອ ມ ລ ວ ຣ ງ" + AF_BLUE_STRING_LAO_BOTTOM + "າ ອ ບ ຠຣ ຮ ວ ຢ" + AF_BLUE_STRING_LAO_ASCENDER + "ປ ຢ ຟ àº" + AF_BLUE_STRING_LAO_LARGE_ASCENDER + "ໂ ໄ ໃ" + AF_BLUE_STRING_LAO_DESCENDER + "ງ ຊ ຖ ຽ ໆ ຯ" + AF_BLUE_STRING_LATIN_CAPITAL_TOP "THEZOCQS" AF_BLUE_STRING_LATIN_CAPITAL_BOTTOM @@ -124,6 +142,31 @@ AF_BLUE_STRING_ENUM AF_BLUE_STRINGS_ARRAY AF_BLUE_STRING_MAX_LEN: AF_BLUE_STRING_LATIN_SMALL_DESCENDER "pqgjy" + // we assume that both the subscript and superscript ranges + // don't contain oldstyle digits (actually, most fonts probably + // have digits only in those ranges) + AF_BLUE_STRING_LATIN_SUBS_CAPITAL_TOP + "₀₃₅₇₈" + AF_BLUE_STRING_LATIN_SUBS_CAPITAL_BOTTOM + "â‚€â‚₂₃₈" + AF_BLUE_STRING_LATIN_SUBS_SMALL_F_TOP + "ᵢⱼₕₖₗ" + AF_BLUE_STRING_LATIN_SUBS_SMALL + "â‚ₑₒₓₙₛᵥᵤᵣ" + AF_BLUE_STRING_LATIN_SUBS_SMALL_DESCENDER + "ᵦᵧᵨᵩₚ" + + AF_BLUE_STRING_LATIN_SUPS_CAPITAL_TOP + "â°Â³âµâ·áµ€á´´á´±á´¼" + AF_BLUE_STRING_LATIN_SUPS_CAPITAL_BOTTOM + "â°Â¹Â²Â³á´±á´¸á´¼áµ" + AF_BLUE_STRING_LATIN_SUPS_SMALL_F_TOP + "ᵇᵈáµÊ°Ê²á¶ â±" + AF_BLUE_STRING_LATIN_SUPS_SMALL + "ᵉᵒʳˢˣᶜᶻ" + AF_BLUE_STRING_LATIN_SUPS_SMALL_DESCENDER + "ᵖʸáµ" + // we separate the letters with spaces to avoid ligatures; // this is just for convenience to simplify reading AF_BLUE_STRING_TELUGU_TOP @@ -289,9 +332,10 @@ AF_BLUE_STRING_ENUM AF_BLUE_STRINGS_ARRAY AF_BLUE_STRING_MAX_LEN: AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN: AF_BLUE_STRINGSET_ARAB - { AF_BLUE_STRING_ARABIC_TOP, AF_BLUE_PROPERTY_LATIN_TOP } - { AF_BLUE_STRING_ARABIC_JOIN, 0 } - { AF_BLUE_STRING_MAX, 0 } + { AF_BLUE_STRING_ARABIC_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_ARABIC_BOTTOM, 0 } + { AF_BLUE_STRING_ARABIC_JOIN, AF_BLUE_PROPERTY_LATIN_NEUTRAL } + { AF_BLUE_STRING_MAX, 0 } AF_BLUE_STRINGSET_CYRL { AF_BLUE_STRING_CYRILLIC_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP } @@ -329,6 +373,15 @@ AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN: { AF_BLUE_STRING_HEBREW_DESCENDER, 0 } { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_STRINGSET_LAO + { AF_BLUE_STRING_LAO_TOP, AF_BLUE_PROPERTY_LATIN_TOP | + AF_BLUE_PROPERTY_LATIN_X_HEIGHT } + { AF_BLUE_STRING_LAO_BOTTOM, 0 } + { AF_BLUE_STRING_LAO_ASCENDER, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_LAO_LARGE_ASCENDER, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_LAO_DESCENDER, 0 } + { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_STRINGSET_LATN { AF_BLUE_STRING_LATIN_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP } { AF_BLUE_STRING_LATIN_CAPITAL_BOTTOM, 0 } @@ -339,6 +392,26 @@ AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN: { AF_BLUE_STRING_LATIN_SMALL_DESCENDER, 0 } { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_STRINGSET_LATB + { AF_BLUE_STRING_LATIN_SUBS_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_LATIN_SUBS_CAPITAL_BOTTOM, 0 } + { AF_BLUE_STRING_LATIN_SUBS_SMALL_F_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_LATIN_SUBS_SMALL, AF_BLUE_PROPERTY_LATIN_TOP | + AF_BLUE_PROPERTY_LATIN_X_HEIGHT } + { AF_BLUE_STRING_LATIN_SUBS_SMALL, 0 } + { AF_BLUE_STRING_LATIN_SUBS_SMALL_DESCENDER, 0 } + { AF_BLUE_STRING_MAX, 0 } + + AF_BLUE_STRINGSET_LATP + { AF_BLUE_STRING_LATIN_SUPS_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_LATIN_SUPS_CAPITAL_BOTTOM, 0 } + { AF_BLUE_STRING_LATIN_SUPS_SMALL_F_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_LATIN_SUPS_SMALL, AF_BLUE_PROPERTY_LATIN_TOP | + AF_BLUE_PROPERTY_LATIN_X_HEIGHT } + { AF_BLUE_STRING_LATIN_SUPS_SMALL, 0 } + { AF_BLUE_STRING_LATIN_SUPS_SMALL_DESCENDER, 0 } + { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_STRINGSET_TELU { AF_BLUE_STRING_TELUGU_TOP, AF_BLUE_PROPERTY_LATIN_TOP } { AF_BLUE_STRING_TELUGU_BOTTOM, 0 } diff --git a/reactos/lib/3rdparty/freetype/src/autofit/afblue.h b/reactos/lib/3rdparty/freetype/src/autofit/afblue.h index 94e33a9a24b..c26a9c792b0 100644 --- a/reactos/lib/3rdparty/freetype/src/autofit/afblue.h +++ b/reactos/lib/3rdparty/freetype/src/autofit/afblue.h @@ -75,38 +75,54 @@ FT_BEGIN_HEADER typedef enum AF_Blue_String_ { AF_BLUE_STRING_ARABIC_TOP = 0, - AF_BLUE_STRING_ARABIC_JOIN = 13, - AF_BLUE_STRING_CYRILLIC_CAPITAL_TOP = 24, - AF_BLUE_STRING_CYRILLIC_CAPITAL_BOTTOM = 41, - AF_BLUE_STRING_CYRILLIC_SMALL = 58, - AF_BLUE_STRING_CYRILLIC_SMALL_DESCENDER = 75, - AF_BLUE_STRING_DEVANAGARI_BASE = 82, - AF_BLUE_STRING_DEVANAGARI_TOP = 107, - AF_BLUE_STRING_DEVANAGARI_HEAD = 132, - AF_BLUE_STRING_DEVANAGARI_BOTTOM = 157, - AF_BLUE_STRING_GREEK_CAPITAL_TOP = 164, - AF_BLUE_STRING_GREEK_CAPITAL_BOTTOM = 179, - AF_BLUE_STRING_GREEK_SMALL_BETA_TOP = 192, - AF_BLUE_STRING_GREEK_SMALL = 205, - AF_BLUE_STRING_GREEK_SMALL_DESCENDER = 222, - AF_BLUE_STRING_HEBREW_TOP = 239, - AF_BLUE_STRING_HEBREW_BOTTOM = 256, - AF_BLUE_STRING_HEBREW_DESCENDER = 269, - AF_BLUE_STRING_LATIN_CAPITAL_TOP = 280, - AF_BLUE_STRING_LATIN_CAPITAL_BOTTOM = 289, - AF_BLUE_STRING_LATIN_SMALL_F_TOP = 298, - AF_BLUE_STRING_LATIN_SMALL = 306, - AF_BLUE_STRING_LATIN_SMALL_DESCENDER = 314, - AF_BLUE_STRING_TELUGU_TOP = 320, - AF_BLUE_STRING_TELUGU_BOTTOM = 342, - AF_BLUE_STRING_THAI_TOP = 364, - AF_BLUE_STRING_THAI_BOTTOM = 383, - AF_BLUE_STRING_THAI_ASCENDER = 405, - AF_BLUE_STRING_THAI_LARGE_ASCENDER = 415, - AF_BLUE_STRING_THAI_DESCENDER = 425, - AF_BLUE_STRING_THAI_LARGE_DESCENDER = 438, - AF_BLUE_STRING_THAI_DIGIT_TOP = 445, - af_blue_1_1 = 454, + AF_BLUE_STRING_ARABIC_BOTTOM = 13, + AF_BLUE_STRING_ARABIC_JOIN = 24, + AF_BLUE_STRING_CYRILLIC_CAPITAL_TOP = 27, + AF_BLUE_STRING_CYRILLIC_CAPITAL_BOTTOM = 44, + AF_BLUE_STRING_CYRILLIC_SMALL = 61, + AF_BLUE_STRING_CYRILLIC_SMALL_DESCENDER = 78, + AF_BLUE_STRING_DEVANAGARI_BASE = 85, + AF_BLUE_STRING_DEVANAGARI_TOP = 110, + AF_BLUE_STRING_DEVANAGARI_HEAD = 135, + AF_BLUE_STRING_DEVANAGARI_BOTTOM = 160, + AF_BLUE_STRING_GREEK_CAPITAL_TOP = 167, + AF_BLUE_STRING_GREEK_CAPITAL_BOTTOM = 182, + AF_BLUE_STRING_GREEK_SMALL_BETA_TOP = 195, + AF_BLUE_STRING_GREEK_SMALL = 208, + AF_BLUE_STRING_GREEK_SMALL_DESCENDER = 225, + AF_BLUE_STRING_HEBREW_TOP = 242, + AF_BLUE_STRING_HEBREW_BOTTOM = 259, + AF_BLUE_STRING_HEBREW_DESCENDER = 272, + AF_BLUE_STRING_LAO_TOP = 283, + AF_BLUE_STRING_LAO_BOTTOM = 308, + AF_BLUE_STRING_LAO_ASCENDER = 333, + AF_BLUE_STRING_LAO_LARGE_ASCENDER = 346, + AF_BLUE_STRING_LAO_DESCENDER = 356, + AF_BLUE_STRING_LATIN_CAPITAL_TOP = 375, + AF_BLUE_STRING_LATIN_CAPITAL_BOTTOM = 384, + AF_BLUE_STRING_LATIN_SMALL_F_TOP = 393, + AF_BLUE_STRING_LATIN_SMALL = 401, + AF_BLUE_STRING_LATIN_SMALL_DESCENDER = 409, + AF_BLUE_STRING_LATIN_SUBS_CAPITAL_TOP = 415, + AF_BLUE_STRING_LATIN_SUBS_CAPITAL_BOTTOM = 431, + AF_BLUE_STRING_LATIN_SUBS_SMALL_F_TOP = 447, + AF_BLUE_STRING_LATIN_SUBS_SMALL = 463, + AF_BLUE_STRING_LATIN_SUBS_SMALL_DESCENDER = 491, + AF_BLUE_STRING_LATIN_SUPS_CAPITAL_TOP = 507, + AF_BLUE_STRING_LATIN_SUPS_CAPITAL_BOTTOM = 531, + AF_BLUE_STRING_LATIN_SUPS_SMALL_F_TOP = 553, + AF_BLUE_STRING_LATIN_SUPS_SMALL = 573, + AF_BLUE_STRING_LATIN_SUPS_SMALL_DESCENDER = 592, + AF_BLUE_STRING_TELUGU_TOP = 601, + AF_BLUE_STRING_TELUGU_BOTTOM = 623, + AF_BLUE_STRING_THAI_TOP = 645, + AF_BLUE_STRING_THAI_BOTTOM = 664, + AF_BLUE_STRING_THAI_ASCENDER = 686, + AF_BLUE_STRING_THAI_LARGE_ASCENDER = 696, + AF_BLUE_STRING_THAI_DESCENDER = 706, + AF_BLUE_STRING_THAI_LARGE_DESCENDER = 719, + AF_BLUE_STRING_THAI_DIGIT_TOP = 726, + af_blue_1_1 = 735, #ifdef AF_CONFIG_OPTION_CJK AF_BLUE_STRING_CJK_TOP = af_blue_1_1 + 1, AF_BLUE_STRING_CJK_BOTTOM = af_blue_1_1 + 153, @@ -165,14 +181,17 @@ FT_BEGIN_HEADER typedef enum AF_Blue_Stringset_ { AF_BLUE_STRINGSET_ARAB = 0, - AF_BLUE_STRINGSET_CYRL = 3, - AF_BLUE_STRINGSET_DEVA = 9, - AF_BLUE_STRINGSET_GREK = 15, - AF_BLUE_STRINGSET_HEBR = 22, - AF_BLUE_STRINGSET_LATN = 26, - AF_BLUE_STRINGSET_TELU = 33, - AF_BLUE_STRINGSET_THAI = 36, - af_blue_2_1 = 44, + AF_BLUE_STRINGSET_CYRL = 4, + AF_BLUE_STRINGSET_DEVA = 10, + AF_BLUE_STRINGSET_GREK = 16, + AF_BLUE_STRINGSET_HEBR = 23, + AF_BLUE_STRINGSET_LAO = 27, + AF_BLUE_STRINGSET_LATN = 33, + AF_BLUE_STRINGSET_LATB = 40, + AF_BLUE_STRINGSET_LATP = 47, + AF_BLUE_STRINGSET_TELU = 54, + AF_BLUE_STRINGSET_THAI = 57, + af_blue_2_1 = 65, #ifdef AF_CONFIG_OPTION_CJK AF_BLUE_STRINGSET_HANI = af_blue_2_1 + 0, af_blue_2_1_1 = af_blue_2_1 + 2, diff --git a/reactos/lib/3rdparty/freetype/src/autofit/afcjk.c b/reactos/lib/3rdparty/freetype/src/autofit/afcjk.c index bf7376282e1..69b93bccbdd 100644 --- a/reactos/lib/3rdparty/freetype/src/autofit/afcjk.c +++ b/reactos/lib/3rdparty/freetype/src/autofit/afcjk.c @@ -2196,7 +2196,8 @@ /* Apply the complete hinting algorithm to a CJK glyph. */ FT_LOCAL_DEF( FT_Error ) - af_cjk_hints_apply( AF_GlyphHints hints, + af_cjk_hints_apply( FT_UInt glyph_index, + AF_GlyphHints hints, FT_Outline* outline, AF_CJKMetrics metrics ) { @@ -2204,6 +2205,7 @@ int dim; FT_UNUSED( metrics ); + FT_UNUSED( glyph_index ); error = af_glyph_hints_reload( hints, outline ); diff --git a/reactos/lib/3rdparty/freetype/src/autofit/afcjk.h b/reactos/lib/3rdparty/freetype/src/autofit/afcjk.h index bfd11f2d3d8..e395e74a012 100644 --- a/reactos/lib/3rdparty/freetype/src/autofit/afcjk.h +++ b/reactos/lib/3rdparty/freetype/src/autofit/afcjk.h @@ -115,7 +115,8 @@ FT_BEGIN_HEADER AF_CJKMetrics metrics ); FT_LOCAL( FT_Error ) - af_cjk_hints_apply( AF_GlyphHints hints, + af_cjk_hints_apply( FT_UInt glyph_index, + AF_GlyphHints hints, FT_Outline* outline, AF_CJKMetrics metrics ); diff --git a/reactos/lib/3rdparty/freetype/src/autofit/afdummy.c b/reactos/lib/3rdparty/freetype/src/autofit/afdummy.c index 03ca25f33f3..18dd301d101 100644 --- a/reactos/lib/3rdparty/freetype/src/autofit/afdummy.c +++ b/reactos/lib/3rdparty/freetype/src/autofit/afdummy.c @@ -38,11 +38,14 @@ static FT_Error - af_dummy_hints_apply( AF_GlyphHints hints, + af_dummy_hints_apply( FT_UInt glyph_index, + AF_GlyphHints hints, FT_Outline* outline ) { FT_Error error; + FT_UNUSED( glyph_index ); + error = af_glyph_hints_reload( hints, outline ); if ( !error ) diff --git a/reactos/lib/3rdparty/freetype/src/autofit/afglobal.c b/reactos/lib/3rdparty/freetype/src/autofit/afglobal.c index 64b92931349..b071cc76fb3 100644 --- a/reactos/lib/3rdparty/freetype/src/autofit/afglobal.c +++ b/reactos/lib/3rdparty/freetype/src/autofit/afglobal.c @@ -47,6 +47,7 @@ af_ ## s ## _script_class, \ AF_SCRIPT_ ## S, \ af_ ## s ## _uniranges, \ + af_ ## s ## _nonbase_uniranges, \ sc1, sc2, sc3 ) #include "afscript.h" @@ -135,16 +136,15 @@ FT_Error error; FT_Face face = globals->face; FT_CharMap old_charmap = face->charmap; - FT_Byte* gstyles = globals->glyph_styles; + FT_UShort* gstyles = globals->glyph_styles; FT_UInt ss; FT_UInt i; FT_UInt dflt = ~0U; /* a non-valid value */ /* the value AF_STYLE_UNASSIGNED means `uncovered glyph' */ - FT_MEM_SET( globals->glyph_styles, - AF_STYLE_UNASSIGNED, - globals->glyph_count ); + for ( i = 0; i < (FT_UInt)globals->glyph_count; i++ ) + gstyles[i] = AF_STYLE_UNASSIGNED; error = FT_Select_Charmap( face, FT_ENCODING_UNICODE ); if ( error ) @@ -190,10 +190,10 @@ gindex = FT_Get_Char_Index( face, charcode ); - if ( gindex != 0 && - gindex < (FT_ULong)globals->glyph_count && - gstyles[gindex] == AF_STYLE_UNASSIGNED ) - gstyles[gindex] = (FT_Byte)ss; + if ( gindex != 0 && + gindex < (FT_ULong)globals->glyph_count && + ( gstyles[gindex] & AF_STYLE_MASK ) == AF_STYLE_UNASSIGNED ) + gstyles[gindex] = (FT_UShort)ss; for (;;) { @@ -202,9 +202,38 @@ if ( gindex == 0 || charcode > range->last ) break; - if ( gindex < (FT_ULong)globals->glyph_count && - gstyles[gindex] == AF_STYLE_UNASSIGNED ) - gstyles[gindex] = (FT_Byte)ss; + if ( gindex < (FT_ULong)globals->glyph_count && + ( gstyles[gindex] & AF_STYLE_MASK ) == AF_STYLE_UNASSIGNED ) + gstyles[gindex] = (FT_UShort)ss; + } + } + + /* do the same for the script's non-base characters */ + for ( range = script_class->script_uni_nonbase_ranges; + range->first != 0; + range++ ) + { + FT_ULong charcode = range->first; + FT_UInt gindex; + + + gindex = FT_Get_Char_Index( face, charcode ); + + if ( gindex != 0 && + gindex < (FT_ULong)globals->glyph_count && + ( gstyles[gindex] & AF_STYLE_MASK ) == (FT_UShort)ss ) + gstyles[gindex] |= AF_NONBASE; + + for (;;) + { + charcode = FT_Get_Next_Char( face, charcode, &gindex ); + + if ( gindex == 0 || charcode > range->last ) + break; + + if ( gindex < (FT_ULong)globals->glyph_count && + ( gstyles[gindex] & AF_STYLE_MASK ) == (FT_UShort)ss ) + gstyles[gindex] |= AF_NONBASE; } } } @@ -250,9 +279,9 @@ for ( nn = 0; nn < globals->glyph_count; nn++ ) { - if ( ( gstyles[nn] & ~AF_DIGIT ) == AF_STYLE_UNASSIGNED ) + if ( ( gstyles[nn] & AF_STYLE_MASK ) == AF_STYLE_UNASSIGNED ) { - gstyles[nn] &= ~AF_STYLE_UNASSIGNED; + gstyles[nn] &= ~AF_STYLE_MASK; gstyles[nn] |= globals->module->fallback_style; } } @@ -276,7 +305,7 @@ for ( idx = 0; idx < globals->glyph_count; idx++ ) { - if ( ( gstyles[idx] & ~AF_DIGIT ) == style_class->style ) + if ( ( gstyles[idx] & AF_STYLE_MASK ) == style_class->style ) { if ( !( count % 10 ) ) FT_TRACE4(( " " )); @@ -314,14 +343,17 @@ memory = face->memory; + /* we allocate an AF_FaceGlobals structure together */ + /* with the glyph_styles array */ if ( FT_ALLOC( globals, sizeof ( *globals ) + - (FT_ULong)face->num_glyphs * sizeof ( FT_Byte ) ) ) + (FT_ULong)face->num_glyphs * sizeof ( FT_UShort ) ) ) goto Exit; globals->face = face; globals->glyph_count = face->num_glyphs; - globals->glyph_styles = (FT_Byte*)( globals + 1 ); + /* right after the globals structure come the glyph styles */ + globals->glyph_styles = (FT_UShort*)( globals + 1 ); globals->module = module; #ifdef FT_CONFIG_OPTION_USE_HARFBUZZ diff --git a/reactos/lib/3rdparty/freetype/src/autofit/afglobal.h b/reactos/lib/3rdparty/freetype/src/autofit/afglobal.h index 9bbb687e2d9..ffb2f860668 100644 --- a/reactos/lib/3rdparty/freetype/src/autofit/afglobal.h +++ b/reactos/lib/3rdparty/freetype/src/autofit/afglobal.h @@ -72,10 +72,16 @@ FT_BEGIN_HEADER #endif /* default script for OpenType; ignored if HarfBuzz isn't used */ #define AF_SCRIPT_DEFAULT AF_SCRIPT_LATN - /* a bit mask indicating an uncovered glyph */ -#define AF_STYLE_UNASSIGNED 0x7F - /* if this flag is set, we have an ASCII digit */ -#define AF_DIGIT 0x80 + + /* a bit mask for AF_DIGIT and AF_NONBASE */ +#define AF_STYLE_MASK 0x3FFF + /* an uncovered glyph */ +#define AF_STYLE_UNASSIGNED AF_STYLE_MASK + + /* if this flag is set, we have an ASCII digit */ +#define AF_DIGIT 0x8000U + /* if this flag is set, we have a non-base character */ +#define AF_NONBASE 0x4000U /* `increase-x-height' property */ #define AF_PROP_INCREASE_X_HEIGHT_MIN 6 @@ -100,7 +106,7 @@ FT_BEGIN_HEADER { FT_Face face; FT_Long glyph_count; /* same as face->num_glyphs */ - FT_Byte* glyph_styles; + FT_UShort* glyph_styles; #ifdef FT_CONFIG_OPTION_USE_HARFBUZZ hb_font_t* hb_font; diff --git a/reactos/lib/3rdparty/freetype/src/autofit/afindic.c b/reactos/lib/3rdparty/freetype/src/autofit/afindic.c index 7412cd1e3de..05b6bdd8876 100644 --- a/reactos/lib/3rdparty/freetype/src/autofit/afindic.c +++ b/reactos/lib/3rdparty/freetype/src/autofit/afindic.c @@ -79,12 +79,13 @@ static FT_Error - af_indic_hints_apply( AF_GlyphHints hints, + af_indic_hints_apply( FT_UInt glyph_index, + AF_GlyphHints hints, FT_Outline* outline, AF_CJKMetrics metrics ) { /* use CJK routines */ - return af_cjk_hints_apply( hints, outline, metrics ); + return af_cjk_hints_apply( glyph_index, hints, outline, metrics ); } diff --git a/reactos/lib/3rdparty/freetype/src/autofit/aflatin.c b/reactos/lib/3rdparty/freetype/src/autofit/aflatin.c index b42d3d0bda0..25c2aee49e8 100644 --- a/reactos/lib/3rdparty/freetype/src/autofit/aflatin.c +++ b/reactos/lib/3rdparty/freetype/src/autofit/aflatin.c @@ -41,6 +41,10 @@ #define FT_COMPONENT trace_aflatin + /* needed for computation of round vs. flat segments */ +#define FLAT_THRESHOLD( x ) ( x / 14 ) + + /*************************************************************************/ /*************************************************************************/ /***** *****/ @@ -290,6 +294,8 @@ AF_Blue_Stringset bss = sc->blue_stringset; const AF_Blue_StringRec* bs = &af_blue_stringsets[bss]; + FT_Pos flat_threshold = FLAT_THRESHOLD( metrics->units_per_em ); + /* we walk over the blue character strings as specified in the */ /* style's entry in the `af_blue_stringset' array */ @@ -709,16 +715,16 @@ /* now set the `round' flag depending on the segment's kind: */ /* */ /* - if the horizontal distance between the first and last */ - /* `on' point is larger than upem/8 (value 8 is heuristic) */ + /* `on' point is larger than a heuristic threshold */ /* we have a flat segment */ /* - if either the first or the last point of the segment is */ /* an `off' point, the segment is round, otherwise it is */ /* flat */ if ( best_on_point_first >= 0 && best_on_point_last >= 0 && - (FT_UInt)( FT_ABS( points[best_on_point_last].x - - points[best_on_point_first].x ) ) > - metrics->units_per_em / 8 ) + ( FT_ABS( points[best_on_point_last].x - + points[best_on_point_first].x ) ) > + flat_threshold ) round = 0; else round = FT_BOOL( @@ -1048,8 +1054,11 @@ if ( dim == AF_DIMENSION_VERT ) { - FT_TRACE5(( "blue zones (style `%s')\n", - af_style_names[metrics->root.style_class->style] )); +#ifdef FT_DEBUG_LEVEL_TRACE + if ( axis->blue_count ) + FT_TRACE5(( "blue zones (style `%s')\n", + af_style_names[metrics->root.style_class->style] )); +#endif /* scale the blue zones */ for ( nn = 0; nn < axis->blue_count; nn++ ) @@ -1171,14 +1180,17 @@ af_latin_hints_compute_segments( AF_GlyphHints hints, AF_Dimension dim ) { - AF_AxisHints axis = &hints->axis[dim]; - FT_Memory memory = hints->memory; - FT_Error error = FT_Err_Ok; - AF_Segment segment = NULL; - AF_SegmentRec seg0; - AF_Point* contour = hints->contours; - AF_Point* contour_limit = contour + hints->num_contours; - AF_Direction major_dir, segment_dir; + AF_LatinMetrics metrics = (AF_LatinMetrics)hints->metrics; + AF_AxisHints axis = &hints->axis[dim]; + FT_Memory memory = hints->memory; + FT_Error error = FT_Err_Ok; + AF_Segment segment = NULL; + AF_SegmentRec seg0; + AF_Point* contour = hints->contours; + AF_Point* contour_limit = contour + hints->num_contours; + AF_Direction major_dir, segment_dir; + + FT_Pos flat_threshold = FLAT_THRESHOLD( metrics->units_per_em ); FT_ZERO( &seg0 ); @@ -1219,11 +1231,13 @@ /* do each contour separately */ for ( ; contour < contour_limit; contour++ ) { - AF_Point point = contour[0]; - AF_Point last = point->prev; - int on_edge = 0; - FT_Pos min_pos = 32000; /* minimum segment pos != min_coord */ - FT_Pos max_pos = -32000; /* maximum segment pos != max_coord */ + AF_Point point = contour[0]; + AF_Point last = point->prev; + int on_edge = 0; + FT_Pos min_pos = 32000; /* minimum segment pos != min_coord */ + FT_Pos max_pos = -32000; /* maximum segment pos != max_coord */ + FT_Pos min_on_pos = 32000; + FT_Pos max_on_pos = -32000; FT_Bool passed; @@ -1265,6 +1279,16 @@ if ( u > max_pos ) max_pos = u; + /* get minimum and maximum coordinate of on points */ + if ( !( point->flags & AF_FLAG_CONTROL ) ) + { + v = point->v; + if ( v < min_on_pos ) + min_on_pos = v; + if ( v > max_on_pos ) + max_on_pos = v; + } + if ( point->out_dir != segment_dir || point == last ) { /* we are just leaving an edge; record a new segment! */ @@ -1272,9 +1296,10 @@ segment->pos = (FT_Short)( ( min_pos + max_pos ) >> 1 ); /* a segment is round if either its first or last point */ - /* is a control point */ - if ( ( segment->first->flags | point->flags ) & - AF_FLAG_CONTROL ) + /* is a control point, and the length of the on points */ + /* inbetween doesn't exceed a heuristic limit */ + if ( ( segment->first->flags | point->flags ) & AF_FLAG_CONTROL && + ( max_on_pos - min_on_pos ) < flat_threshold ) segment->flags |= AF_EDGE_ROUND; /* compute segment size */ @@ -1317,10 +1342,19 @@ /* clear all segment fields */ segment[0] = seg0; - segment->dir = (FT_Char)segment_dir; + segment->dir = (FT_Char)segment_dir; + segment->first = point; + segment->last = point; + min_pos = max_pos = point->u; - segment->first = point; - segment->last = point; + + if ( point->flags & AF_FLAG_CONTROL ) + { + min_on_pos = 32000; + max_on_pos = -32000; + } + else + min_on_pos = max_on_pos = point->v; on_edge = 1; } @@ -2821,7 +2855,8 @@ /* Apply the complete hinting algorithm to a latin glyph. */ static FT_Error - af_latin_hints_apply( AF_GlyphHints hints, + af_latin_hints_apply( FT_UInt glyph_index, + AF_GlyphHints hints, FT_Outline* outline, AF_LatinMetrics metrics ) { @@ -2863,7 +2898,9 @@ if ( error ) goto Exit; - af_latin_hints_compute_blue_edges( hints, metrics ); + /* apply blue zones to base characters only */ + if ( !( metrics->root.globals->glyph_styles[glyph_index] & AF_NONBASE ) ) + af_latin_hints_compute_blue_edges( hints, metrics ); } /* grid-fit the outline */ diff --git a/reactos/lib/3rdparty/freetype/src/autofit/aflatin2.c b/reactos/lib/3rdparty/freetype/src/autofit/aflatin2.c index ac9f9332588..0380ffc04c1 100644 --- a/reactos/lib/3rdparty/freetype/src/autofit/aflatin2.c +++ b/reactos/lib/3rdparty/freetype/src/autofit/aflatin2.c @@ -2300,13 +2300,16 @@ static FT_Error - af_latin2_hints_apply( AF_GlyphHints hints, + af_latin2_hints_apply( FT_UInt glyph_index, + AF_GlyphHints hints, FT_Outline* outline, AF_LatinMetrics metrics ) { FT_Error error; int dim; + FT_UNUSED( glyph_index ); + error = af_glyph_hints_reload( hints, outline ); if ( error ) diff --git a/reactos/lib/3rdparty/freetype/src/autofit/afloader.c b/reactos/lib/3rdparty/freetype/src/autofit/afloader.c index 7c2fa7cffd7..722ffd31ecd 100644 --- a/reactos/lib/3rdparty/freetype/src/autofit/afloader.c +++ b/reactos/lib/3rdparty/freetype/src/autofit/afloader.c @@ -150,7 +150,8 @@ if ( writing_system_class->style_hints_apply ) - writing_system_class->style_hints_apply( hints, + writing_system_class->style_hints_apply( glyph_index, + hints, &gloader->base.outline, metrics ); } diff --git a/reactos/lib/3rdparty/freetype/src/autofit/afmodule.c b/reactos/lib/3rdparty/freetype/src/autofit/afmodule.c index 4e3e4746d5e..f19a295b9f2 100644 --- a/reactos/lib/3rdparty/freetype/src/autofit/afmodule.c +++ b/reactos/lib/3rdparty/freetype/src/autofit/afmodule.c @@ -25,6 +25,10 @@ #ifdef FT_DEBUG_AUTOFIT #ifndef FT_MAKE_OPTION_SINGLE_OBJECT + +#ifdef __cplusplus + extern "C" { +#endif extern void af_glyph_hints_dump_segments( AF_GlyphHints hints, FT_Bool to_stdout ); @@ -34,6 +38,10 @@ extern void af_glyph_hints_dump_edges( AF_GlyphHints hints, FT_Bool to_stdout ); +#ifdef __cplusplus + } +#endif + #endif int _af_debug_disable_horz_hints; diff --git a/reactos/lib/3rdparty/freetype/src/autofit/afpic.h b/reactos/lib/3rdparty/freetype/src/autofit/afpic.h index 25071e3bc9a..9b45069f5d0 100644 --- a/reactos/lib/3rdparty/freetype/src/autofit/afpic.h +++ b/reactos/lib/3rdparty/freetype/src/autofit/afpic.h @@ -20,8 +20,6 @@ #define __AFPIC_H__ -FT_BEGIN_HEADER - #include FT_INTERNAL_PIC_H @@ -43,6 +41,8 @@ FT_BEGIN_HEADER #include "aftypes.h" +FT_BEGIN_HEADER + typedef struct AFModulePIC_ { FT_ServiceDescRec* af_services; @@ -93,12 +93,12 @@ FT_BEGIN_HEADER FT_Error autofit_module_class_pic_init( FT_Library library ); +FT_END_HEADER + #endif /* FT_CONFIG_OPTION_PIC */ /* */ -FT_END_HEADER - #endif /* __AFPIC_H__ */ diff --git a/reactos/lib/3rdparty/freetype/src/autofit/afranges.c b/reactos/lib/3rdparty/freetype/src/autofit/afranges.c index c1e0afb7ea0..13c221364cf 100644 --- a/reactos/lib/3rdparty/freetype/src/autofit/afranges.c +++ b/reactos/lib/3rdparty/freetype/src/autofit/afranges.c @@ -18,6 +18,43 @@ #include "afranges.h" + /* + * The algorithm for assigning properties and styles to the `glyph_styles' + * array is as follows (cf. the implementation in + * `af_face_globals_compute_style_coverage'). + * + * Walk over all scripts (as listed in `afscript.h'). + * + * For a given script, walk over all styles (as listed in `afstyles.h'). + * The order of styles is important and should be as follows. + * + * - First come styles based on OpenType features (small caps, for + * example). Since features rely on glyph indices, thus completely + * bypassing character codes, no properties are assigned. + * + * - Next comes the default style, using the character ranges as defined + * below. This also assigns properties. + * + * Note that there also exist fallback scripts, mainly covering + * superscript and subscript glyphs of a script that are not present as + * OpenType features. Fallback scripts are defined below, also + * assigning properties; they are applied after the corresponding + * script. + * + */ + + + /* XXX Check base character ranges again: */ + /* Right now, they are quickly derived by visual inspection. */ + /* I can imagine that fine-tuning is necessary. */ + + /* for the auto-hinter, a `non-base character' is something that should */ + /* not be affected by blue zones, regardless of whether this is a */ + /* spacing or no-spacing glyph */ + + /* the `ta_xxxx_nonbase_uniranges' ranges must be strict subsets */ + /* of the corresponding `ta_xxxx_uniranges' ranges */ + const AF_Script_UniRangeRec af_arab_uniranges[] = { @@ -30,6 +67,30 @@ AF_UNIRANGE_REC( 0UL, 0UL ) }; + const AF_Script_UniRangeRec af_arab_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0x0600UL, 0x0605UL ), + AF_UNIRANGE_REC( 0x0610UL, 0x061AUL ), + AF_UNIRANGE_REC( 0x064BUL, 0x065FUL ), + AF_UNIRANGE_REC( 0x0670UL, 0x0670UL ), + AF_UNIRANGE_REC( 0x06D6UL, 0x06DCUL ), + AF_UNIRANGE_REC( 0x06DFUL, 0x06E4UL ), + AF_UNIRANGE_REC( 0x06E7UL, 0x06E8UL ), + AF_UNIRANGE_REC( 0x06EAUL, 0x06EDUL ), + AF_UNIRANGE_REC( 0x08E3UL, 0x08FFUL ), + AF_UNIRANGE_REC( 0xFBB2UL, 0xFBC1UL ), + AF_UNIRANGE_REC( 0xFE70UL, 0xFE70UL ), + AF_UNIRANGE_REC( 0xFE72UL, 0xFE72UL ), + AF_UNIRANGE_REC( 0xFE74UL, 0xFE74UL ), + AF_UNIRANGE_REC( 0xFE76UL, 0xFE76UL ), + AF_UNIRANGE_REC( 0xFE78UL, 0xFE78UL ), + AF_UNIRANGE_REC( 0xFE7AUL, 0xFE7AUL ), + AF_UNIRANGE_REC( 0xFE7CUL, 0xFE7CUL ), + AF_UNIRANGE_REC( 0xFE7EUL, 0xFE7EUL ), + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + const AF_Script_UniRangeRec af_cyrl_uniranges[] = { AF_UNIRANGE_REC( 0x0400UL, 0x04FFUL ), /* Cyrillic */ @@ -39,23 +100,47 @@ AF_UNIRANGE_REC( 0UL, 0UL ) }; - /* there are some characters in the Devanagari Unicode block that are */ + const AF_Script_UniRangeRec af_cyrl_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0x0483UL, 0x0489UL ), + AF_UNIRANGE_REC( 0x2DE0UL, 0x2DFFUL ), + AF_UNIRANGE_REC( 0xA66FUL, 0xA67FUL ), + AF_UNIRANGE_REC( 0xA69EUL, 0xA69FUL ), + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + + /* There are some characters in the Devanagari Unicode block that are */ /* generic to Indic scripts; we omit them so that their presence doesn't */ - /* trigger Devanagari */ + /* trigger Devanagari. */ const AF_Script_UniRangeRec af_deva_uniranges[] = { - AF_UNIRANGE_REC( 0x0900UL, 0x093BUL ), /* Devanagari */ + AF_UNIRANGE_REC( 0x0900UL, 0x093BUL ), /* Devanagari */ /* omitting U+093C nukta */ - AF_UNIRANGE_REC( 0x093DUL, 0x0950UL ), + AF_UNIRANGE_REC( 0x093DUL, 0x0950UL ), /* ... continued */ /* omitting U+0951 udatta, U+0952 anudatta */ - AF_UNIRANGE_REC( 0x0953UL, 0x0963UL ), + AF_UNIRANGE_REC( 0x0953UL, 0x0963UL ), /* ... continued */ /* omitting U+0964 danda, U+0965 double danda */ - AF_UNIRANGE_REC( 0x0966UL, 0x097FUL ), - AF_UNIRANGE_REC( 0x20B9UL, 0x20B9UL ), /* (new) Rupee sign */ + AF_UNIRANGE_REC( 0x0966UL, 0x097FUL ), /* ... continued */ + AF_UNIRANGE_REC( 0x20B9UL, 0x20B9UL ), /* (new) Rupee sign */ + AF_UNIRANGE_REC( 0xA8E0UL, 0xA8FFUL ), /* Devanagari Extended */ AF_UNIRANGE_REC( 0UL, 0UL ) }; + const AF_Script_UniRangeRec af_deva_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0x0900UL, 0x0902UL ), + AF_UNIRANGE_REC( 0x093AUL, 0x093AUL ), + AF_UNIRANGE_REC( 0x0941UL, 0x0948UL ), + AF_UNIRANGE_REC( 0x094DUL, 0x094DUL ), + AF_UNIRANGE_REC( 0x0953UL, 0x0957UL ), + AF_UNIRANGE_REC( 0x0962UL, 0x0963UL ), + AF_UNIRANGE_REC( 0xA8E0UL, 0xA8F1UL ), + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + const AF_Script_UniRangeRec af_grek_uniranges[] = { AF_UNIRANGE_REC( 0x0370UL, 0x03FFUL ), /* Greek and Coptic */ @@ -63,6 +148,19 @@ AF_UNIRANGE_REC( 0UL, 0UL ) }; + const AF_Script_UniRangeRec af_grek_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0x037AUL, 0x037AUL ), + AF_UNIRANGE_REC( 0x0384UL, 0x0385UL ), + AF_UNIRANGE_REC( 0x1FBDUL, 0x1FC1UL ), + AF_UNIRANGE_REC( 0x1FCDUL, 0x1FCFUL ), + AF_UNIRANGE_REC( 0x1FDDUL, 0x1FDFUL ), + AF_UNIRANGE_REC( 0x1FEDUL, 0x1FEFUL ), + AF_UNIRANGE_REC( 0x1FFDUL, 0x1FFEUL ), + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + const AF_Script_UniRangeRec af_hebr_uniranges[] = { AF_UNIRANGE_REC( 0x0590UL, 0x05FFUL ), /* Hebrew */ @@ -70,51 +168,171 @@ AF_UNIRANGE_REC( 0UL, 0UL ) }; + const AF_Script_UniRangeRec af_hebr_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0x0591UL, 0x05BFUL ), + AF_UNIRANGE_REC( 0x05C1UL, 0x05C2UL ), + AF_UNIRANGE_REC( 0x05C4UL, 0x05C5UL ), + AF_UNIRANGE_REC( 0x05C7UL, 0x05C7UL ), + AF_UNIRANGE_REC( 0xFB1EUL, 0xFB1EUL ), + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + + const AF_Script_UniRangeRec af_lao_uniranges[] = + { + AF_UNIRANGE_REC( 0x0E80UL, 0x0EFFUL ), /* Lao */ + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + const AF_Script_UniRangeRec af_lao_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0x0EB1UL, 0x0EB1UL ), + AF_UNIRANGE_REC( 0x0EB4UL, 0x0EBCUL ), + AF_UNIRANGE_REC( 0x0EC8UL, 0x0ECDUL ), + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + const AF_Script_UniRangeRec af_latn_uniranges[] = { AF_UNIRANGE_REC( 0x0020UL, 0x007FUL ), /* Basic Latin (no control chars) */ - AF_UNIRANGE_REC( 0x00A0UL, 0x00FFUL ), /* Latin-1 Supplement (no control chars) */ + AF_UNIRANGE_REC( 0x00A0UL, 0x00A9UL ), /* Latin-1 Supplement (no control chars) */ + AF_UNIRANGE_REC( 0x00ABUL, 0x00B1UL ), /* ... continued */ + AF_UNIRANGE_REC( 0x00B4UL, 0x00B8UL ), /* ... continued */ + AF_UNIRANGE_REC( 0x00BBUL, 0x00FFUL ), /* ... continued */ AF_UNIRANGE_REC( 0x0100UL, 0x017FUL ), /* Latin Extended-A */ AF_UNIRANGE_REC( 0x0180UL, 0x024FUL ), /* Latin Extended-B */ AF_UNIRANGE_REC( 0x0250UL, 0x02AFUL ), /* IPA Extensions */ - AF_UNIRANGE_REC( 0x02B0UL, 0x02FFUL ), /* Spacing Modifier Letters */ + AF_UNIRANGE_REC( 0x02B9UL, 0x02DFUL ), /* Spacing Modifier Letters */ + AF_UNIRANGE_REC( 0x02E5UL, 0x02FFUL ), /* ... continued */ AF_UNIRANGE_REC( 0x0300UL, 0x036FUL ), /* Combining Diacritical Marks */ - AF_UNIRANGE_REC( 0x1D00UL, 0x1D7FUL ), /* Phonetic Extensions */ - AF_UNIRANGE_REC( 0x1D80UL, 0x1DBFUL ), /* Phonetic Extensions Supplement */ + AF_UNIRANGE_REC( 0x1AB0UL, 0x1ABEUL ), /* Combining Diacritical Marks Extended */ + AF_UNIRANGE_REC( 0x1D00UL, 0x1D2BUL ), /* Phonetic Extensions */ + AF_UNIRANGE_REC( 0x1D6BUL, 0x1D77UL ), /* ... continued */ + AF_UNIRANGE_REC( 0x1D79UL, 0x1D7FUL ), /* ... continued */ + AF_UNIRANGE_REC( 0x1D80UL, 0x1D9AUL ), /* Phonetic Extensions Supplement */ AF_UNIRANGE_REC( 0x1DC0UL, 0x1DFFUL ), /* Combining Diacritical Marks Supplement */ AF_UNIRANGE_REC( 0x1E00UL, 0x1EFFUL ), /* Latin Extended Additional */ AF_UNIRANGE_REC( 0x2000UL, 0x206FUL ), /* General Punctuation */ - AF_UNIRANGE_REC( 0x2070UL, 0x209FUL ), /* Superscripts and Subscripts */ AF_UNIRANGE_REC( 0x20A0UL, 0x20B8UL ), /* Currency Symbols ... */ AF_UNIRANGE_REC( 0x20BAUL, 0x20CFUL ), /* ... except new Rupee sign */ AF_UNIRANGE_REC( 0x2150UL, 0x218FUL ), /* Number Forms */ - AF_UNIRANGE_REC( 0x2460UL, 0x24FFUL ), /* Enclosed Alphanumerics */ - AF_UNIRANGE_REC( 0x2C60UL, 0x2C7FUL ), /* Latin Extended-C */ + AF_UNIRANGE_REC( 0x2C60UL, 0x2C7BUL ), /* Latin Extended-C */ + AF_UNIRANGE_REC( 0x2C7EUL, 0x2C7FUL ), /* ... continued */ AF_UNIRANGE_REC( 0x2E00UL, 0x2E7FUL ), /* Supplemental Punctuation */ - AF_UNIRANGE_REC( 0xA720UL, 0xA7FFUL ), /* Latin Extended-D */ + AF_UNIRANGE_REC( 0xA720UL, 0xA76FUL ), /* Latin Extended-D */ + AF_UNIRANGE_REC( 0xA771UL, 0xA7F7UL ), /* ... continued */ + AF_UNIRANGE_REC( 0xA7FAUL, 0xA7FFUL ), /* ... continued */ + AF_UNIRANGE_REC( 0xAB30UL, 0xAB5BUL ), /* Latin Extended-E */ + AF_UNIRANGE_REC( 0xAB60UL, 0xAB6FUL ), /* ... continued */ AF_UNIRANGE_REC( 0xFB00UL, 0xFB06UL ), /* Alphab. Present. Forms (Latin Ligs) */ AF_UNIRANGE_REC( 0x1D400UL, 0x1D7FFUL ), /* Mathematical Alphanumeric Symbols */ - AF_UNIRANGE_REC( 0x1F100UL, 0x1F1FFUL ), /* Enclosed Alphanumeric Supplement */ AF_UNIRANGE_REC( 0UL, 0UL ) }; + const AF_Script_UniRangeRec af_latn_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0x005EUL, 0x0060UL ), + AF_UNIRANGE_REC( 0x007EUL, 0x007EUL ), + AF_UNIRANGE_REC( 0x00A8UL, 0x00A9UL ), + AF_UNIRANGE_REC( 0x00AEUL, 0x00B0UL ), + AF_UNIRANGE_REC( 0x00B4UL, 0x00B4UL ), + AF_UNIRANGE_REC( 0x00B8UL, 0x00B8UL ), + AF_UNIRANGE_REC( 0x00BCUL, 0x00BEUL ), + AF_UNIRANGE_REC( 0x02B9UL, 0x02DFUL ), + AF_UNIRANGE_REC( 0x02E5UL, 0x02FFUL ), + AF_UNIRANGE_REC( 0x0300UL, 0x036FUL ), + AF_UNIRANGE_REC( 0x1AB0UL, 0x1ABEUL ), + AF_UNIRANGE_REC( 0x1DC0UL, 0x1DFFUL ), + AF_UNIRANGE_REC( 0x2017UL, 0x2017UL ), + AF_UNIRANGE_REC( 0x203EUL, 0x203EUL ), + AF_UNIRANGE_REC( 0xA788UL, 0xA788UL ), + AF_UNIRANGE_REC( 0xA7F8UL, 0xA7FAUL ), + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + + const AF_Script_UniRangeRec af_latb_uniranges[] = + { + AF_UNIRANGE_REC( 0x1D62UL, 0x1D6AUL ), /* some small subscript letters */ + AF_UNIRANGE_REC( 0x2080UL, 0x209CUL ), /* subscript digits and letters */ + AF_UNIRANGE_REC( 0x2C7CUL, 0x2C7CUL ), /* latin subscript small letter j */ + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + const AF_Script_UniRangeRec af_latb_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + + const AF_Script_UniRangeRec af_latp_uniranges[] = + { + AF_UNIRANGE_REC( 0x00AAUL, 0x00AAUL ), /* feminine ordinal indicator */ + AF_UNIRANGE_REC( 0x00B2UL, 0x00B3UL ), /* superscript two and three */ + AF_UNIRANGE_REC( 0x00B9UL, 0x00BAUL ), /* superscript one, masc. ord. indic. */ + AF_UNIRANGE_REC( 0x02B0UL, 0x02B8UL ), /* some latin superscript mod. letters */ + AF_UNIRANGE_REC( 0x02E0UL, 0x02E4UL ), /* some IPA modifier letters */ + AF_UNIRANGE_REC( 0x1D2CUL, 0x1D61UL ), /* latin superscript modifier letters */ + AF_UNIRANGE_REC( 0x1D78UL, 0x1D78UL ), /* modifier letter cyrillic en */ + AF_UNIRANGE_REC( 0x1D9BUL, 0x1DBFUL ), /* more modifier letters */ + AF_UNIRANGE_REC( 0x2070UL, 0x207FUL ), /* superscript digits and letters */ + AF_UNIRANGE_REC( 0x2C7DUL, 0x2C7DUL ), /* modifier letter capital v */ + AF_UNIRANGE_REC( 0xA770UL, 0xA770UL ), /* modifier letter us */ + AF_UNIRANGE_REC( 0xA7F8UL, 0xA7F9UL ), /* more modifier letters */ + AF_UNIRANGE_REC( 0xAB5CUL, 0xAB5FUL ), /* more modifier letters */ + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + const AF_Script_UniRangeRec af_latp_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + const AF_Script_UniRangeRec af_none_uniranges[] = { AF_UNIRANGE_REC( 0UL, 0UL ) }; + const AF_Script_UniRangeRec af_none_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + const AF_Script_UniRangeRec af_telu_uniranges[] = { AF_UNIRANGE_REC( 0x0C00UL, 0x0C7FUL ), /* Telugu */ AF_UNIRANGE_REC( 0UL, 0UL ) }; + const AF_Script_UniRangeRec af_telu_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0x0C00UL, 0x0C00UL ), + AF_UNIRANGE_REC( 0x0C3EUL, 0x0C40UL ), + AF_UNIRANGE_REC( 0x0C46UL, 0x0C56UL ), + AF_UNIRANGE_REC( 0x0C62UL, 0x0C63UL ), + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + const AF_Script_UniRangeRec af_thai_uniranges[] = { AF_UNIRANGE_REC( 0x0E00UL, 0x0E7FUL ), /* Thai */ AF_UNIRANGE_REC( 0UL, 0UL ) }; + const AF_Script_UniRangeRec af_thai_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0x0E31UL, 0x0E31UL ), + AF_UNIRANGE_REC( 0x0E34UL, 0x0E3AUL ), + AF_UNIRANGE_REC( 0x0E47UL, 0x0E4EUL ), + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + #ifdef AF_CONFIG_OPTION_INDIC const AF_Script_UniRangeRec af_beng_uniranges[] = @@ -123,72 +341,197 @@ AF_UNIRANGE_REC( 0UL, 0UL ) }; + const AF_Script_UniRangeRec af_beng_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0x0981UL, 0x0981UL ), + AF_UNIRANGE_REC( 0x09BCUL, 0x09BCUL ), + AF_UNIRANGE_REC( 0x09C1UL, 0x09C4UL ), + AF_UNIRANGE_REC( 0x09CDUL, 0x09CDUL ), + AF_UNIRANGE_REC( 0x09E2UL, 0x09E3UL ), + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + const AF_Script_UniRangeRec af_gujr_uniranges[] = { AF_UNIRANGE_REC( 0x0A80UL, 0x0AFFUL ), /* Gujarati */ AF_UNIRANGE_REC( 0UL, 0UL ) }; + const AF_Script_UniRangeRec af_gujr_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0x0A81UL, 0x0A82UL ), + AF_UNIRANGE_REC( 0x0ABCUL, 0x0ABCUL ), + AF_UNIRANGE_REC( 0x0AC1UL, 0x0AC8UL ), + AF_UNIRANGE_REC( 0x0ACDUL, 0x0ACDUL ), + AF_UNIRANGE_REC( 0x0AE2UL, 0x0AE3UL ), + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + const AF_Script_UniRangeRec af_guru_uniranges[] = { AF_UNIRANGE_REC( 0x0A00UL, 0x0A7FUL ), /* Gurmukhi */ AF_UNIRANGE_REC( 0UL, 0UL ) }; + const AF_Script_UniRangeRec af_guru_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0x0A01UL, 0x0A02UL ), + AF_UNIRANGE_REC( 0x0A3CUL, 0x0A3EUL ), + AF_UNIRANGE_REC( 0x0A41UL, 0x0A51UL ), + AF_UNIRANGE_REC( 0x0A70UL, 0x0A71UL ), + AF_UNIRANGE_REC( 0x0A75UL, 0x0A75UL ), + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + const AF_Script_UniRangeRec af_knda_uniranges[] = { AF_UNIRANGE_REC( 0x0C80UL, 0x0CFFUL ), /* Kannada */ AF_UNIRANGE_REC( 0UL, 0UL ) }; + const AF_Script_UniRangeRec af_knda_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0x0C81UL, 0x0C81UL ), + AF_UNIRANGE_REC( 0x0CBCUL, 0x0CBCUL ), + AF_UNIRANGE_REC( 0x0CBFUL, 0x0CBFUL ), + AF_UNIRANGE_REC( 0x0CC6UL, 0x0CC6UL ), + AF_UNIRANGE_REC( 0x0CCCUL, 0x0CCDUL ), + AF_UNIRANGE_REC( 0x0CE2UL, 0x0CE3UL ), + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + const AF_Script_UniRangeRec af_limb_uniranges[] = { AF_UNIRANGE_REC( 0x1900UL, 0x194FUL ), /* Limbu */ AF_UNIRANGE_REC( 0UL, 0UL ) }; + const AF_Script_UniRangeRec af_limb_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0x1920UL, 0x1922UL ), + AF_UNIRANGE_REC( 0x1927UL, 0x1934UL ), + AF_UNIRANGE_REC( 0x1937UL, 0x193BUL ), + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + const AF_Script_UniRangeRec af_mlym_uniranges[] = { AF_UNIRANGE_REC( 0x0D00UL, 0x0D7FUL ), /* Malayalam */ AF_UNIRANGE_REC( 0UL, 0UL ) }; + const AF_Script_UniRangeRec af_mlym_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0x0D01UL, 0x0D01UL ), + AF_UNIRANGE_REC( 0x0D4DUL, 0x0D4EUL ), + AF_UNIRANGE_REC( 0x0D62UL, 0x0D63UL ), + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + const AF_Script_UniRangeRec af_orya_uniranges[] = { AF_UNIRANGE_REC( 0x0B00UL, 0x0B7FUL ), /* Oriya */ AF_UNIRANGE_REC( 0UL, 0UL ) }; + const AF_Script_UniRangeRec af_orya_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0x0B01UL, 0x0B02UL ), + AF_UNIRANGE_REC( 0x0B3CUL, 0x0B3CUL ), + AF_UNIRANGE_REC( 0x0B3FUL, 0x0B3FUL ), + AF_UNIRANGE_REC( 0x0B41UL, 0x0B44UL ), + AF_UNIRANGE_REC( 0x0B4DUL, 0x0B56UL ), + AF_UNIRANGE_REC( 0x0B62UL, 0x0B63UL ), + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + const AF_Script_UniRangeRec af_sinh_uniranges[] = { AF_UNIRANGE_REC( 0x0D80UL, 0x0DFFUL ), /* Sinhala */ AF_UNIRANGE_REC( 0UL, 0UL ) }; - const AF_Script_UniRangeRec af_sund_uniranges[] = + const AF_Script_UniRangeRec af_sinh_nonbase_uniranges[] = { - AF_UNIRANGE_REC( 0x1B80UL, 0x1BBFUL ), /* Sundanese */ + AF_UNIRANGE_REC( 0x0DCAUL, 0x0DCAUL ), + AF_UNIRANGE_REC( 0x0DD2UL, 0x0DD6UL ), AF_UNIRANGE_REC( 0UL, 0UL ) }; + + const AF_Script_UniRangeRec af_sund_uniranges[] = + { + AF_UNIRANGE_REC( 0x1B80UL, 0x1BBFUL ), /* Sundanese */ + AF_UNIRANGE_REC( 0x1CC0UL, 0x1CCFUL ), /* Sundanese Supplement */ + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + const AF_Script_UniRangeRec af_sund_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0x1B80UL, 0x1B82UL ), + AF_UNIRANGE_REC( 0x1BA1UL, 0x1BADUL ), + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + const AF_Script_UniRangeRec af_sylo_uniranges[] = { AF_UNIRANGE_REC( 0xA800UL, 0xA82FUL ), /* Syloti Nagri */ AF_UNIRANGE_REC( 0UL, 0UL ) }; + const AF_Script_UniRangeRec af_sylo_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0xA802UL, 0xA802UL ), + AF_UNIRANGE_REC( 0xA806UL, 0xA806UL ), + AF_UNIRANGE_REC( 0xA80BUL, 0xA80BUL ), + AF_UNIRANGE_REC( 0xA825UL, 0xA826UL ), + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + const AF_Script_UniRangeRec af_taml_uniranges[] = { AF_UNIRANGE_REC( 0x0B80UL, 0x0BFFUL ), /* Tamil */ AF_UNIRANGE_REC( 0UL, 0UL ) }; + const AF_Script_UniRangeRec af_taml_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0x0B82UL, 0x0B82UL ), + AF_UNIRANGE_REC( 0x0BC0UL, 0x0BC2UL ), + AF_UNIRANGE_REC( 0x0BCDUL, 0x0BCDUL ), + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + const AF_Script_UniRangeRec af_tibt_uniranges[] = { AF_UNIRANGE_REC( 0x0F00UL, 0x0FFFUL ), /* Tibetan */ AF_UNIRANGE_REC( 0UL, 0UL ) }; + const AF_Script_UniRangeRec af_tibt_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0x0F18UL, 0x0F19UL ), + AF_UNIRANGE_REC( 0x0F35UL, 0x0F35UL ), + AF_UNIRANGE_REC( 0x0F37UL, 0x0F37UL ), + AF_UNIRANGE_REC( 0x0F39UL, 0x0F39UL ), + AF_UNIRANGE_REC( 0x0F3EUL, 0x0F3FUL ), + AF_UNIRANGE_REC( 0x0F71UL, 0x0F7EUL ), + AF_UNIRANGE_REC( 0x0F80UL, 0x0F84UL ), + AF_UNIRANGE_REC( 0x0F86UL, 0x0F87UL ), + AF_UNIRANGE_REC( 0x0F8DUL, 0x0FBCUL ), + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + #endif /* !AF_CONFIG_OPTION_INDIC */ #ifdef AF_CONFIG_OPTION_CJK @@ -210,7 +553,6 @@ AF_UNIRANGE_REC( 0x31A0UL, 0x31BFUL ), /* Bopomofo Extended */ AF_UNIRANGE_REC( 0x31C0UL, 0x31EFUL ), /* CJK Strokes */ AF_UNIRANGE_REC( 0x31F0UL, 0x31FFUL ), /* Katakana Phonetic Extensions */ - AF_UNIRANGE_REC( 0x3200UL, 0x32FFUL ), /* Enclosed CJK Letters and Months */ AF_UNIRANGE_REC( 0x3300UL, 0x33FFUL ), /* CJK Compatibility */ AF_UNIRANGE_REC( 0x3400UL, 0x4DBFUL ), /* CJK Unified Ideographs Extension A */ AF_UNIRANGE_REC( 0x4DC0UL, 0x4DFFUL ), /* Yijing Hexagram Symbols */ @@ -224,7 +566,6 @@ AF_UNIRANGE_REC( 0xFF00UL, 0xFFEFUL ), /* Halfwidth and Fullwidth Forms */ AF_UNIRANGE_REC( 0x1B000UL, 0x1B0FFUL ), /* Kana Supplement */ AF_UNIRANGE_REC( 0x1D300UL, 0x1D35FUL ), /* Tai Xuan Hing Symbols */ - AF_UNIRANGE_REC( 0x1F200UL, 0x1F2FFUL ), /* Enclosed Ideographic Supplement */ AF_UNIRANGE_REC( 0x20000UL, 0x2A6DFUL ), /* CJK Unified Ideographs Extension B */ AF_UNIRANGE_REC( 0x2A700UL, 0x2B73FUL ), /* CJK Unified Ideographs Extension C */ AF_UNIRANGE_REC( 0x2B740UL, 0x2B81FUL ), /* CJK Unified Ideographs Extension D */ @@ -232,6 +573,13 @@ AF_UNIRANGE_REC( 0UL, 0UL ) }; + const AF_Script_UniRangeRec af_hani_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0x302AUL, 0x302FUL ), + AF_UNIRANGE_REC( 0x3190UL, 0x319FUL ), + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + #endif /* !AF_CONFIG_OPTION_CJK */ /* END */ diff --git a/reactos/lib/3rdparty/freetype/src/autofit/afranges.h b/reactos/lib/3rdparty/freetype/src/autofit/afranges.h index 7c78ab089e9..b080873e77a 100644 --- a/reactos/lib/3rdparty/freetype/src/autofit/afranges.h +++ b/reactos/lib/3rdparty/freetype/src/autofit/afranges.h @@ -29,6 +29,12 @@ FT_BEGIN_HEADER #define SCRIPT( s, S, d, h, sc1, sc2, sc3 ) \ extern const AF_Script_UniRangeRec af_ ## s ## _uniranges[]; +#include "afscript.h" + +#undef SCRIPT +#define SCRIPT( s, S, d, h, sc1, sc2, sc3 ) \ + extern const AF_Script_UniRangeRec af_ ## s ## _nonbase_uniranges[]; + #include "afscript.h" /* */ diff --git a/reactos/lib/3rdparty/freetype/src/autofit/afscript.h b/reactos/lib/3rdparty/freetype/src/autofit/afscript.h index dfcc8302aac..b92e84f5ff0 100644 --- a/reactos/lib/3rdparty/freetype/src/autofit/afscript.h +++ b/reactos/lib/3rdparty/freetype/src/autofit/afscript.h @@ -25,6 +25,10 @@ /* by a description string. Then comes the corresponding HarfBuzz */ /* script name tag, followed by a string of standard characters (to */ /* derive the standard width and height of stems). */ + /* */ + /* Note that fallback scripts only have a default style, thus we */ + /* use `HB_SCRIPT_INVALID' as the HarfBuzz script name tag for */ + /* them. */ SCRIPT( arab, ARAB, "Arabic", @@ -34,7 +38,7 @@ SCRIPT( cyrl, CYRL, "Cyrillic", HB_SCRIPT_CYRILLIC, - 0x43E, 0x41E, 0x0 ) /* оО */ + 0x43E, 0x41E, 0x0 ) /* о О */ SCRIPT( deva, DEVA, "Devanagari", @@ -44,18 +48,34 @@ SCRIPT( grek, GREK, "Greek", HB_SCRIPT_GREEK, - 0x3BF, 0x39F, 0x0 ) /* οΟ */ + 0x3BF, 0x39F, 0x0 ) /* ο Ο */ SCRIPT( hebr, HEBR, "Hebrew", HB_SCRIPT_HEBREW, 0x5DD, 0x0, 0x0 ) /* × */ + /* only digit zero has a simple shape in the Lao script */ + SCRIPT( lao, LAO, + "Lao", + HB_SCRIPT_LAO, + 0xED0, 0x0, 0x0 ) /* à» */ + SCRIPT( latn, LATN, "Latin", HB_SCRIPT_LATIN, 'o', 'O', '0' ) + SCRIPT( latb, LATB, + "Latin Subscript Fallback", + HB_SCRIPT_INVALID, + 0x2092, 0x2080, 0x0 ) /* â‚’ â‚€ */ + + SCRIPT( latp, LATP, + "Latin Superscript Fallback", + HB_SCRIPT_INVALID, + 0x1D52, 0x1D3C, 0x2070 ) /* áµ’ á´¼ â° */ + SCRIPT( none, NONE, "no script", HB_SCRIPT_INVALID, diff --git a/reactos/lib/3rdparty/freetype/src/autofit/afstyles.h b/reactos/lib/3rdparty/freetype/src/autofit/afstyles.h index bfd5bb910f0..87663c9ee7e 100644 --- a/reactos/lib/3rdparty/freetype/src/autofit/afstyles.h +++ b/reactos/lib/3rdparty/freetype/src/autofit/afstyles.h @@ -27,7 +27,9 @@ /* coverage. */ /* */ /* Note that styles using `AF_COVERAGE_DEFAULT' should always */ - /* come after styles with other coverages. */ + /* come after styles with other coverages. Also note that */ + /* fallback scripts only use `AF_COVERAGE_DEFAULT' for its */ + /* style. */ /* */ /* Example: */ /* */ @@ -90,6 +92,13 @@ META_STYLE_LATIN( cyrl, CYRL, "Cyrillic" ) + STYLE( deva_dflt, DEVA_DFLT, + "Devanagari default style", + AF_WRITING_SYSTEM_LATIN, + AF_SCRIPT_DEVA, + AF_BLUE_STRINGSET_DEVA, + AF_COVERAGE_DEFAULT ) + META_STYLE_LATIN( grek, GREK, "Greek" ) STYLE( hebr_dflt, HEBR_DFLT, @@ -98,13 +107,28 @@ AF_SCRIPT_HEBR, AF_BLUE_STRINGSET_HEBR, AF_COVERAGE_DEFAULT ) + + STYLE( lao_dflt, LAO_DFLT, + "Lao default style", + AF_WRITING_SYSTEM_LATIN, + AF_SCRIPT_LAO, + AF_BLUE_STRINGSET_LAO, + AF_COVERAGE_DEFAULT ) + META_STYLE_LATIN( latn, LATN, "Latin" ) - STYLE( deva_dflt, DEVA_DFLT, - "Devanagari default style", + STYLE( latb_dflt, LATB_DFLT, + "Latin subscript fallback default style", AF_WRITING_SYSTEM_LATIN, - AF_SCRIPT_DEVA, - AF_BLUE_STRINGSET_DEVA, + AF_SCRIPT_LATB, + AF_BLUE_STRINGSET_LATB, + AF_COVERAGE_DEFAULT ) + + STYLE( latp_dflt, LATP_DFLT, + "Latin superscript fallback default style", + AF_WRITING_SYSTEM_LATIN, + AF_SCRIPT_LATP, + AF_BLUE_STRINGSET_LATP, AF_COVERAGE_DEFAULT ) #ifdef FT_OPTION_AUTOFIT2 diff --git a/reactos/lib/3rdparty/freetype/src/autofit/aftypes.h b/reactos/lib/3rdparty/freetype/src/autofit/aftypes.h index 78e3fd7ec96..43b38006c2c 100644 --- a/reactos/lib/3rdparty/freetype/src/autofit/aftypes.h +++ b/reactos/lib/3rdparty/freetype/src/autofit/aftypes.h @@ -41,6 +41,10 @@ #include "afblue.h" +#ifdef FT_DEBUG_AUTOFIT +#include FT_CONFIG_STANDARD_LIBRARY_H +#endif + FT_BEGIN_HEADER @@ -54,8 +58,6 @@ FT_BEGIN_HEADER #ifdef FT_DEBUG_AUTOFIT -#include FT_CONFIG_STANDARD_LIBRARY_H - extern int _af_debug_disable_horz_hints; extern int _af_debug_disable_vert_hints; extern int _af_debug_disable_blue_hints; @@ -215,7 +217,8 @@ extern void* _af_debug_hints; AF_StyleMetrics metrics ); typedef void - (*AF_WritingSystem_ApplyHintsFunc)( AF_GlyphHints hints, + (*AF_WritingSystem_ApplyHintsFunc)( FT_UInt glyph_index, + AF_GlyphHints hints, FT_Outline* outline, AF_StyleMetrics metrics ); @@ -291,8 +294,9 @@ extern void* _af_debug_hints; /*************************************************************************/ /* - * Each script is associated with a set of Unicode ranges that gets used - * to test whether the font face supports the script. + * Each script is associated with two sets of Unicode ranges to test + * whether the font face supports the script, and which non-base + * characters the script contains. * * We use four-letter script tags from the OpenType specification, * extended by `NONE', which indicates `no script'. @@ -329,7 +333,9 @@ extern void* _af_debug_hints; { AF_Script script; - AF_Script_UniRange script_uni_ranges; /* last must be { 0, 0 } */ + /* last element in the ranges must be { 0, 0 } */ + AF_Script_UniRange script_uni_ranges; + AF_Script_UniRange script_uni_nonbase_ranges; FT_UInt32 standard_char1; /* for default width and height */ FT_UInt32 standard_char2; /* ditto */ @@ -509,6 +515,7 @@ extern void* _af_debug_hints; script_class, \ script, \ ranges, \ + nonbase_ranges, \ std_char1, \ std_char2, \ std_char3 ) \ @@ -517,6 +524,7 @@ extern void* _af_debug_hints; { \ script, \ ranges, \ + nonbase_ranges, \ std_char1, \ std_char2, \ std_char3 \ @@ -583,17 +591,19 @@ extern void* _af_debug_hints; script_class, \ script_, \ ranges, \ + nonbase_ranges, \ std_char1, \ std_char2, \ std_char3 ) \ FT_LOCAL_DEF( void ) \ FT_Init_Class_ ## script_class( AF_ScriptClassRec* ac ) \ { \ - ac->script = script_; \ - ac->script_uni_ranges = ranges; \ - ac->standard_char1 = std_char1; \ - ac->standard_char2 = std_char2; \ - ac->standard_char3 = std_char3; \ + ac->script = script_; \ + ac->script_uni_ranges = ranges; \ + ac->script_uni_nonbase_ranges = nonbase_ranges; \ + ac->standard_char1 = std_char1; \ + ac->standard_char2 = std_char2; \ + ac->standard_char3 = std_char3; \ } diff --git a/reactos/lib/3rdparty/freetype/src/autofit/afwarp.h b/reactos/lib/3rdparty/freetype/src/autofit/afwarp.h index 5a6208a15fd..6069b6b277b 100644 --- a/reactos/lib/3rdparty/freetype/src/autofit/afwarp.h +++ b/reactos/lib/3rdparty/freetype/src/autofit/afwarp.h @@ -25,7 +25,7 @@ FT_BEGIN_HEADER #define AF_WARPER_SCALE -#define AF_WARPER_FLOOR( x ) ( (x) & ~TYPEOF( x )63 ) +#define AF_WARPER_FLOOR( x ) ( (x) & ~FT_TYPEOF( x )63 ) #define AF_WARPER_CEIL( x ) AF_WARPER_FLOOR( (x) + 63 ) diff --git a/reactos/lib/3rdparty/freetype/src/autofit/hbshim.c b/reactos/lib/3rdparty/freetype/src/autofit/hbshim.c index c9c1db0be1f..7a45059c390 100644 --- a/reactos/lib/3rdparty/freetype/src/autofit/hbshim.c +++ b/reactos/lib/3rdparty/freetype/src/autofit/hbshim.c @@ -98,7 +98,7 @@ FT_Error af_get_coverage( AF_FaceGlobals globals, AF_StyleClass style_class, - FT_Byte* gstyles ) + FT_UShort* gstyles ) { hb_face_t* face; @@ -363,7 +363,7 @@ continue; if ( gstyles[idx] == AF_STYLE_UNASSIGNED ) - gstyles[idx] = (FT_Byte)style_class->style; + gstyles[idx] = (FT_UShort)style_class->style; #ifdef FT_DEBUG_LEVEL_TRACE else FT_TRACE4(( "*" )); @@ -509,7 +509,7 @@ FT_Error af_get_coverage( AF_FaceGlobals globals, AF_StyleClass style_class, - FT_Byte* gstyles ) + FT_UShort* gstyles ) { FT_UNUSED( globals ); FT_UNUSED( style_class ); diff --git a/reactos/lib/3rdparty/freetype/src/autofit/hbshim.h b/reactos/lib/3rdparty/freetype/src/autofit/hbshim.h index 5636ca64941..3824941ca2a 100644 --- a/reactos/lib/3rdparty/freetype/src/autofit/hbshim.h +++ b/reactos/lib/3rdparty/freetype/src/autofit/hbshim.h @@ -38,7 +38,7 @@ FT_BEGIN_HEADER FT_Error af_get_coverage( AF_FaceGlobals globals, AF_StyleClass style_class, - FT_Byte* gstyles ); + FT_UShort* gstyles ); FT_Error af_get_char_index( AF_StyleMetrics metrics, diff --git a/reactos/lib/3rdparty/freetype/src/base/basepic.h b/reactos/lib/3rdparty/freetype/src/base/basepic.h index 51ecf9e01e5..c5d7cbf5ab7 100644 --- a/reactos/lib/3rdparty/freetype/src/base/basepic.h +++ b/reactos/lib/3rdparty/freetype/src/base/basepic.h @@ -20,10 +20,9 @@ #define __BASEPIC_H__ -FT_BEGIN_HEADER - #include FT_INTERNAL_PIC_H + #ifndef FT_CONFIG_OPTION_PIC #define FT_OUTLINE_GLYPH_CLASS_GET &ft_outline_glyph_class @@ -43,6 +42,8 @@ FT_BEGIN_HEADER #endif +FT_BEGIN_HEADER + typedef struct BasePIC_ { FT_Module_Class** default_module_classes; @@ -78,12 +79,12 @@ FT_BEGIN_HEADER FT_Error ft_base_pic_init( FT_Library library ); +FT_END_HEADER + #endif /* FT_CONFIG_OPTION_PIC */ /* */ -FT_END_HEADER - #endif /* __BASEPIC_H__ */ diff --git a/reactos/lib/3rdparty/freetype/src/base/ftbase.h b/reactos/lib/3rdparty/freetype/src/base/ftbase.h index cb57f96864f..e37fefa411f 100644 --- a/reactos/lib/3rdparty/freetype/src/base/ftbase.h +++ b/reactos/lib/3rdparty/freetype/src/base/ftbase.h @@ -27,6 +27,11 @@ FT_BEGIN_HEADER + /* MacOS resource fork cannot exceed 16MB at least for Carbon code; */ + /* see https://support.microsoft.com/en-us/kb/130437 */ +#define FT_MAC_RFORK_MAX_LEN 0x00FFFFFFUL + + /* Assume the stream is sfnt-wrapped PS Type1 or sfnt-wrapped CID-keyed */ /* font, and try to load a face specified by the face_index. */ FT_LOCAL( FT_Error ) diff --git a/reactos/lib/3rdparty/freetype/src/base/ftcalc.c b/reactos/lib/3rdparty/freetype/src/base/ftcalc.c index dca0e1dc533..619a08b3a0c 100644 --- a/reactos/lib/3rdparty/freetype/src/base/ftcalc.c +++ b/reactos/lib/3rdparty/freetype/src/base/ftcalc.c @@ -86,8 +86,7 @@ FT_EXPORT_DEF( FT_Fixed ) FT_RoundFix( FT_Fixed a ) { - return a >= 0 ? ( a + 0x8000L ) & ~0xFFFFL - : -((-a + 0x8000L ) & ~0xFFFFL ); + return ( a + 0x8000L - ( a < 0 ) ) & ~0xFFFFL; } @@ -96,8 +95,7 @@ FT_EXPORT_DEF( FT_Fixed ) FT_CeilFix( FT_Fixed a ) { - return a >= 0 ? ( a + 0xFFFFL ) & ~0xFFFFL - : -((-a + 0xFFFFL ) & ~0xFFFFL ); + return ( a + 0xFFFFL ) & ~0xFFFFL; } @@ -106,8 +104,7 @@ FT_EXPORT_DEF( FT_Fixed ) FT_FloorFix( FT_Fixed a ) { - return a >= 0 ? a & ~0xFFFFL - : -((-a) & ~0xFFFFL ); + return a & ~0xFFFFL; } #ifndef FT_MSB @@ -240,22 +237,10 @@ #else - FT_Int s = 1; - FT_UInt64 a, b, c; - FT_Long c_; + FT_Int64 ab = (FT_Int64)a_ * (FT_Int64)b_; - - FT_MOVE_SIGN( a_, s ); - FT_MOVE_SIGN( b_, s ); - - a = (FT_UInt64)a_; - b = (FT_UInt64)b_; - - c = ( a * b + 0x8000UL ) >> 16; - - c_ = (FT_Long)c; - - return s < 0 ? -c_ : c_; + /* this requires arithmetic right shift of signed numbers */ + return (FT_Long)( ( ab + 0x8000L - ( ab < 0 ) ) >> 16 ); #endif /* FT_MULFIX_ASSEMBLER */ } @@ -437,9 +422,6 @@ /* XXX: this function does not allow 64-bit arguments */ - if ( a_ == 0 || b_ == c_ ) - return a_; - FT_MOVE_SIGN( a_, s ); FT_MOVE_SIGN( b_, s ); FT_MOVE_SIGN( c_, s ); @@ -488,9 +470,6 @@ /* XXX: this function does not allow 64-bit arguments */ - if ( a_ == 0 || b_ == c_ ) - return a_; - FT_MOVE_SIGN( a_, s ); FT_MOVE_SIGN( b_, s ); FT_MOVE_SIGN( c_, s ); @@ -546,9 +525,6 @@ FT_UInt32 a, b; - if ( a_ == 0 || b_ == 0x10000L ) - return a_; - /* * This is a clever way of converting a signed number `a' into its * absolute value (stored back into `a') and its sign. The sign is @@ -599,9 +575,6 @@ /* XXX: this function does not allow 64-bit arguments */ - if ( a_ == 0 || b_ == 0x10000L ) - return a_; - FT_MOVE_SIGN( a_, s ); FT_MOVE_SIGN( b_, s ); @@ -785,6 +758,102 @@ } + /* documentation is in ftcalc.h */ + + FT_BASE_DEF( FT_UInt32 ) + FT_Vector_NormLen( FT_Vector* vector ) + { + FT_Int32 x_ = vector->x; + FT_Int32 y_ = vector->y; + FT_Int32 b, z; + FT_UInt32 x, y, u, v, l; + FT_Int sx = 1, sy = 1, shift; + + + FT_MOVE_SIGN( x_, sx ); + FT_MOVE_SIGN( y_, sy ); + + x = (FT_UInt32)x_; + y = (FT_UInt32)y_; + + /* trivial cases */ + if ( x == 0 ) + { + if ( y > 0 ) + vector->y = sy * 0x10000; + return y; + } + else if ( y == 0 ) + { + if ( x > 0 ) + vector->x = sx * 0x10000; + return x; + } + + /* Estimate length and prenormalize by shifting so that */ + /* the new approximate length is between 2/3 and 4/3. */ + /* The magic constant 0xAAAAAAAAUL (2/3 of 2^32) helps */ + /* achieve this in 16.16 fixed-point representation. */ + l = x > y ? x + ( y >> 1 ) + : y + ( x >> 1 ); + + shift = 31 - FT_MSB( l ); + shift -= 15 + ( l >= ( 0xAAAAAAAAUL >> shift ) ); + + if ( shift > 0 ) + { + x <<= shift; + y <<= shift; + + /* re-estimate length for tiny vectors */ + l = x > y ? x + ( y >> 1 ) + : y + ( x >> 1 ); + } + else + { + x >>= -shift; + y >>= -shift; + l >>= -shift; + } + + /* lower linear approximation for reciprocal length minus one */ + b = 0x10000 - (FT_Int32)l; + + x_ = (FT_Int32)x; + y_ = (FT_Int32)y; + + /* Newton's iterations */ + do + { + u = (FT_UInt32)( x_ + ( x_ * b >> 16 ) ); + v = (FT_UInt32)( y_ + ( y_ * b >> 16 ) ); + + /* Normalized squared length in the parentheses approaches 2^32. */ + /* On two's complement systems, converting to signed gives the */ + /* difference with 2^32 even if the expression wraps around. */ + z = -(FT_Int32)( u * u + v * v ) / 0x200; + z = z * ( ( 0x10000 + b ) >> 8 ) / 0x10000; + + b += z; + + } while ( z > 0 ); + + vector->x = sx < 0 ? -(FT_Pos)u : (FT_Pos)u; + vector->y = sy < 0 ? -(FT_Pos)v : (FT_Pos)v; + + /* Conversion to signed helps to recover from likely wrap around */ + /* in calculating the prenormalized length, because it gives the */ + /* correct difference with 2^32 on two's complement systems. */ + l = (FT_UInt32)( 0x10000 + (FT_Int32)( u * x + v * y ) / 0x10000 ); + if ( shift > 0 ) + l = ( l + ( 1 << ( shift - 1 ) ) ) >> shift; + else + l <<= -shift; + + return l; + } + + #if 0 /* documentation is in ftcalc.h */ @@ -832,52 +901,34 @@ FT_Pos out_x, FT_Pos out_y ) { - FT_Long result; /* avoid overflow on 16-bit system */ - - - /* deal with the trivial cases quickly */ - if ( in_y == 0 ) - { - if ( in_x >= 0 ) - result = out_y; - else - result = -out_y; - } - else if ( in_x == 0 ) - { - if ( in_y >= 0 ) - result = -out_x; - else - result = out_x; - } - else if ( out_y == 0 ) - { - if ( out_x >= 0 ) - result = in_y; - else - result = -in_y; - } - else if ( out_x == 0 ) - { - if ( out_y >= 0 ) - result = -in_x; - else - result = in_x; - } - else /* general case */ - { #ifdef FT_LONG64 - FT_Int64 delta = (FT_Int64)in_x * out_y - (FT_Int64)in_y * out_x; + FT_Int64 delta = (FT_Int64)in_x * out_y - (FT_Int64)in_y * out_x; - if ( delta == 0 ) - result = 0; - else - result = 1 - 2 * ( delta < 0 ); + return ( delta > 0 ) - ( delta < 0 ); #else + FT_Int result; + + + if ( (FT_ULong)FT_ABS( in_x ) + (FT_ULong)FT_ABS( out_y ) <= 131071UL && + (FT_ULong)FT_ABS( in_y ) + (FT_ULong)FT_ABS( out_x ) <= 131071UL ) + { + FT_Long z1 = in_x * out_y; + FT_Long z2 = in_y * out_x; + + + if ( z1 > z2 ) + result = +1; + else if ( z1 < z2 ) + result = -1; + else + result = 0; + } + else /* products might overflow 32 bits */ + { FT_Int64 z1, z2; @@ -895,12 +946,12 @@ result = -1; else result = 0; - -#endif } /* XXX: only the sign of return value, +1/0/-1 must be used */ - return (FT_Int)result; + return result; + +#endif } diff --git a/reactos/lib/3rdparty/freetype/src/base/ftdebug.c b/reactos/lib/3rdparty/freetype/src/base/ftdebug.c index 2cdb7c24247..03e18a86999 100644 --- a/reactos/lib/3rdparty/freetype/src/base/ftdebug.c +++ b/reactos/lib/3rdparty/freetype/src/base/ftdebug.c @@ -152,8 +152,8 @@ /* the memory and stream components which are set to 7 and 5, */ /* respectively. */ /* */ - /* See the file <include/internal/fttrace.h> for details of the */ - /* available toggle names. */ + /* See the file `include/freetype/internal/fttrace.h' for details of */ + /* the available toggle names. */ /* */ /* The level must be between 0 and 7; 0 means quiet (except for serious */ /* runtime errors), and 7 means _very_ verbose. */ diff --git a/reactos/lib/3rdparty/freetype/src/base/ftinit.c b/reactos/lib/3rdparty/freetype/src/base/ftinit.c index cc95e6a6ae4..b65a91d06c6 100644 --- a/reactos/lib/3rdparty/freetype/src/base/ftinit.c +++ b/reactos/lib/3rdparty/freetype/src/base/ftinit.c @@ -23,8 +23,8 @@ /* FT_Add_Default_Modules(): */ /* This function is used to add the set of default modules to a */ /* fresh new library object. The set is taken from the header file */ - /* `config/ftmodule.h'. See the document `FreeType 2.0 Build */ - /* System' for more information. */ + /* `freetype/config/ftmodule.h'. See the document `FreeType 2.0 */ + /* Build System' for more information. */ /* */ /* FT_Init_FreeType(): */ /* This function creates a system object for the current platform, */ diff --git a/reactos/lib/3rdparty/freetype/src/base/ftmac.c b/reactos/lib/3rdparty/freetype/src/base/ftmac.c index 446a23a75c8..114bbb63919 100644 --- a/reactos/lib/3rdparty/freetype/src/base/ftmac.c +++ b/reactos/lib/3rdparty/freetype/src/base/ftmac.c @@ -618,11 +618,11 @@ total_size += 6; /* code + 4 bytes chunk length */ } - total_size += GetHandleSize( post_data ) - 2; + total_size += (FT_ULong)GetHandleSize( post_data ) - 2; last_code = code; - /* detect integer overflows */ - if ( total_size < old_total_size ) + /* detect resource fork overflow */ + if ( FT_MAC_RFORK_MAX_LEN < total_size ) { error = FT_THROW( Array_Too_Large ); goto Error; @@ -747,6 +747,11 @@ return FT_THROW( Invalid_Handle ); sfnt_size = (FT_ULong)GetHandleSize( sfnt ); + + /* detect resource fork overflow */ + if ( FT_MAC_RFORK_MAX_LEN < sfnt_size ) + return FT_THROW( Array_Too_Large ); + if ( FT_ALLOC( sfnt_data, (FT_Long)sfnt_size ) ) { ReleaseResource( sfnt ); diff --git a/reactos/lib/3rdparty/freetype/src/base/ftobjs.c b/reactos/lib/3rdparty/freetype/src/base/ftobjs.c index 9c3332cf3c8..f0c2e77fccf 100644 --- a/reactos/lib/3rdparty/freetype/src/base/ftobjs.c +++ b/reactos/lib/3rdparty/freetype/src/base/ftobjs.c @@ -1375,13 +1375,13 @@ } #ifdef FT_MACINTOSH - /* At this point, face_index has served its purpose; */ + /* At this point, the face index has served its purpose; */ /* whoever calls this function has already used it to */ /* locate the correct font data. We should not propagate */ /* this index to FT_Open_Face() (unless it is negative). */ if ( face_index > 0 ) - face_index = 0; + face_index &= 0x7FFF0000L; /* retain GX data */ #endif error = FT_Open_Face( library, &args, face_index, aface ); @@ -1495,6 +1495,10 @@ FT_UNUSED( params ); + /* ignore GX stuff */ + if ( face_index > 0 ) + face_index &= 0xFFFFL; + pos = FT_STREAM_POS(); error = ft_lookup_PS_in_sfnt_stream( stream, @@ -1512,8 +1516,10 @@ goto Exit; error = FT_Stream_Read( stream, (FT_Byte *)sfnt_ps, length ); - if ( error ) + if ( error ) { + FT_FREE( sfnt_ps ); goto Exit; + } error = open_face_from_buffer( library, sfnt_ps, @@ -1582,12 +1588,14 @@ /* FT2 allocator takes signed long buffer length, * too large value causing overflow should be checked */ - FT_TRACE4(( " POST fragment #%d: length=0x%08x\n", - i, temp)); - if ( 0x7FFFFFFFUL < temp || pfb_len + temp + 6 < pfb_len ) + FT_TRACE4(( " POST fragment #%d: length=0x%08x" + " total pfb_len=0x%08x\n", + i, temp, pfb_len + temp + 6)); + if ( FT_MAC_RFORK_MAX_LEN < temp || + FT_MAC_RFORK_MAX_LEN - temp < pfb_len + 6 ) { - FT_TRACE2(( " too long fragment length makes" - " pfb_len confused: temp=0x%08x\n", temp )); + FT_TRACE2(( " MacOS resource length cannot exceed" + " 0x%08x\n", FT_MAC_RFORK_MAX_LEN )); error = FT_THROW( Invalid_Offset ); goto Exit; } @@ -1660,7 +1668,7 @@ else { FT_TRACE3(( " Write POST fragment #%d header (4-byte) to buffer" - " 0x%p + 0x%08x\n", i, pfb_data, pfb_lenpos )); + " %p + 0x%08x\n", i, pfb_data, pfb_lenpos )); if ( pfb_lenpos + 3 > pfb_len + 2 ) goto Exit2; pfb_data[pfb_lenpos ] = (FT_Byte)( len ); @@ -1672,7 +1680,7 @@ break; FT_TRACE3(( " Write POST fragment #%d header (6-byte) to buffer" - " 0x%p + 0x%08x\n", i, pfb_data, pfb_pos )); + " %p + 0x%08x\n", i, pfb_data, pfb_pos )); if ( pfb_pos + 6 > pfb_len + 2 ) goto Exit2; pfb_data[pfb_pos++] = 0x80; @@ -1692,7 +1700,7 @@ goto Exit2; FT_TRACE3(( " Load POST fragment #%d (%d byte) to buffer" - " 0x%p + 0x%08x\n", i, rlen, pfb_data, pfb_pos )); + " %p + 0x%08x\n", i, rlen, pfb_data, pfb_pos )); error = FT_Stream_Read( stream, (FT_Byte *)pfb_data + pfb_pos, rlen ); if ( error ) goto Exit2; @@ -1737,7 +1745,7 @@ /* The resource header says we've got resource_cnt `sfnt' */ /* (TrueType/OpenType) resources in this file. Look through */ /* them for the one indicated by face_index, load it into mem, */ - /* pass it on the the truetype driver and return it. */ + /* pass it on to the truetype driver, and return it. */ /* */ static FT_Error Mac_Read_sfnt_Resource( FT_Library library, @@ -1770,6 +1778,8 @@ goto Exit; if ( rlen == -1 ) return FT_THROW( Cannot_Open_Resource ); + if ( (FT_ULong)rlen > FT_MAC_RFORK_MAX_LEN ) + return FT_THROW( Invalid_Offset ); error = open_face_PS_from_sfnt_stream( library, stream, @@ -1786,8 +1796,10 @@ if ( FT_ALLOC( sfnt_data, rlen ) ) return error; error = FT_Stream_Read( stream, (FT_Byte *)sfnt_data, (FT_ULong)rlen ); - if ( error ) + if ( error ) { + FT_FREE( sfnt_data ); goto Exit; + } is_cff = rlen > 4 && !ft_memcmp( sfnt_data, "OTTO", 4 ); error = open_face_from_buffer( library, @@ -1889,13 +1901,14 @@ if ( error ) goto Exit; - if ( header[ 0] != 0 || - header[74] != 0 || - header[82] != 0 || - header[ 1] == 0 || - header[ 1] > 33 || - header[63] != 0 || - header[2 + header[1]] != 0 ) + if ( header[ 0] != 0 || + header[74] != 0 || + header[82] != 0 || + header[ 1] == 0 || + header[ 1] > 33 || + header[63] != 0 || + header[2 + header[1]] != 0 || + header[0x53] > 0x7F ) return FT_THROW( Unknown_File_Format ); dlen = ( header[0x53] << 24 ) | @@ -2032,7 +2045,11 @@ #undef FT_COMPONENT #define FT_COMPONENT trace_raccess - FT_TRACE3(( "Try as dfont: %s ...", args->pathname )); +#ifdef FT_DEBUG_LEVEL_TRACE + FT_TRACE3(( "Try as dfont: " )); + if ( !( args->flags & FT_OPEN_MEMORY ) ) + FT_TRACE3(( "%s ...", args->pathname )); +#endif error = IsMacResource( library, stream, 0, face_index, aface ); @@ -3068,18 +3085,37 @@ if ( kern_mode != FT_KERNING_UNFITTED ) { + FT_Pos orig_x = akerning->x; + FT_Pos orig_y = akerning->y; + + /* we scale down kerning values for small ppem values */ /* to avoid that rounding makes them too big. */ /* `25' has been determined heuristically. */ if ( face->size->metrics.x_ppem < 25 ) - akerning->x = FT_MulDiv( akerning->x, + akerning->x = FT_MulDiv( orig_x, face->size->metrics.x_ppem, 25 ); if ( face->size->metrics.y_ppem < 25 ) - akerning->y = FT_MulDiv( akerning->y, + akerning->y = FT_MulDiv( orig_y, face->size->metrics.y_ppem, 25 ); akerning->x = FT_PIX_ROUND( akerning->x ); akerning->y = FT_PIX_ROUND( akerning->y ); + +#ifdef FT_DEBUG_LEVEL_TRACE + { + FT_Pos orig_x_rounded = FT_PIX_ROUND( orig_x ); + FT_Pos orig_y_rounded = FT_PIX_ROUND( orig_y ); + + + if ( akerning->x != orig_x_rounded || + akerning->y != orig_y_rounded ) + FT_TRACE5(( "FT_Get_Kerning: horizontal kerning" + " (%d, %d) scaled down to (%d, %d) pixels\n", + orig_x_rounded / 64, orig_y_rounded / 64, + akerning->x / 64, akerning->y / 64 )); + } +#endif } } } @@ -3350,8 +3386,12 @@ FT_TRACE1(( "FT_Get_Char_Index: too large charcode" )); FT_TRACE1(( " 0x%x is truncated\n", charcode )); } + result = cmap->clazz->char_index( cmap, (FT_UInt32)charcode ); + if ( result >= (FT_UInt)face->num_glyphs ) + result = 0; } + return result; } @@ -3370,7 +3410,7 @@ if ( face && face->charmap && face->num_glyphs ) { gindex = FT_Get_Char_Index( face, 0 ); - if ( gindex == 0 || gindex >= (FT_UInt)face->num_glyphs ) + if ( gindex == 0 ) result = FT_Get_Next_Char( face, 0, &gindex ); } diff --git a/reactos/lib/3rdparty/freetype/src/base/ftoutln.c b/reactos/lib/3rdparty/freetype/src/base/ftoutln.c index d821c495719..35cc9f55692 100644 --- a/reactos/lib/3rdparty/freetype/src/base/ftoutln.c +++ b/reactos/lib/3rdparty/freetype/src/base/ftoutln.c @@ -52,8 +52,9 @@ const FT_Outline_Funcs* func_interface, void* user ) { -#undef SCALED -#define SCALED( x ) ( ( (x) << shift ) - delta ) +#undef SCALED +#define SCALED( x ) ( ( (x) < 0 ? -( -(x) << shift ) \ + : ( (x) << shift ) ) - delta ) FT_Vector v_last; FT_Vector v_control; @@ -907,8 +908,7 @@ FT_Pos ystrength ) { FT_Vector* points; - FT_Vector v_prev, v_first, v_next, v_cur; - FT_Int c, n, first; + FT_Int c, first, last; FT_Int orientation; @@ -934,87 +934,95 @@ first = 0; for ( c = 0; c < outline->n_contours; c++ ) { - FT_Vector in, out, shift; - FT_Fixed l_in, l_out, l, q, d; - int last = outline->contours[c]; + FT_Vector in, out, anchor, shift; + FT_Fixed l_in, l_out, l_anchor = 0, l, q, d; + FT_Int i, j, k; - v_first = points[first]; - v_prev = points[last]; - v_cur = v_first; + l_in = 0; + last = outline->contours[c]; - /* compute incoming normalized vector */ - in.x = v_cur.x - v_prev.x; - in.y = v_cur.y - v_prev.y; - l_in = FT_Vector_Length( &in ); - if ( l_in ) + /* 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; + j != i && i != k; + j = j < last ? j + 1 : first ) { - in.x = FT_DivFix( in.x, l_in ); - in.y = FT_DivFix( in.y, l_in ); - } - - for ( n = first; n <= last; n++ ) - { - if ( n < last ) - v_next = points[n + 1]; - else - v_next = v_first; - - /* compute outgoing normalized vector */ - out.x = v_next.x - v_cur.x; - out.y = v_next.y - v_cur.y; - l_out = FT_Vector_Length( &out ); - if ( l_out ) + if ( j != k ) { - out.x = FT_DivFix( out.x, l_out ); - out.y = FT_DivFix( out.y, l_out ); - } + out.x = points[j].x - points[i].x; + out.y = points[j].y - points[i].y; + l_out = (FT_Fixed)FT_Vector_NormLen( &out ); - d = FT_MulFix( in.x, out.x ) + FT_MulFix( in.y, out.y ); - - /* shift only if turn is less than ~160 degrees */ - if ( d > -0xF000L ) - { - d = d + 0x10000L; - - /* shift components are aligned along lateral bisector */ - /* and directed according to the outline orientation. */ - shift.x = in.y + out.y; - shift.y = in.x + out.x; - - if ( orientation == FT_ORIENTATION_TRUETYPE ) - shift.x = -shift.x; - else - shift.y = -shift.y; - - /* restrict shift magnitude to better handle collapsing segments */ - q = FT_MulFix( out.x, in.y ) - FT_MulFix( out.y, in.x ); - if ( orientation == FT_ORIENTATION_TRUETYPE ) - q = -q; - - l = FT_MIN( l_in, l_out ); - - /* non-strict inequalities avoid divide-by-zero when q == l == 0 */ - if ( FT_MulFix( xstrength, q ) <= FT_MulFix( l, d ) ) - shift.x = FT_MulDiv( shift.x, xstrength, d ); - else - shift.x = FT_MulDiv( shift.x, l, q ); - - - if ( FT_MulFix( ystrength, q ) <= FT_MulFix( l, d ) ) - shift.y = FT_MulDiv( shift.y, ystrength, d ); - else - shift.y = FT_MulDiv( shift.y, l, q ); + if ( l_out == 0 ) + continue; } else - shift.x = shift.y = 0; + { + out = anchor; + l_out = l_anchor; + } - outline->points[n].x = v_cur.x + xstrength + shift.x; - outline->points[n].y = v_cur.y + ystrength + shift.y; + if ( l_in != 0 ) + { + if ( k < 0 ) + { + k = i; + anchor = in; + l_anchor = l_in; + } - in = out; - l_in = l_out; - v_cur = v_next; + d = FT_MulFix( in.x, out.x ) + FT_MulFix( in.y, out.y ); + + /* shift only if turn is less than ~160 degrees */ + if ( d > -0xF000L ) + { + d = d + 0x10000L; + + /* shift components along lateral bisector in proper orientation */ + shift.x = in.y + out.y; + shift.y = in.x + out.x; + + if ( orientation == FT_ORIENTATION_TRUETYPE ) + shift.x = -shift.x; + else + shift.y = -shift.y; + + /* restrict shift magnitude to better handle collapsing segments */ + q = FT_MulFix( out.x, in.y ) - FT_MulFix( out.y, in.x ); + if ( orientation == FT_ORIENTATION_TRUETYPE ) + q = -q; + + l = FT_MIN( l_in, l_out ); + + /* non-strict inequalities avoid divide-by-zero when q == l == 0 */ + if ( FT_MulFix( xstrength, q ) <= FT_MulFix( l, d ) ) + shift.x = FT_MulDiv( shift.x, xstrength, d ); + else + shift.x = FT_MulDiv( shift.x, l, q ); + + + if ( FT_MulFix( ystrength, q ) <= FT_MulFix( l, d ) ) + shift.y = FT_MulDiv( shift.y, ystrength, d ); + else + shift.y = FT_MulDiv( shift.y, l, q ); + } + else + shift.x = shift.y = 0; + + for ( ; + i != j; + i = i < last ? i + 1 : first ) + { + points[i].x += xstrength + shift.x; + points[i].y += ystrength + shift.y; + } + } + else + i = j; + + in = out; + l_in = l_out; } first = last + 1; diff --git a/reactos/lib/3rdparty/freetype/src/base/ftrfork.c b/reactos/lib/3rdparty/freetype/src/base/ftrfork.c index 82d54f83045..c30c76678e6 100644 --- a/reactos/lib/3rdparty/freetype/src/base/ftrfork.c +++ b/reactos/lib/3rdparty/freetype/src/base/ftrfork.c @@ -71,24 +71,35 @@ if ( error ) return error; - *rdata_pos = rfork_offset + ( ( head[0] << 24 ) | - ( head[1] << 16 ) | - ( head[2] << 8 ) | - head[3] ); - map_pos = rfork_offset + ( ( head[4] << 24 ) | - ( head[5] << 16 ) | - ( head[6] << 8 ) | - head[7] ); - rdata_len = ( head[ 8] << 24 ) | - ( head[ 9] << 16 ) | - ( head[10] << 8 ) | - head[11]; + /* ensure positive values */ + if ( head[0] >= 0x80 || head[4] >= 0x80 || head[8] >= 0x80 ) + return FT_THROW( Unknown_File_Format ); + + *rdata_pos = ( head[ 0] << 24 ) | + ( head[ 1] << 16 ) | + ( head[ 2] << 8 ) | + head[ 3]; + map_pos = ( head[ 4] << 24 ) | + ( head[ 5] << 16 ) | + ( head[ 6] << 8 ) | + head[ 7]; + rdata_len = ( head[ 8] << 24 ) | + ( head[ 9] << 16 ) | + ( head[10] << 8 ) | + head[11]; /* map_len = head[12] .. head[15] */ - if ( *rdata_pos + rdata_len != map_pos || map_pos == rfork_offset ) + if ( *rdata_pos != map_pos - rdata_len || map_pos == 0 ) return FT_THROW( Unknown_File_Format ); + if ( FT_LONG_MAX - rfork_offset < *rdata_pos || + FT_LONG_MAX - rfork_offset < map_pos ) + return FT_THROW( Unknown_File_Format ); + + *rdata_pos += rfork_offset; + map_pos += rfork_offset; + error = FT_Stream_Seek( stream, (FT_ULong)map_pos ); if ( error ) return error; diff --git a/reactos/lib/3rdparty/freetype/src/base/ftstroke.c b/reactos/lib/3rdparty/freetype/src/base/ftstroke.c index 842ee30b372..fecb3cc25c0 100644 --- a/reactos/lib/3rdparty/freetype/src/base/ftstroke.c +++ b/reactos/lib/3rdparty/freetype/src/base/ftstroke.c @@ -24,6 +24,16 @@ #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_OBJECTS_H +#include "basepic.h" + + + /* declare an extern to access `ft_outline_glyph_class' globally */ + /* allocated in `ftglyph.c', and use the FT_OUTLINE_GLYPH_CLASS_GET */ + /* macro to access it when FT_CONFIG_OPTION_PIC is defined */ +#ifndef FT_CONFIG_OPTION_PIC + FT_CALLBACK_TABLE const FT_Glyph_Class ft_outline_glyph_class; +#endif + /* documentation is in ftstroke.h */ @@ -2285,15 +2295,6 @@ } - /* declare an extern to access `ft_outline_glyph_class' globally */ - /* allocated in `ftglyph.c', and use the FT_OUTLINE_GLYPH_CLASS_GET */ - /* macro to access it when FT_CONFIG_OPTION_PIC is defined */ -#ifndef FT_CONFIG_OPTION_PIC - extern const FT_Glyph_Class ft_outline_glyph_class; -#endif -#include "basepic.h" - - /* documentation is in ftstroke.h */ FT_EXPORT_DEF( FT_Error ) diff --git a/reactos/lib/3rdparty/freetype/src/bdf/bdf.h b/reactos/lib/3rdparty/freetype/src/bdf/bdf.h index bd5a2e433a1..f24d925d8f4 100644 --- a/reactos/lib/3rdparty/freetype/src/bdf/bdf.h +++ b/reactos/lib/3rdparty/freetype/src/bdf/bdf.h @@ -40,12 +40,12 @@ FT_BEGIN_HEADER /* Imported from bdfP.h */ -#define _bdf_glyph_modified( map, e ) \ - ( (map)[(e) >> 5] & ( 1 << ( (e) & 31 ) ) ) -#define _bdf_set_glyph_modified( map, e ) \ - ( (map)[(e) >> 5] |= ( 1 << ( (e) & 31 ) ) ) -#define _bdf_clear_glyph_modified( map, e ) \ - ( (map)[(e) >> 5] &= ~( 1 << ( (e) & 31 ) ) ) +#define _bdf_glyph_modified( map, e ) \ + ( (map)[(e) >> 5] & ( 1UL << ( (e) & 31 ) ) ) +#define _bdf_set_glyph_modified( map, e ) \ + ( (map)[(e) >> 5] |= ( 1UL << ( (e) & 31 ) ) ) +#define _bdf_clear_glyph_modified( map, e ) \ + ( (map)[(e) >> 5] &= ~( 1UL << ( (e) & 31 ) ) ) /* end of bdfP.h */ diff --git a/reactos/lib/3rdparty/freetype/src/bdf/bdfdrivr.c b/reactos/lib/3rdparty/freetype/src/bdf/bdfdrivr.c index 4b3fb76649d..404af517e57 100644 --- a/reactos/lib/3rdparty/freetype/src/bdf/bdfdrivr.c +++ b/reactos/lib/3rdparty/freetype/src/bdf/bdfdrivr.c @@ -379,7 +379,8 @@ THE SOFTWARE. * an invalid argument error when the font could be * opened by the specified driver. */ - if ( face_index > 0 ) { + if ( face_index > 0 && ( face_index & 0xFFFF ) > 0 ) + { FT_ERROR(( "BDF_Face_Init: invalid face index\n" )); BDF_Face_Done( bdfface ); return FT_THROW( Invalid_Argument ); @@ -615,9 +616,9 @@ THE SOFTWARE. FT_Select_Metrics( size->face, strike_index ); - size->metrics.ascender = bdffont->font_ascent << 6; - size->metrics.descender = -bdffont->font_descent << 6; - size->metrics.max_advance = bdffont->bbx.width << 6; + size->metrics.ascender = bdffont->font_ascent * 64; + size->metrics.descender = -bdffont->font_descent * 64; + size->metrics.max_advance = bdffont->bbx.width * 64; return FT_Err_Ok; } @@ -734,18 +735,18 @@ THE SOFTWARE. slot->bitmap_left = glyph.bbx.x_offset; slot->bitmap_top = glyph.bbx.ascent; - slot->metrics.horiAdvance = (FT_Pos)( glyph.dwidth << 6 ); - slot->metrics.horiBearingX = (FT_Pos)( glyph.bbx.x_offset << 6 ); - slot->metrics.horiBearingY = (FT_Pos)( glyph.bbx.ascent << 6 ); - slot->metrics.width = (FT_Pos)( bitmap->width << 6 ); - slot->metrics.height = (FT_Pos)( bitmap->rows << 6 ); + slot->metrics.horiAdvance = (FT_Pos)( glyph.dwidth * 64 ); + slot->metrics.horiBearingX = (FT_Pos)( glyph.bbx.x_offset * 64 ); + slot->metrics.horiBearingY = (FT_Pos)( glyph.bbx.ascent * 64 ); + slot->metrics.width = (FT_Pos)( bitmap->width * 64 ); + slot->metrics.height = (FT_Pos)( bitmap->rows * 64 ); /* * XXX DWIDTH1 and VVECTOR should be parsed and * used here, provided such fonts do exist. */ ft_synthesize_vertical_metrics( &slot->metrics, - bdf->bdffont->bbx.height << 6 ); + bdf->bdffont->bbx.height * 64 ); Exit: return error; diff --git a/reactos/lib/3rdparty/freetype/src/bdf/bdflib.c b/reactos/lib/3rdparty/freetype/src/bdf/bdflib.c index 8655d0ed398..414deb58ad7 100644 --- a/reactos/lib/3rdparty/freetype/src/bdf/bdflib.c +++ b/reactos/lib/3rdparty/freetype/src/bdf/bdflib.c @@ -2346,30 +2346,23 @@ /* Check for the bits per pixel field. */ if ( p->list.used == 5 ) { - unsigned short bitcount, i, shift; + unsigned short bpp; - p->font->bpp = (unsigned short)_bdf_atos( p->list.field[4], 0, 10 ); + bpp = (unsigned short)_bdf_atos( p->list.field[4], 0, 10 ); - /* Only values 1, 2, 4, 8 are allowed. */ - shift = p->font->bpp; - bitcount = 0; - for ( i = 0; shift > 0; i++ ) - { - if ( shift & 1 ) - bitcount = i; - shift >>= 1; - } + /* Only values 1, 2, 4, 8 are allowed for greymap fonts. */ + if ( bpp > 4 ) + p->font->bpp = 8; + else if ( bpp > 2 ) + p->font->bpp = 4; + else if ( bpp > 1 ) + p->font->bpp = 2; + else + p->font->bpp = 1; - shift = (unsigned short)( ( bitcount > 3 ) ? 8 - : ( 1U << bitcount ) ); - - if ( p->font->bpp > shift || p->font->bpp != shift ) - { - /* select next higher value */ - p->font->bpp = (unsigned short)( shift << 1 ); + if ( p->font->bpp != bpp ) FT_TRACE2(( "_bdf_parse_start: " ACMSG11, p->font->bpp )); - } } else p->font->bpp = 1; diff --git a/reactos/lib/3rdparty/freetype/src/bzip2/ftbzip2.c b/reactos/lib/3rdparty/freetype/src/bzip2/ftbzip2.c index 4dfc9c8991c..cf947337628 100644 --- a/reactos/lib/3rdparty/freetype/src/bzip2/ftbzip2.c +++ b/reactos/lib/3rdparty/freetype/src/bzip2/ftbzip2.c @@ -254,7 +254,10 @@ size = stream->read( stream, stream->pos, zip->input, FT_BZIP2_BUFFER_SIZE ); if ( size == 0 ) + { + zip->limit = zip->cursor; return FT_THROW( Invalid_Stream_Operation ); + } } else { @@ -263,7 +266,10 @@ size = FT_BZIP2_BUFFER_SIZE; if ( size == 0 ) + { + zip->limit = zip->cursor; return FT_THROW( Invalid_Stream_Operation ); + } FT_MEM_COPY( zip->input, stream->base + stream->pos, size ); } @@ -310,7 +316,8 @@ } else if ( err != BZ_OK ) { - error = FT_THROW( Invalid_Stream_Operation ); + zip->limit = zip->cursor; + error = FT_THROW( Invalid_Stream_Operation ); break; } } @@ -437,16 +444,16 @@ } - static FT_ULong - ft_bzip2_stream_io( FT_Stream stream, - FT_ULong pos, - FT_Byte* buffer, - FT_ULong count ) + static unsigned long + ft_bzip2_stream_io( FT_Stream stream, + unsigned long offset, + unsigned char* buffer, + unsigned long count ) { FT_BZip2File zip = (FT_BZip2File)stream->descriptor.pointer; - return ft_bzip2_file_io( zip, pos, buffer, count ); + return ft_bzip2_file_io( zip, offset, buffer, count ); } diff --git a/reactos/lib/3rdparty/freetype/src/cff/cf2arrst.c b/reactos/lib/3rdparty/freetype/src/cff/cf2arrst.c index 528b1fa867f..89f3e9f1d74 100644 --- a/reactos/lib/3rdparty/freetype/src/cff/cf2arrst.c +++ b/reactos/lib/3rdparty/freetype/src/cff/cf2arrst.c @@ -104,7 +104,7 @@ size_t newSize = numElements * arrstack->sizeItem; - if ( numElements > LONG_MAX / arrstack->sizeItem ) + if ( numElements > FT_LONG_MAX / arrstack->sizeItem ) goto exit; diff --git a/reactos/lib/3rdparty/freetype/src/cff/cf2intrp.c b/reactos/lib/3rdparty/freetype/src/cff/cf2intrp.c index 265a16afc3c..ed481092969 100644 --- a/reactos/lib/3rdparty/freetype/src/cff/cf2intrp.c +++ b/reactos/lib/3rdparty/freetype/src/cff/cf2intrp.c @@ -1320,7 +1320,7 @@ /* if `cf2_stack_count' isn't of the form 4n or 4n+1, */ /* we enforce it by clearing the second bit */ /* (and sorting the stack indexing to suit) */ - count = count1 & ~2; + count = count1 & ~2U; index += count1 - count; FT_TRACE4(( " vvcurveto\n" )); @@ -1365,7 +1365,7 @@ /* if `cf2_stack_count' isn't of the form 4n or 4n+1, */ /* we enforce it by clearing the second bit */ /* (and sorting the stack indexing to suit) */ - count = count1 & ~2; + count = count1 & ~2U; index += count1 - count; FT_TRACE4(( " hhcurveto\n" )); @@ -1414,7 +1414,7 @@ /* 8n+4, or 8n+5, we enforce it by clearing the */ /* second bit */ /* (and sorting the stack indexing to suit) */ - count = count1 & ~2; + count = count1 & ~2U; index += count1 - count; FT_TRACE4(( alternate ? " hvcurveto\n" : " vhcurveto\n" )); diff --git a/reactos/lib/3rdparty/freetype/src/cff/cffgload.c b/reactos/lib/3rdparty/freetype/src/cff/cffgload.c index 43054f8c353..5f57403e22a 100644 --- a/reactos/lib/3rdparty/freetype/src/cff/cffgload.c +++ b/reactos/lib/3rdparty/freetype/src/cff/cffgload.c @@ -2949,7 +2949,6 @@ { FT_BBox cbox; FT_Glyph_Metrics* metrics = &glyph->root.metrics; - FT_Vector advance; FT_Bool has_vertical_info; @@ -3014,26 +3013,27 @@ glyph->root.outline.flags |= FT_OUTLINE_REVERSE_FILL; - if ( !( font_matrix.xx == 0x10000L && - font_matrix.yy == 0x10000L && - font_matrix.xy == 0 && - font_matrix.yx == 0 ) ) + /* apply the font matrix, if any */ + if ( font_matrix.xx != 0x10000L || font_matrix.yy != 0x10000L || + font_matrix.xy != 0 || font_matrix.yx != 0 ) + { FT_Outline_Transform( &glyph->root.outline, &font_matrix ); - if ( !( font_offset.x == 0 && - font_offset.y == 0 ) ) + metrics->horiAdvance = FT_MulFix( metrics->horiAdvance, + font_matrix.xx ); + metrics->vertAdvance = FT_MulFix( metrics->vertAdvance, + font_matrix.yy ); + } + + if ( font_offset.x || font_offset.y ) + { FT_Outline_Translate( &glyph->root.outline, - font_offset.x, font_offset.y ); + font_offset.x, + font_offset.y ); - advance.x = metrics->horiAdvance; - advance.y = 0; - FT_Vector_Transform( &advance, &font_matrix ); - metrics->horiAdvance = advance.x + font_offset.x; - - advance.x = 0; - advance.y = metrics->vertAdvance; - FT_Vector_Transform( &advance, &font_matrix ); - metrics->vertAdvance = advance.y + font_offset.y; + metrics->horiAdvance += font_offset.x; + metrics->vertAdvance += font_offset.y; + } if ( ( load_flags & FT_LOAD_NO_SCALE ) == 0 || force_scaling ) { @@ -3064,9 +3064,7 @@ metrics->width = cbox.xMax - cbox.xMin; metrics->height = cbox.yMax - cbox.yMin; - if ( !face->horizontal.number_Of_HMetrics ) - metrics->horiBearingX = cbox.xMin; - + metrics->horiBearingX = cbox.xMin; metrics->horiBearingY = cbox.yMax; if ( has_vertical_info ) diff --git a/reactos/lib/3rdparty/freetype/src/cff/cffload.c b/reactos/lib/3rdparty/freetype/src/cff/cffload.c index fcb7348e868..c61222d6519 100644 --- a/reactos/lib/3rdparty/freetype/src/cff/cffload.c +++ b/reactos/lib/3rdparty/freetype/src/cff/cffload.c @@ -1495,9 +1495,9 @@ if ( pure_cff ) { /* well, we don't really forget the `disabled' fonts... */ - subfont_index = (FT_UInt)face_index; + subfont_index = (FT_UInt)( face_index & 0xFFFF ); - if ( subfont_index >= font->name_index.count ) + if ( face_index > 0 && subfont_index >= font->name_index.count ) { FT_ERROR(( "cff_font_load:" " invalid subfont index for pure CFF font (%d)\n", diff --git a/reactos/lib/3rdparty/freetype/src/cff/cffobjs.c b/reactos/lib/3rdparty/freetype/src/cff/cffobjs.c index 4a1ef115fad..0e0d5b034b6 100644 --- a/reactos/lib/3rdparty/freetype/src/cff/cffobjs.c +++ b/reactos/lib/3rdparty/freetype/src/cff/cffobjs.c @@ -583,10 +583,15 @@ if ( error ) goto Exit; + /* if we are performing a simple font format check, exit immediately */ + /* (this is here for pure CFF) */ + if ( face_index < 0 ) + return FT_Err_Ok; + cff->pshinter = pshinter; cff->psnames = psnames; - cffface->face_index = face_index; + cffface->face_index = face_index & 0xFFFF; /* Complement the root flags with some interesting information. */ /* Note that this is only necessary for pure CFF and CEF fonts; */ @@ -629,7 +634,7 @@ if ( !dict->has_font_matrix ) dict->units_per_em = pure_cff ? 1000 : face->root.units_per_EM; - /* Normalize the font matrix so that `matrix->xx' is 1; the */ + /* Normalize the font matrix so that `matrix->yy' is 1; the */ /* scaling is done with `units_per_em' then (at this point, */ /* it already contains the scaling factor, but without */ /* normalization of the matrix). */ @@ -765,8 +770,9 @@ (FT_Short)( dict->underline_thickness >> 16 ); /* retrieve font family & style name */ - cffface->family_name = cff_index_get_name( cff, - (FT_UInt)face_index ); + cffface->family_name = cff_index_get_name( + cff, + (FT_UInt)( face_index & 0xFFFF ) ); if ( cffface->family_name ) { char* full = cff_index_get_sid_string( cff, diff --git a/reactos/lib/3rdparty/freetype/src/cff/cffpic.h b/reactos/lib/3rdparty/freetype/src/cff/cffpic.h index a29620e07f6..9a221a7b7ee 100644 --- a/reactos/lib/3rdparty/freetype/src/cff/cffpic.h +++ b/reactos/lib/3rdparty/freetype/src/cff/cffpic.h @@ -20,8 +20,6 @@ #define __CFFPIC_H__ -FT_BEGIN_HEADER - #include FT_INTERNAL_PIC_H @@ -49,6 +47,8 @@ FT_BEGIN_HEADER #include FT_SERVICE_PROPERTIES_H +FT_BEGIN_HEADER + typedef struct CffModulePIC_ { FT_ServiceDescRec* cff_services; @@ -96,12 +96,12 @@ FT_BEGIN_HEADER FT_Error cff_driver_class_pic_init( FT_Library library ); +FT_END_HEADER + #endif /* FT_CONFIG_OPTION_PIC */ /* */ -FT_END_HEADER - #endif /* __CFFPIC_H__ */ diff --git a/reactos/lib/3rdparty/freetype/src/cid/cidgload.c b/reactos/lib/3rdparty/freetype/src/cid/cidgload.c index 167d81fe833..8b15b8a241e 100644 --- a/reactos/lib/3rdparty/freetype/src/cid/cidgload.c +++ b/reactos/lib/3rdparty/freetype/src/cid/cidgload.c @@ -363,7 +363,6 @@ { FT_BBox cbox; FT_Glyph_Metrics* metrics = &cidglyph->metrics; - FT_Vector advance; /* copy the _unscaled_ advance width */ @@ -383,22 +382,27 @@ if ( cidsize->metrics.y_ppem < 24 ) cidglyph->outline.flags |= FT_OUTLINE_HIGH_PRECISION; - /* apply the font matrix */ - FT_Outline_Transform( &cidglyph->outline, &font_matrix ); + /* apply the font matrix, if any */ + if ( font_matrix.xx != 0x10000L || font_matrix.yy != 0x10000L || + font_matrix.xy != 0 || font_matrix.yx != 0 ) + { + FT_Outline_Transform( &cidglyph->outline, &font_matrix ); - FT_Outline_Translate( &cidglyph->outline, - font_offset.x, - font_offset.y ); + metrics->horiAdvance = FT_MulFix( metrics->horiAdvance, + font_matrix.xx ); + metrics->vertAdvance = FT_MulFix( metrics->vertAdvance, + font_matrix.yy ); + } - advance.x = metrics->horiAdvance; - advance.y = 0; - FT_Vector_Transform( &advance, &font_matrix ); - metrics->horiAdvance = advance.x + font_offset.x; + if ( font_offset.x || font_offset.y ) + { + FT_Outline_Translate( &cidglyph->outline, + font_offset.x, + font_offset.y ); - advance.x = 0; - advance.y = metrics->vertAdvance; - FT_Vector_Transform( &advance, &font_matrix ); - metrics->vertAdvance = advance.y + font_offset.y; + metrics->horiAdvance += font_offset.x; + metrics->vertAdvance += font_offset.y; + } if ( ( load_flags & FT_LOAD_NO_SCALE ) == 0 ) { diff --git a/reactos/lib/3rdparty/freetype/src/cid/cidload.c b/reactos/lib/3rdparty/freetype/src/cid/cidload.c index 6f3586055e7..e23b82f6738 100644 --- a/reactos/lib/3rdparty/freetype/src/cid/cidload.c +++ b/reactos/lib/3rdparty/freetype/src/cid/cidload.c @@ -167,6 +167,7 @@ matrix = &dict->font_matrix; offset = &dict->font_offset; + /* input is scaled by 1000 to accommodate default FontMatrix */ result = cid_parser_to_fixed_array( parser, 6, temp, 3 ); if ( result < 6 ) @@ -180,15 +181,12 @@ return FT_THROW( Invalid_File_Format ); } - /* Set Units per EM based on FontMatrix values. We set the value to */ - /* 1000 / temp_scale, because temp_scale was already multiplied by */ - /* 1000 (in t1_tofixed, from psobjs.c). */ - - root->units_per_EM = (FT_UShort)FT_DivFix( 1000, temp_scale ); - - /* we need to scale the values by 1.0/temp[3] */ + /* atypical case */ if ( temp_scale != 0x10000L ) { + /* set units per EM based on FontMatrix values */ + root->units_per_EM = (FT_UShort)FT_DivFix( 1000, temp_scale ); + temp[0] = FT_DivFix( temp[0], temp_scale ); temp[1] = FT_DivFix( temp[1], temp_scale ); temp[2] = FT_DivFix( temp[2], temp_scale ); diff --git a/reactos/lib/3rdparty/freetype/src/cid/cidobjs.c b/reactos/lib/3rdparty/freetype/src/cid/cidobjs.c index a3d6895c96a..bf1519bc6e7 100644 --- a/reactos/lib/3rdparty/freetype/src/cid/cidobjs.c +++ b/reactos/lib/3rdparty/freetype/src/cid/cidobjs.c @@ -334,7 +334,7 @@ /* check the face index */ /* XXX: handle CID fonts with more than a single face */ - if ( face_index != 0 ) + if ( ( face_index & 0xFFFF ) != 0 ) { FT_ERROR(( "cid_face_init: invalid face index\n" )); error = FT_THROW( Invalid_Argument ); @@ -354,7 +354,7 @@ cidface->num_glyphs = (FT_Long)cid->cid_count; cidface->num_charmaps = 0; - cidface->face_index = face_index; + cidface->face_index = face_index & 0xFFFF; cidface->face_flags |= FT_FACE_FLAG_SCALABLE | /* scalable outlines */ FT_FACE_FLAG_HORIZONTAL | /* horizontal data */ diff --git a/reactos/lib/3rdparty/freetype/src/gzip/ftgzip.c b/reactos/lib/3rdparty/freetype/src/gzip/ftgzip.c index 879eb88a705..422035c00b5 100644 --- a/reactos/lib/3rdparty/freetype/src/gzip/ftgzip.c +++ b/reactos/lib/3rdparty/freetype/src/gzip/ftgzip.c @@ -377,7 +377,10 @@ size = stream->read( stream, stream->pos, zip->input, FT_GZIP_BUFFER_SIZE ); if ( size == 0 ) + { + zip->limit = zip->cursor; return FT_THROW( Invalid_Stream_Operation ); + } } else { @@ -386,7 +389,10 @@ size = FT_GZIP_BUFFER_SIZE; if ( size == 0 ) + { + zip->limit = zip->cursor; return FT_THROW( Invalid_Stream_Operation ); + } FT_MEM_COPY( zip->input, stream->base + stream->pos, size ); } @@ -433,7 +439,8 @@ } else if ( err != Z_OK ) { - error = FT_THROW( Invalid_Stream_Operation ); + zip->limit = zip->cursor; + error = FT_THROW( Invalid_Stream_Operation ); break; } } @@ -557,19 +564,22 @@ stream->descriptor.pointer = NULL; } + + if ( !stream->read ) + FT_FREE( stream->base ); } - static FT_ULong - ft_gzip_stream_io( FT_Stream stream, - FT_ULong pos, - FT_Byte* buffer, - FT_ULong count ) + static unsigned long + ft_gzip_stream_io( FT_Stream stream, + unsigned long offset, + unsigned char* buffer, + unsigned long count ) { FT_GZipFile zip = (FT_GZipFile)stream->descriptor.pointer; - return ft_gzip_file_io( zip, pos, buffer, count ); + return ft_gzip_file_io( zip, offset, buffer, count ); } @@ -584,7 +594,7 @@ old_pos = stream->pos; if ( !FT_Stream_Seek( stream, stream->size - 4 ) ) { - result = FT_Stream_ReadULong( stream, &error ); + result = FT_Stream_ReadULongLE( stream, &error ); if ( error ) result = 0; @@ -685,7 +695,7 @@ stream->size = 0x7FFFFFFFL; /* don't know the real size! */ stream->pos = 0; - stream->base = 0; + stream->base = NULL; stream->read = ft_gzip_stream_io; stream->close = ft_gzip_stream_close; diff --git a/reactos/lib/3rdparty/freetype/src/lzw/ftlzw.c b/reactos/lib/3rdparty/freetype/src/lzw/ftlzw.c index 5664ff9cfdc..2f4e3b0f1d2 100644 --- a/reactos/lib/3rdparty/freetype/src/lzw/ftlzw.c +++ b/reactos/lib/3rdparty/freetype/src/lzw/ftlzw.c @@ -330,16 +330,16 @@ } - static FT_ULong - ft_lzw_stream_io( FT_Stream stream, - FT_ULong pos, - FT_Byte* buffer, - FT_ULong count ) + static unsigned long + ft_lzw_stream_io( FT_Stream stream, + unsigned long offset, + unsigned char* buffer, + unsigned long count ) { FT_LZWFile zip = (FT_LZWFile)stream->descriptor.pointer; - return ft_lzw_file_io( zip, pos, buffer, count ); + return ft_lzw_file_io( zip, offset, buffer, count ); } diff --git a/reactos/lib/3rdparty/freetype/src/pcf/pcfdrivr.c b/reactos/lib/3rdparty/freetype/src/pcf/pcfdrivr.c index 552049e9b9a..8d2ed7cf4db 100644 --- a/reactos/lib/3rdparty/freetype/src/pcf/pcfdrivr.c +++ b/reactos/lib/3rdparty/freetype/src/pcf/pcfdrivr.c @@ -345,13 +345,14 @@ THE SOFTWARE. #endif } - /* PCF could not have multiple face in single font file. - * XXX: non-zero face_index is already invalid argument, but - * Type1, Type42 driver has a convention to return + /* PCF cannot have multiple faces in a single font file. + * XXX: A non-zero face_index is already an invalid argument, but + * Type1, Type42 drivers have a convention to return * an invalid argument error when the font could be * opened by the specified driver. */ - if ( face_index > 0 ) { + if ( face_index > 0 && ( face_index & 0xFFFF ) > 0 ) + { FT_ERROR(( "PCF_Face_Init: invalid face index\n" )); PCF_Face_Done( pcfface ); return FT_THROW( Invalid_Argument ); @@ -430,9 +431,9 @@ THE SOFTWARE. FT_Select_Metrics( size->face, strike_index ); - size->metrics.ascender = accel->fontAscent << 6; - size->metrics.descender = -accel->fontDescent << 6; - size->metrics.max_advance = accel->maxbounds.characterWidth << 6; + size->metrics.ascender = accel->fontAscent * 64; + size->metrics.descender = -accel->fontDescent * 64; + size->metrics.max_advance = accel->maxbounds.characterWidth * 64; return FT_Err_Ok; } @@ -583,16 +584,16 @@ THE SOFTWARE. slot->bitmap_left = metric->leftSideBearing; slot->bitmap_top = metric->ascent; - slot->metrics.horiAdvance = (FT_Pos)( metric->characterWidth << 6 ); - slot->metrics.horiBearingX = (FT_Pos)( metric->leftSideBearing << 6 ); - slot->metrics.horiBearingY = (FT_Pos)( metric->ascent << 6 ); + slot->metrics.horiAdvance = (FT_Pos)( metric->characterWidth * 64 ); + slot->metrics.horiBearingX = (FT_Pos)( metric->leftSideBearing * 64 ); + slot->metrics.horiBearingY = (FT_Pos)( metric->ascent * 64 ); slot->metrics.width = (FT_Pos)( ( metric->rightSideBearing - - metric->leftSideBearing ) << 6 ); - slot->metrics.height = (FT_Pos)( bitmap->rows << 6 ); + metric->leftSideBearing ) * 64 ); + slot->metrics.height = (FT_Pos)( bitmap->rows * 64 ); ft_synthesize_vertical_metrics( &slot->metrics, ( face->accel.fontAscent + - face->accel.fontDescent ) << 6 ); + face->accel.fontDescent ) * 64 ); Exit: return error; diff --git a/reactos/lib/3rdparty/freetype/src/pcf/pcfread.c b/reactos/lib/3rdparty/freetype/src/pcf/pcfread.c index 039af33e901..afa14807711 100644 --- a/reactos/lib/3rdparty/freetype/src/pcf/pcfread.c +++ b/reactos/lib/3rdparty/freetype/src/pcf/pcfread.c @@ -1272,44 +1272,84 @@ THE SOFTWARE. FT_MEM_ZERO( bsize, sizeof ( FT_Bitmap_Size ) ); + /* for simplicity, we take absolute values of integer properties */ + #if 0 bsize->height = face->accel.maxbounds.ascent << 6; #endif - bsize->height = (FT_Short)( face->accel.fontAscent + - face->accel.fontDescent ); + +#ifdef FT_DEBUG_LEVEL_TRACE + if ( face->accel.fontAscent + face->accel.fontDescent < 0 ) + FT_TRACE0(( "pcf_load_font: negative height\n" )); +#endif + bsize->height = FT_ABS( (FT_Short)( face->accel.fontAscent + + face->accel.fontDescent ) ); prop = pcf_find_property( face, "AVERAGE_WIDTH" ); if ( prop ) - bsize->width = (FT_Short)( ( prop->value.l + 5 ) / 10 ); + { +#ifdef FT_DEBUG_LEVEL_TRACE + if ( prop->value.l < 0 ) + FT_TRACE0(( "pcf_load_font: negative average width\n" )); +#endif + bsize->width = FT_ABS( (FT_Short)( ( prop->value.l ) + 5 ) / 10 ); + } else - bsize->width = (FT_Short)( bsize->height * 2/3 ); + bsize->width = (FT_Short)FT_MulDiv( bsize->height, 2, 3 ); prop = pcf_find_property( face, "POINT_SIZE" ); if ( prop ) + { +#ifdef FT_DEBUG_LEVEL_TRACE + if ( prop->value.l < 0 ) + FT_TRACE0(( "pcf_load_font: negative point size\n" )); +#endif /* convert from 722.7 decipoints to 72 points per inch */ - bsize->size = - (FT_Pos)( ( prop->value.l * 64 * 7200 + 36135L ) / 72270L ); + bsize->size = FT_MulDiv( FT_ABS( prop->value.l ), + 64 * 7200, + 72270L ); + } prop = pcf_find_property( face, "PIXEL_SIZE" ); if ( prop ) - bsize->y_ppem = (FT_Short)prop->value.l << 6; + { +#ifdef FT_DEBUG_LEVEL_TRACE + if ( prop->value.l < 0 ) + FT_TRACE0(( "pcf_load_font: negative pixel size\n" )); +#endif + bsize->y_ppem = FT_ABS( (FT_Short)prop->value.l ) << 6; + } prop = pcf_find_property( face, "RESOLUTION_X" ); if ( prop ) - resolution_x = (FT_Short)prop->value.l; + { +#ifdef FT_DEBUG_LEVEL_TRACE + if ( prop->value.l < 0 ) + FT_TRACE0(( "pcf_load_font: negative X resolution\n" )); +#endif + resolution_x = FT_ABS( (FT_Short)prop->value.l ); + } prop = pcf_find_property( face, "RESOLUTION_Y" ); if ( prop ) - resolution_y = (FT_Short)prop->value.l; + { +#ifdef FT_DEBUG_LEVEL_TRACE + if ( prop->value.l < 0 ) + FT_TRACE0(( "pcf_load_font: negative Y resolution\n" )); +#endif + resolution_y = FT_ABS( (FT_Short)prop->value.l ); + } if ( bsize->y_ppem == 0 ) { bsize->y_ppem = bsize->size; if ( resolution_y ) - bsize->y_ppem = bsize->y_ppem * resolution_y / 72; + bsize->y_ppem = FT_MulDiv( bsize->y_ppem, resolution_y, 72 ); } if ( resolution_x && resolution_y ) - bsize->x_ppem = bsize->y_ppem * resolution_x / resolution_y; + bsize->x_ppem = FT_MulDiv( bsize->y_ppem, + resolution_x, + resolution_y ); else bsize->x_ppem = bsize->y_ppem; } diff --git a/reactos/lib/3rdparty/freetype/src/pfr/pfrgload.c b/reactos/lib/3rdparty/freetype/src/pfr/pfrgload.c index 1cd13c2024e..88df06a03d9 100644 --- a/reactos/lib/3rdparty/freetype/src/pfr/pfrgload.c +++ b/reactos/lib/3rdparty/freetype/src/pfr/pfrgload.c @@ -632,14 +632,14 @@ if ( format & PFR_SUBGLYPH_XSCALE ) { PFR_CHECK( 2 ); - subglyph->x_scale = PFR_NEXT_SHORT( p ) << 4; + subglyph->x_scale = PFR_NEXT_SHORT( p ) * 16; } subglyph->y_scale = 0x10000L; if ( format & PFR_SUBGLYPH_YSCALE ) { PFR_CHECK( 2 ); - subglyph->y_scale = PFR_NEXT_SHORT( p ) << 4; + subglyph->y_scale = PFR_NEXT_SHORT( p ) * 16; } /* read offset */ diff --git a/reactos/lib/3rdparty/freetype/src/pfr/pfrobjs.c b/reactos/lib/3rdparty/freetype/src/pfr/pfrobjs.c index aababf4a2ed..b854b00ba83 100644 --- a/reactos/lib/3rdparty/freetype/src/pfr/pfrobjs.c +++ b/reactos/lib/3rdparty/freetype/src/pfr/pfrobjs.c @@ -109,7 +109,7 @@ if ( face_index < 0 ) goto Exit; - if ( face_index >= pfrface->num_faces ) + if ( ( face_index & 0xFFFF ) >= pfrface->num_faces ) { FT_ERROR(( "pfr_face_init: invalid face index\n" )); error = FT_THROW( Invalid_Argument ); @@ -118,7 +118,7 @@ /* load the face */ error = pfr_log_font_load( - &face->log_font, stream, (FT_UInt)face_index, + &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 ) @@ -136,7 +136,7 @@ PFR_PhyFont phy_font = &face->phy_font; - pfrface->face_index = face_index; + pfrface->face_index = face_index & 0xFFFF; pfrface->num_glyphs = (FT_Long)phy_font->num_chars + 1; pfrface->face_flags |= FT_FACE_FLAG_SCALABLE; diff --git a/reactos/lib/3rdparty/freetype/src/psaux/psobjs.c b/reactos/lib/3rdparty/freetype/src/psaux/psobjs.c index c7cbc67c67a..1d3c7e662ce 100644 --- a/reactos/lib/3rdparty/freetype/src/psaux/psobjs.c +++ b/reactos/lib/3rdparty/freetype/src/psaux/psobjs.c @@ -594,6 +594,9 @@ error = FT_THROW( Invalid_File_Format ); } + if ( cur > limit ) + cur = limit; + parser->error = error; parser->cursor = cur; } @@ -1229,15 +1232,17 @@ if ( result < 0 || (FT_UInt)result < max_objects ) { FT_ERROR(( "ps_parser_load_field:" - " expected %d integers in the %s subarray\n" + " expected %d integer%s in the %s subarray\n" " " " of /FontBBox in the /Blend dictionary\n", - max_objects, + max_objects, max_objects > 1 ? "s" : "", i == 0 ? "first" : ( i == 1 ? "second" : ( i == 2 ? "third" : "fourth" ) ) )); error = FT_THROW( Invalid_File_Format ); + + FT_FREE( temp ); goto Exit; } diff --git a/reactos/lib/3rdparty/freetype/src/pshinter/pshalgo.c b/reactos/lib/3rdparty/freetype/src/pshinter/pshalgo.c index bfdb3ed02ac..6e654cb1ef8 100644 --- a/reactos/lib/3rdparty/freetype/src/pshinter/pshalgo.c +++ b/reactos/lib/3rdparty/freetype/src/pshinter/pshalgo.c @@ -916,103 +916,9 @@ /*************************************************************************/ /*************************************************************************/ -#if 1 - #define psh_corner_is_flat ft_corner_is_flat #define psh_corner_orientation ft_corner_orientation -#else - - FT_LOCAL_DEF( FT_Int ) - psh_corner_is_flat( FT_Pos x_in, - FT_Pos y_in, - FT_Pos x_out, - FT_Pos y_out ) - { - FT_Pos ax = x_in; - FT_Pos ay = y_in; - - FT_Pos d_in, d_out, d_corner; - - - if ( ax < 0 ) - ax = -ax; - if ( ay < 0 ) - ay = -ay; - d_in = ax + ay; - - ax = x_out; - if ( ax < 0 ) - ax = -ax; - ay = y_out; - if ( ay < 0 ) - ay = -ay; - d_out = ax + ay; - - ax = x_out + x_in; - if ( ax < 0 ) - ax = -ax; - ay = y_out + y_in; - if ( ay < 0 ) - ay = -ay; - d_corner = ax + ay; - - return ( d_in + d_out - d_corner ) < ( d_corner >> 4 ); - } - - static FT_Int - psh_corner_orientation( FT_Pos in_x, - FT_Pos in_y, - FT_Pos out_x, - FT_Pos out_y ) - { - FT_Int result; - - - /* deal with the trivial cases quickly */ - if ( in_y == 0 ) - { - if ( in_x >= 0 ) - result = out_y; - else - result = -out_y; - } - else if ( in_x == 0 ) - { - if ( in_y >= 0 ) - result = -out_x; - else - result = out_x; - } - else if ( out_y == 0 ) - { - if ( out_x >= 0 ) - result = in_y; - else - result = -in_y; - } - else if ( out_x == 0 ) - { - if ( out_y >= 0 ) - result = -in_x; - else - result = in_x; - } - else /* general case */ - { - long long delta = (long long)in_x * out_y - (long long)in_y * out_x; - - if ( delta == 0 ) - result = 0; - else - result = 1 - 2 * ( delta < 0 ); - } - - return result; - } - -#endif /* !1 */ - #ifdef COMPUTE_INFLEXS diff --git a/reactos/lib/3rdparty/freetype/src/pshinter/pshglob.c b/reactos/lib/3rdparty/freetype/src/pshinter/pshglob.c index 6723b717e8c..4616bdc6cf3 100644 --- a/reactos/lib/3rdparty/freetype/src/pshinter/pshglob.c +++ b/reactos/lib/3rdparty/freetype/src/pshinter/pshglob.c @@ -339,7 +339,7 @@ bot = zone[1].org_bottom; delta = bot - top; - if ( delta < 2 * fuzz ) + if ( delta / 2 < fuzz ) zone[0].org_top = zone[1].org_bottom = top + delta / 2; else { diff --git a/reactos/lib/3rdparty/freetype/src/pshinter/pshpic.h b/reactos/lib/3rdparty/freetype/src/pshinter/pshpic.h index 62de4574f9d..ca35cd6fa9f 100644 --- a/reactos/lib/3rdparty/freetype/src/pshinter/pshpic.h +++ b/reactos/lib/3rdparty/freetype/src/pshinter/pshpic.h @@ -20,8 +20,6 @@ #define __PSHPIC_H__ -FT_BEGIN_HEADER - #include FT_INTERNAL_PIC_H @@ -33,6 +31,8 @@ FT_BEGIN_HEADER #include FT_INTERNAL_POSTSCRIPT_HINTS_H +FT_BEGIN_HEADER + typedef struct PSHinterPIC_ { PSHinter_Interface pshinter_interface; @@ -51,12 +51,12 @@ FT_BEGIN_HEADER FT_Error pshinter_module_class_pic_init( FT_Library library ); +FT_END_HEADER + #endif /* FT_CONFIG_OPTION_PIC */ /* */ -FT_END_HEADER - #endif /* __PSHPIC_H__ */ diff --git a/reactos/lib/3rdparty/freetype/src/psnames/pspic.h b/reactos/lib/3rdparty/freetype/src/psnames/pspic.h index 88ccda3a5c2..443225af615 100644 --- a/reactos/lib/3rdparty/freetype/src/psnames/pspic.h +++ b/reactos/lib/3rdparty/freetype/src/psnames/pspic.h @@ -20,10 +20,9 @@ #define __PSPIC_H__ -FT_BEGIN_HEADER - #include FT_INTERNAL_PIC_H + #ifndef FT_CONFIG_OPTION_PIC #define PSCMAPS_SERVICES_GET pscmaps_services @@ -33,6 +32,9 @@ FT_BEGIN_HEADER #include FT_SERVICE_POSTSCRIPT_CMAPS_H + +FT_BEGIN_HEADER + typedef struct PSModulePIC_ { FT_ServiceDescRec* pscmaps_services; @@ -54,12 +56,12 @@ FT_BEGIN_HEADER FT_Error psnames_module_class_pic_init( FT_Library library ); +FT_END_HEADER + #endif /* FT_CONFIG_OPTION_PIC */ /* */ -FT_END_HEADER - #endif /* __PSPIC_H__ */ diff --git a/reactos/lib/3rdparty/freetype/src/raster/ftmisc.h b/reactos/lib/3rdparty/freetype/src/raster/ftmisc.h index 19be4cadcc8..b87e0b62b72 100644 --- a/reactos/lib/3rdparty/freetype/src/raster/ftmisc.h +++ b/reactos/lib/3rdparty/freetype/src/raster/ftmisc.h @@ -37,7 +37,7 @@ #define FT_LOCAL_DEF( x ) static x - /* from include/freetype2/fttypes.h */ + /* from include/freetype/fttypes.h */ typedef unsigned char FT_Byte; typedef signed int FT_Int; @@ -54,7 +54,7 @@ (FT_ULong)_x4 ) - /* from include/freetype2/ftsystem.h */ + /* from include/freetype/ftsystem.h */ typedef struct FT_MemoryRec_* FT_Memory; diff --git a/reactos/lib/3rdparty/freetype/src/raster/ftraster.c b/reactos/lib/3rdparty/freetype/src/raster/ftraster.c index 8823fc01bd0..fdd206d9ae5 100644 --- a/reactos/lib/3rdparty/freetype/src/raster/ftraster.c +++ b/reactos/lib/3rdparty/freetype/src/raster/ftraster.c @@ -24,8 +24,8 @@ /* */ /* - copy `src/raster/ftraster.c' (this file) to your current directory */ /* */ - /* - copy `include/ftimage.h' and `src/raster/ftmisc.h' to your current */ - /* directory */ + /* - copy `include/freetype/ftimage.h' and `src/raster/ftmisc.h' to your */ + /* current directory */ /* */ /* - compile `ftraster' with the _STANDALONE_ macro defined, as in */ /* */ @@ -450,7 +450,9 @@ #define CEILING( x ) ( ( (x) + ras.precision - 1 ) & -ras.precision ) #define TRUNC( x ) ( (Long)(x) >> ras.precision_bits ) #define FRAC( x ) ( (x) & ( ras.precision - 1 ) ) -#define SCALED( x ) ( ( (Long)(x) << ras.scale_shift ) - ras.precision_half ) +#define SCALED( x ) ( ( (x) < 0 ? -( -(x) << ras.scale_shift ) \ + : ( (x) << ras.scale_shift ) ) \ + - ras.precision_half ) #define IS_BOTTOM_OVERSHOOT( x ) \ (Bool)( CEILING( x ) - x >= ras.precision_half ) @@ -799,15 +801,14 @@ /* if it is <, simply insert it, ignore if == */ if ( n >= 0 && y > y_turns[n] ) - while ( n >= 0 ) + do { Int y2 = (Int)y_turns[n]; y_turns[n] = y; y = y2; - n--; - } + } while ( --n >= 0 ); if ( n < 0 ) { @@ -848,7 +849,7 @@ if ( n > 1 && p ) { - while ( n > 0 ) + do { Int bottom, top; @@ -876,8 +877,7 @@ return FAILURE; p = p->link; - n--; - } + } while ( --n ); } else ras.fProfile = NULL; @@ -1248,7 +1248,7 @@ start_arc = arc; - while ( arc >= start_arc && e <= e2 ) + do { ras.joint = FALSE; @@ -1281,7 +1281,7 @@ } arc -= degree; } - } + } while ( arc >= start_arc && e <= e2 ); Fin: ras.top = top; @@ -2114,7 +2114,7 @@ while ( current ) { current->X = *current->offset; - current->offset += current->flags & Flow_Up ? 1 : -1; + current->offset += ( current->flags & Flow_Up ) ? 1 : -1; current->height--; current = current->link; } diff --git a/reactos/lib/3rdparty/freetype/src/raster/ftrend1.h b/reactos/lib/3rdparty/freetype/src/raster/ftrend1.h index c367260b1b3..edc5d13f4cd 100644 --- a/reactos/lib/3rdparty/freetype/src/raster/ftrend1.h +++ b/reactos/lib/3rdparty/freetype/src/raster/ftrend1.h @@ -29,12 +29,6 @@ FT_BEGIN_HEADER FT_DECLARE_RENDERER( ft_raster1_renderer_class ) - /* this renderer is _NOT_ part of the default modules, you'll need */ - /* to register it by hand in your application. It should only be */ - /* used for backwards-compatibility with FT 1.x anyway. */ - /* */ - FT_DECLARE_RENDERER( ft_raster5_renderer_class ) - FT_END_HEADER diff --git a/reactos/lib/3rdparty/freetype/src/raster/rastpic.c b/reactos/lib/3rdparty/freetype/src/raster/rastpic.c index fe58c99376c..77e7ec3f903 100644 --- a/reactos/lib/3rdparty/freetype/src/raster/rastpic.c +++ b/reactos/lib/3rdparty/freetype/src/raster/rastpic.c @@ -59,8 +59,9 @@ FT_Memory memory = library->memory; - /* since this function also serves raster5 renderer, */ - /* it implements reference counting */ + /* XXX: since this function also served the no longer available */ + /* raster5 renderer it uses reference counting, which could */ + /* be removed now */ if ( pic_container->raster ) { ((RasterPIC*)pic_container->raster)->ref_count++; @@ -82,21 +83,6 @@ return error; } - - /* re-route these init and free functions to the above functions */ - FT_Error - ft_raster5_renderer_class_pic_init( FT_Library library ) - { - return ft_raster1_renderer_class_pic_init( library ); - } - - - void - ft_raster5_renderer_class_pic_free( FT_Library library ) - { - ft_raster1_renderer_class_pic_free( library ); - } - #endif /* FT_CONFIG_OPTION_PIC */ diff --git a/reactos/lib/3rdparty/freetype/src/raster/rastpic.h b/reactos/lib/3rdparty/freetype/src/raster/rastpic.h index a875884d986..408996a9089 100644 --- a/reactos/lib/3rdparty/freetype/src/raster/rastpic.h +++ b/reactos/lib/3rdparty/freetype/src/raster/rastpic.h @@ -20,11 +20,11 @@ #define __RASTPIC_H__ -FT_BEGIN_HEADER - #include FT_INTERNAL_PIC_H +FT_BEGIN_HEADER + #ifndef FT_CONFIG_OPTION_PIC #define FT_STANDARD_RASTER_GET ft_standard_raster @@ -48,15 +48,9 @@ FT_BEGIN_HEADER void ft_raster1_renderer_class_pic_free( FT_Library library ); - void - ft_raster5_renderer_class_pic_free( FT_Library library ); - FT_Error ft_raster1_renderer_class_pic_init( FT_Library library ); - FT_Error - ft_raster5_renderer_class_pic_init( FT_Library library ); - #endif /* FT_CONFIG_OPTION_PIC */ /* */ diff --git a/reactos/lib/3rdparty/freetype/src/sfnt/sfdriver.c b/reactos/lib/3rdparty/freetype/src/sfnt/sfdriver.c index 0948ad4e7ed..6a3f0d99333 100644 --- a/reactos/lib/3rdparty/freetype/src/sfnt/sfdriver.c +++ b/reactos/lib/3rdparty/freetype/src/sfnt/sfdriver.c @@ -505,7 +505,9 @@ PUT_EMBEDDED_BITMAPS( tt_face_set_sbit_strike ), PUT_EMBEDDED_BITMAPS( tt_face_load_strike_metrics ), - tt_face_get_metrics + tt_face_get_metrics, + + tt_face_get_name ) diff --git a/reactos/lib/3rdparty/freetype/src/sfnt/sfntpic.h b/reactos/lib/3rdparty/freetype/src/sfnt/sfntpic.h index 563d6344d65..d99be6a8248 100644 --- a/reactos/lib/3rdparty/freetype/src/sfnt/sfntpic.h +++ b/reactos/lib/3rdparty/freetype/src/sfnt/sfntpic.h @@ -20,8 +20,6 @@ #define __SFNTPIC_H__ -FT_BEGIN_HEADER - #include FT_INTERNAL_PIC_H @@ -31,7 +29,6 @@ FT_BEGIN_HEADER #define SFNT_SERVICE_GLYPH_DICT_GET sfnt_service_glyph_dict #define SFNT_SERVICE_PS_NAME_GET sfnt_service_ps_name #define TT_SERVICE_CMAP_INFO_GET tt_service_get_cmap_info -#define SFNT_SERVICES_GET sfnt_services #define TT_CMAP_CLASSES_GET tt_cmap_classes #define SFNT_SERVICE_SFNT_TABLE_GET sfnt_service_sfnt_table #define SFNT_SERVICE_BDF_GET sfnt_service_bdf @@ -56,6 +53,8 @@ FT_BEGIN_HEADER #include "ttcmap.h" +FT_BEGIN_HEADER + typedef struct sfntModulePIC_ { FT_ServiceDescRec* sfnt_services; @@ -83,8 +82,6 @@ FT_BEGIN_HEADER ( GET_PIC( library )->sfnt_service_ps_name ) #define TT_SERVICE_CMAP_INFO_GET \ ( GET_PIC( library )->tt_service_get_cmap_info ) -#define SFNT_SERVICES_GET \ - ( GET_PIC( library )->sfnt_services ) #define TT_CMAP_CLASSES_GET \ ( GET_PIC( library )->tt_cmap_classes ) #define SFNT_SERVICE_SFNT_TABLE_GET \ @@ -102,12 +99,13 @@ FT_BEGIN_HEADER FT_Error sfnt_module_class_pic_init( FT_Library library ); + +FT_END_HEADER + #endif /* FT_CONFIG_OPTION_PIC */ /* */ -FT_END_HEADER - #endif /* __SFNTPIC_H__ */ diff --git a/reactos/lib/3rdparty/freetype/src/sfnt/sfobjs.c b/reactos/lib/3rdparty/freetype/src/sfnt/sfobjs.c index 40c27fa9ad6..14d3adef212 100644 --- a/reactos/lib/3rdparty/freetype/src/sfnt/sfobjs.c +++ b/reactos/lib/3rdparty/freetype/src/sfnt/sfobjs.c @@ -120,27 +120,9 @@ FT_Memory memory ); - /*************************************************************************/ - /* */ - /* <Function> */ - /* tt_face_get_name */ - /* */ - /* <Description> */ - /* Returns a given ENGLISH name record in ASCII. */ - /* */ - /* <Input> */ - /* face :: A handle to the source face object. */ - /* */ - /* nameid :: The name id of the name record to return. */ - /* */ - /* <InOut> */ - /* name :: The address of a string pointer. NULL if no name is */ - /* present. */ - /* */ - /* <Return> */ - /* FreeType error code. 0 means success. */ - /* */ - static FT_Error + /* documentation is in sfnt.h */ + + FT_LOCAL_DEF( FT_Error ) tt_face_get_name( TT_Face face, FT_UShort nameid, FT_String** name ) @@ -839,13 +821,14 @@ FT_LOCAL_DEF( FT_Error ) sfnt_init_face( FT_Stream stream, TT_Face face, - FT_Int face_index, + FT_Int face_instance_index, FT_Int num_params, FT_Parameter* params ) { - FT_Error error; - FT_Library library = face->root.driver->root.library; - SFNT_Service sfnt; + FT_Error error; + FT_Library library = face->root.driver->root.library; + SFNT_Service sfnt; + FT_Int face_index; /* for now, parameters are unused */ @@ -878,22 +861,65 @@ /* Stream may have changed in sfnt_open_font. */ stream = face->root.stream; - FT_TRACE2(( "sfnt_init_face: %08p, %ld\n", face, face_index )); + FT_TRACE2(( "sfnt_init_face: %08p, %ld\n", face, face_instance_index )); - if ( face_index < 0 ) - face_index = 0; + face_index = FT_ABS( face_instance_index ) & 0xFFFF; if ( face_index >= face->ttc_header.count ) - return FT_THROW( Invalid_Argument ); + { + if ( face_instance_index >= 0 ) + return FT_THROW( Invalid_Argument ); + else + face_index = 0; + } if ( FT_STREAM_SEEK( face->ttc_header.offsets[face_index] ) ) return error; - /* check that we have a valid TrueType file */ + /* check whether we have a valid TrueType file */ error = sfnt->load_font_dir( face, stream ); if ( error ) return error; +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT + { + FT_ULong fvar_len; + FT_UShort num_instances; + FT_Int instance_index; + + + instance_index = FT_ABS( face_instance_index ) >> 16; + + /* 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 ) ) + num_instances = 0; + + /* we support at most 2^15 - 1 instances */ + if ( num_instances >= ( 1U << 15 ) - 1 ) + { + if ( face_instance_index >= 0 ) + return FT_THROW( Invalid_Argument ); + else + num_instances = 0; + } + + /* instance indices in `face_instance_index' start with index 1, */ + /* thus `>' and not `>=' */ + if ( instance_index > num_instances ) + { + if ( face_instance_index >= 0 ) + return FT_THROW( Invalid_Argument ); + else + num_instances = 0; + } + + face->root.style_flags = (FT_Long)num_instances << 16; + } +#endif + face->root.num_faces = face->ttc_header.count; face->root.face_index = face_index; @@ -946,7 +972,7 @@ FT_LOCAL_DEF( FT_Error ) sfnt_load_face( FT_Stream stream, TT_Face face, - FT_Int face_index, + FT_Int face_instance_index, FT_Int num_params, FT_Parameter* params ) { @@ -962,7 +988,7 @@ SFNT_Service sfnt = (SFNT_Service)face->sfnt; - FT_UNUSED( face_index ); + FT_UNUSED( face_instance_index ); /* Check parameters */ @@ -1284,7 +1310,7 @@ flags |= FT_STYLE_FLAG_ITALIC; } - root->style_flags = flags; + root->style_flags |= flags; /*********************************************************************/ /* */ diff --git a/reactos/lib/3rdparty/freetype/src/sfnt/sfobjs.h b/reactos/lib/3rdparty/freetype/src/sfnt/sfobjs.h index 77c7d92c3ea..455f86772f8 100644 --- a/reactos/lib/3rdparty/freetype/src/sfnt/sfobjs.h +++ b/reactos/lib/3rdparty/freetype/src/sfnt/sfobjs.h @@ -31,20 +31,25 @@ FT_BEGIN_HEADER FT_LOCAL( FT_Error ) sfnt_init_face( FT_Stream stream, TT_Face face, - FT_Int face_index, + FT_Int face_instance_index, FT_Int num_params, FT_Parameter* params ); FT_LOCAL( FT_Error ) sfnt_load_face( FT_Stream stream, TT_Face face, - FT_Int face_index, + FT_Int face_instance_index, FT_Int num_params, FT_Parameter* params ); FT_LOCAL( void ) sfnt_done_face( TT_Face face ); + FT_LOCAL( FT_Error ) + tt_face_get_name( TT_Face face, + FT_UShort nameid, + FT_String** name ); + FT_END_HEADER diff --git a/reactos/lib/3rdparty/freetype/src/sfnt/ttcmap.c b/reactos/lib/3rdparty/freetype/src/sfnt/ttcmap.c index 815ee7c4e25..c4d9abdfe68 100644 --- a/reactos/lib/3rdparty/freetype/src/sfnt/ttcmap.c +++ b/reactos/lib/3rdparty/freetype/src/sfnt/ttcmap.c @@ -51,6 +51,13 @@ #define TT_NEXT_ULONG FT_NEXT_ULONG + /* Too large glyph index return values are caught in `FT_Get_Char_Index' */ + /* and `FT_Get_Next_Char' (the latter calls the internal `next' function */ + /* again in this case). To mark character code return values as invalid */ + /* it is sufficient to set the corresponding glyph index return value to */ + /* zero. */ + + FT_CALLBACK_DEF( FT_Error ) tt_cmap_init( TT_CMap cmap, FT_Byte* table ) @@ -199,7 +206,7 @@ /***** FORMAT 2 *****/ /***** *****/ /***** This is used for certain CJK encodings that encode text in a *****/ - /***** mixed 8/16 bits encoding along the following lines: *****/ + /***** mixed 8/16 bits encoding along the following lines. *****/ /***** *****/ /***** * Certain byte values correspond to an 8-bit character code *****/ /***** (typically in the range 0..127 for ASCII compatibility). *****/ @@ -209,19 +216,19 @@ /***** second byte of a 2-byte character). *****/ /***** *****/ /***** The following charmap lookup and iteration functions all *****/ - /***** assume that the value "charcode" correspond to following: *****/ + /***** assume that the value `charcode' fulfills the following. *****/ /***** *****/ - /***** - For one byte characters, "charcode" is simply the *****/ + /***** - For one byte characters, `charcode' is simply the *****/ /***** character code. *****/ /***** *****/ - /***** - For two byte characters, "charcode" is the 2-byte *****/ - /***** character code in big endian format. More exactly: *****/ + /***** - For two byte characters, `charcode' is the 2-byte *****/ + /***** character code in big endian format. More precisely: *****/ /***** *****/ /***** (charcode >> 8) is the first byte value *****/ /***** (charcode & 0xFF) is the second byte value *****/ /***** *****/ - /***** Note that not all values of "charcode" are valid according *****/ - /***** to these rules, and the function moderately check the *****/ + /***** Note that not all values of `charcode' are valid according *****/ + /***** to these rules, and the function moderately checks the *****/ /***** arguments. *****/ /***** *****/ /*************************************************************************/ @@ -249,7 +256,7 @@ /* table, i.e., it is the corresponding sub-header index multiplied */ /* by 8. */ /* */ - /* Each sub-header has the following format: */ + /* Each sub-header has the following format. */ /* */ /* NAME OFFSET TYPE DESCRIPTION */ /* */ @@ -264,11 +271,11 @@ /* according to the specification. */ /* */ /* If a character code is contained within a given sub-header, then */ - /* mapping it to a glyph index is done as follows: */ + /* mapping it to a glyph index is done as follows. */ /* */ /* * The value of `offset' is read. This is a _byte_ distance from the */ /* location of the `offset' field itself into a slice of the */ - /* `glyph_ids' table. Let's call it `slice' (it is a USHORT[] too). */ + /* `glyph_ids' table. Let's call it `slice' (it is a USHORT[], too). */ /* */ /* * The value `slice[char.lo - first]' is read. If it is 0, there is */ /* no glyph for the charcode. Otherwise, the value of `delta' is */ @@ -326,7 +333,7 @@ FT_ASSERT( p == table + 518 ); subs = p; - glyph_ids = subs + (max_subs + 1) * 8; + glyph_ids = subs + ( max_subs + 1 ) * 8; if ( glyph_ids > valid->limit ) FT_INVALID_TOO_SHORT; @@ -436,6 +443,7 @@ } result = sub; } + Exit: return result; } @@ -475,6 +483,7 @@ result = (FT_UInt)( (FT_Int)idx + delta ) & 0xFFFFU; } } + return result; } @@ -973,7 +982,7 @@ /* segment if it contains only a single character. */ /* */ /* We thus omit the test here, delaying it to the */ - /* routines which actually access the cmap. */ + /* routines that actually access the cmap. */ else if ( n != num_segs - 1 || !( start == 0xFFFFU && end == 0xFFFFU ) ) { @@ -1026,12 +1035,17 @@ FT_UInt32* pcharcode, FT_Bool next ) { + TT_Face face = (TT_Face)cmap->cmap.charmap.face; + FT_Byte* limit = face->cmap_table + face->cmap_size; + + FT_UInt num_segs2, start, end, offset; FT_Int delta; FT_UInt i, num_segs; FT_UInt32 charcode = *pcharcode; FT_UInt gindex = 0; FT_Byte* p; + FT_Byte* q; p = cmap->data + 6; @@ -1045,65 +1059,106 @@ if ( next ) charcode++; + if ( charcode > 0xFFFFU ) + return 0; + /* linear search */ - for ( ; charcode <= 0xFFFFU; charcode++ ) + p = cmap->data + 14; /* ends table */ + q = cmap->data + 16 + num_segs2; /* starts table */ + + for ( i = 0; i < num_segs; i++ ) { - FT_Byte* q; + end = TT_NEXT_USHORT( p ); + start = TT_NEXT_USHORT( q ); - - p = cmap->data + 14; /* ends table */ - q = cmap->data + 16 + num_segs2; /* starts table */ - - for ( i = 0; i < num_segs; i++ ) + if ( charcode < start ) { - end = TT_NEXT_USHORT( p ); - start = TT_NEXT_USHORT( q ); - - if ( charcode >= start && charcode <= end ) - { - p = q - 2 + num_segs2; - delta = TT_PEEK_SHORT( p ); - p += num_segs2; - offset = TT_PEEK_USHORT( p ); - - /* some fonts have an incorrect last segment; */ - /* we have to catch it */ - if ( i >= num_segs - 1 && - start == 0xFFFFU && end == 0xFFFFU ) - { - TT_Face face = (TT_Face)cmap->cmap.charmap.face; - FT_Byte* limit = face->cmap_table + face->cmap_size; - - - if ( offset && p + offset + 2 > limit ) - { - delta = 1; - offset = 0; - } - } - - if ( offset == 0xFFFFU ) - continue; - - if ( offset ) - { - p += offset + ( charcode - start ) * 2; - gindex = TT_PEEK_USHORT( p ); - if ( gindex != 0 ) - gindex = (FT_UInt)( (FT_Int)gindex + delta ) & 0xFFFFU; - } - else - gindex = (FT_UInt)( (FT_Int)charcode + delta ) & 0xFFFFU; - + if ( next ) + charcode = start; + else break; - } } - if ( !next || gindex ) + Again: + if ( charcode <= end ) + { + FT_Byte* r; + + + r = q - 2 + num_segs2; + delta = TT_PEEK_SHORT( r ); + r += num_segs2; + offset = TT_PEEK_USHORT( r ); + + /* some fonts have an incorrect last segment; */ + /* we have to catch it */ + if ( i >= num_segs - 1 && + start == 0xFFFFU && end == 0xFFFFU ) + { + if ( offset && r + offset + 2 > limit ) + { + delta = 1; + offset = 0; + } + } + + if ( offset == 0xFFFFU ) + continue; + + if ( offset ) + { + r += offset + ( charcode - start ) * 2; + + /* if r > limit, the whole segment is invalid */ + if ( next && r > limit ) + continue; + + gindex = TT_PEEK_USHORT( r ); + if ( gindex ) + { + gindex = (FT_UInt)( (FT_Int)gindex + delta ) & 0xFFFFU; + if ( gindex >= (FT_UInt)face->root.num_glyphs ) + gindex = 0; + } + } + else + { + gindex = (FT_UInt)( (FT_Int)charcode + delta ) & 0xFFFFU; + + if ( next && gindex >= (FT_UInt)face->root.num_glyphs ) + { + /* we have an invalid glyph index; if there is an overflow, */ + /* we can adjust `charcode', otherwise the whole segment is */ + /* invalid */ + gindex = 0; + + if ( (FT_Int)charcode + delta < 0 && + (FT_Int)end + delta >= 0 ) + charcode = (FT_UInt)( -delta ); + + else if ( (FT_Int)charcode + delta < 0x10000L && + (FT_Int)end + delta >= 0x10000L ) + charcode = (FT_UInt)( 0x10000L - delta ); + + else + continue; + } + } + + if ( next && !gindex ) + { + if ( charcode >= 0xFFFFU ) + break; + + charcode++; + goto Again; + } + break; + } } - if ( next && gindex ) + if ( next ) *pcharcode = charcode; return gindex; @@ -1310,7 +1365,6 @@ /* if `charcode' is not in any segment, then `mid' is */ /* the segment nearest to `charcode' */ - /* */ if ( charcode > end ) { @@ -1443,7 +1497,7 @@ /* */ /* NAME OFFSET TYPE DESCRIPTION */ /* */ - /* format 0 USHORT must be 4 */ + /* format 0 USHORT must be 6 */ /* length 2 USHORT table length in bytes */ /* language 4 USHORT Mac language code */ /* */ @@ -1511,6 +1565,7 @@ p += 2 * idx; result = TT_PEEK_USHORT( p ); } + return result; } @@ -1531,7 +1586,7 @@ if ( char_code >= 0x10000UL ) - goto Exit; + return 0; if ( char_code < start ) char_code = start; @@ -1547,10 +1602,13 @@ result = char_code; break; } + + if ( char_code >= 0xFFFFU ) + return 0; + char_code++; } - Exit: *pchar_code = result; return gindex; } @@ -1602,7 +1660,7 @@ /***** *****/ /***** The purpose of this format is to easily map UTF-16 text to *****/ /***** glyph indices. Basically, the `char_code' must be in one of *****/ - /***** the following formats: *****/ + /***** the following formats. *****/ /***** *****/ /***** - A 16-bit value that isn't part of the Unicode Surrogates *****/ /***** Area (i.e. U+D800-U+DFFF). *****/ @@ -1615,7 +1673,7 @@ /***** The `is32' table embedded in the charmap indicates whether a *****/ /***** given 16-bit value is in the surrogates area or not. *****/ /***** *****/ - /***** So, for any given `char_code', we can assert the following: *****/ + /***** So, for any given `char_code', we can assert the following. *****/ /***** *****/ /***** If `char_hi == 0' then we must have `is32[char_lo] == 0'. *****/ /***** *****/ @@ -1770,7 +1828,10 @@ if ( char_code <= end ) { - result = (FT_UInt)( start_id + char_code - start ); + if ( start_id > 0xFFFFFFFFUL - ( char_code - start ) ) + return 0; + + result = (FT_UInt)( start_id + ( char_code - start ) ); break; } } @@ -1782,8 +1843,9 @@ tt_cmap8_char_next( TT_CMap cmap, FT_UInt32 *pchar_code ) { + FT_Face face = cmap->cmap.charmap.face; FT_UInt32 result = 0; - FT_UInt32 char_code = *pchar_code + 1; + FT_UInt32 char_code; FT_UInt gindex = 0; FT_Byte* table = cmap->data; FT_Byte* p = table + 8204; @@ -1791,6 +1853,11 @@ FT_UInt32 start, end, start_id; + if ( *pchar_code >= 0xFFFFFFFFUL ) + return 0; + + char_code = *pchar_code + 1; + p = table + 8208; for ( ; num_groups > 0; num_groups-- ) @@ -1802,18 +1869,35 @@ if ( char_code < start ) char_code = start; + Again: if ( char_code <= end ) { - gindex = (FT_UInt)( char_code - start + start_id ); - if ( gindex != 0 ) + /* ignore invalid group */ + if ( start_id > 0xFFFFFFFFUL - ( char_code - start ) ) + continue; + + gindex = (FT_UInt)( start_id + ( char_code - start ) ); + + /* does first element of group point to `.notdef' glyph? */ + if ( gindex == 0 ) { - result = char_code; - goto Exit; + if ( char_code >= 0xFFFFFFFFUL ) + break; + + char_code++; + goto Again; } + + /* if `gindex' is invalid, the remaining values */ + /* in this group are invalid, too */ + if ( gindex >= (FT_UInt)face->num_glyphs ) + continue; + + result = char_code; + break; } } - Exit: *pchar_code = result; return gindex; } @@ -1930,14 +2014,20 @@ FT_Byte* p = table + 12; FT_UInt32 start = TT_NEXT_ULONG( p ); FT_UInt32 count = TT_NEXT_ULONG( p ); - FT_UInt32 idx = (FT_ULong)( char_code - start ); + FT_UInt32 idx; + if ( char_code < start ) + return 0; + + idx = char_code - start; + if ( idx < count ) { p += 2 * idx; result = TT_PEEK_USHORT( p ); } + return result; } @@ -1947,7 +2037,7 @@ FT_UInt32 *pchar_code ) { FT_Byte* table = cmap->data; - FT_UInt32 char_code = *pchar_code + 1; + FT_UInt32 char_code; FT_UInt gindex = 0; FT_Byte* p = table + 12; FT_UInt32 start = TT_NEXT_ULONG( p ); @@ -1955,10 +2045,15 @@ FT_UInt32 idx; + if ( *pchar_code >= 0xFFFFFFFFUL ) + return 0; + + char_code = *pchar_code + 1; + if ( char_code < start ) char_code = start; - idx = (FT_UInt32)( char_code - start ); + idx = char_code - start; p += 2 * idx; for ( ; idx < count; idx++ ) @@ -1966,6 +2061,10 @@ gindex = TT_NEXT_USHORT( p ); if ( gindex != 0 ) break; + + if ( char_code >= 0xFFFFFFFFUL ) + return 0; + char_code++; } @@ -2134,6 +2233,7 @@ static void tt_cmap12_next( TT_CMap12 cmap ) { + FT_Face face = cmap->cmap.cmap.charmap.face; FT_Byte* p; FT_ULong start, end, start_id, char_code; FT_ULong n; @@ -2155,18 +2255,35 @@ if ( char_code < start ) char_code = start; - for ( ; char_code <= end; char_code++ ) + Again: + if ( char_code <= end ) { - gindex = (FT_UInt)( start_id + char_code - start ); + /* ignore invalid group */ + if ( start_id > 0xFFFFFFFFUL - ( char_code - start ) ) + continue; - if ( gindex ) + gindex = (FT_UInt)( start_id + ( char_code - start ) ); + + /* does first element of group point to `.notdef' glyph? */ + if ( gindex == 0 ) { - cmap->cur_charcode = char_code;; - cmap->cur_gindex = gindex; - cmap->cur_group = n; + if ( char_code >= 0xFFFFFFFFUL ) + goto Fail; - return; + char_code++; + goto Again; } + + /* if `gindex' is invalid, the remaining values */ + /* in this group are invalid, too */ + if ( gindex >= (FT_UInt)face->num_glyphs ) + continue; + + cmap->cur_charcode = char_code; + cmap->cur_gindex = gindex; + cmap->cur_group = n; + + return; } } @@ -2196,7 +2313,12 @@ end = 0xFFFFFFFFUL; if ( next ) + { + if ( char_code >= 0xFFFFFFFFUL ) + return 0; + char_code++; + } min = 0; max = num_groups; @@ -2217,20 +2339,24 @@ else { start_id = TT_PEEK_ULONG( p ); - gindex = (FT_UInt)( start_id + char_code - start ); + /* reject invalid glyph index */ + if ( start_id > 0xFFFFFFFFUL - ( char_code - start ) ) + gindex = 0; + else + gindex = (FT_UInt)( start_id + ( char_code - start ) ); break; } } if ( next ) { + FT_Face face = cmap->cmap.charmap.face; TT_CMap12 cmap12 = (TT_CMap12)cmap; /* if `char_code' is not in any group, then `mid' is */ /* the group nearest to `char_code' */ - /* */ if ( char_code > end ) { @@ -2243,6 +2369,9 @@ cmap12->cur_charcode = char_code; cmap12->cur_group = mid; + if ( gindex >= (FT_UInt)face->num_glyphs ) + gindex = 0; + if ( !gindex ) { tt_cmap12_next( cmap12 ); @@ -2253,8 +2382,7 @@ else cmap12->cur_gindex = gindex; - if ( gindex ) - *pchar_code = cmap12->cur_charcode; + *pchar_code = cmap12->cur_charcode; } return gindex; @@ -2274,23 +2402,17 @@ FT_UInt32 *pchar_code ) { TT_CMap12 cmap12 = (TT_CMap12)cmap; - FT_ULong gindex; + FT_UInt gindex; - if ( cmap12->cur_charcode >= 0xFFFFFFFFUL ) - return 0; - /* no need to search */ if ( cmap12->valid && cmap12->cur_charcode == *pchar_code ) { tt_cmap12_next( cmap12 ); if ( cmap12->valid ) { - gindex = cmap12->cur_gindex; - - /* XXX: check cur_charcode overflow is expected */ - if ( gindex ) - *pchar_code = (FT_UInt32)cmap12->cur_charcode; + gindex = cmap12->cur_gindex; + *pchar_code = (FT_UInt32)cmap12->cur_charcode; } else gindex = 0; @@ -2298,8 +2420,7 @@ else gindex = tt_cmap12_char_map_binary( cmap, pchar_code, 1 ); - /* XXX: check gindex overflow is expected */ - return (FT_UInt32)gindex; + return gindex; } @@ -2458,6 +2579,7 @@ static void tt_cmap13_next( TT_CMap13 cmap ) { + FT_Face face = cmap->cmap.cmap.charmap.face; FT_Byte* p; FT_ULong start, end, glyph_id, char_code; FT_ULong n; @@ -2483,9 +2605,9 @@ { gindex = (FT_UInt)glyph_id; - if ( gindex ) + if ( gindex && gindex < (FT_UInt)face->num_glyphs ) { - cmap->cur_charcode = char_code;; + cmap->cur_charcode = char_code; cmap->cur_gindex = gindex; cmap->cur_group = n; @@ -2520,7 +2642,12 @@ end = 0xFFFFFFFFUL; if ( next ) + { + if ( char_code >= 0xFFFFFFFFUL ) + return 0; + char_code++; + } min = 0; max = num_groups; @@ -2548,6 +2675,7 @@ if ( next ) { + FT_Face face = cmap->cmap.charmap.face; TT_CMap13 cmap13 = (TT_CMap13)cmap; @@ -2565,6 +2693,9 @@ cmap13->cur_charcode = char_code; cmap13->cur_group = mid; + if ( gindex >= (FT_UInt)face->num_glyphs ) + gindex = 0; + if ( !gindex ) { tt_cmap13_next( cmap13 ); @@ -2575,8 +2706,7 @@ else cmap13->cur_gindex = gindex; - if ( gindex ) - *pchar_code = cmap13->cur_charcode; + *pchar_code = cmap13->cur_charcode; } return gindex; @@ -2599,18 +2729,14 @@ FT_UInt gindex; - if ( cmap13->cur_charcode >= 0xFFFFFFFFUL ) - return 0; - /* no need to search */ if ( cmap13->valid && cmap13->cur_charcode == *pchar_code ) { tt_cmap13_next( cmap13 ); if ( cmap13->valid ) { - gindex = cmap13->cur_gindex; - if ( gindex ) - *pchar_code = cmap13->cur_charcode; + gindex = cmap13->cur_gindex; + *pchar_code = cmap13->cur_charcode; } else gindex = 0; diff --git a/reactos/lib/3rdparty/freetype/src/sfnt/ttload.c b/reactos/lib/3rdparty/freetype/src/sfnt/ttload.c index ad2975de092..0f3b0a83368 100644 --- a/reactos/lib/3rdparty/freetype/src/sfnt/ttload.c +++ b/reactos/lib/3rdparty/freetype/src/sfnt/ttload.c @@ -151,7 +151,8 @@ /* Here, we */ /* */ - /* - check that `num_tables' is valid (and adjust it if necessary) */ + /* - check that `num_tables' is valid (and adjust it if necessary); */ + /* also return the number of valid table entries */ /* */ /* - look for a `head' table, check its size, and parse it to check */ /* whether its `magic' field is correctly set */ @@ -167,7 +168,8 @@ /* */ static FT_Error check_table_dir( SFNT_Header sfnt, - FT_Stream stream ) + FT_Stream stream, + FT_UShort* valid ) { FT_Error error; FT_UShort nn, valid_entries = 0; @@ -209,7 +211,10 @@ /* we ignore invalid tables */ if ( table.Offset > stream->size ) + { + FT_TRACE2(( "check_table_dir: table entry %d invalid\n", nn )); continue; + } else if ( table.Length > stream->size - table.Offset ) { /* Some tables have such a simple structure that clipping its */ @@ -273,11 +278,11 @@ has_meta = 1; } - sfnt->num_tables = valid_entries; + *valid = valid_entries; - if ( sfnt->num_tables == 0 ) + if ( !valid_entries ) { - FT_TRACE2(( "check_table_dir: no tables found\n" )); + FT_TRACE2(( "check_table_dir: no valid tables found\n" )); error = FT_THROW( Unknown_File_Format ); goto Exit; } @@ -333,8 +338,7 @@ SFNT_HeaderRec sfnt; FT_Error error; FT_Memory memory = stream->memory; - TT_TableRec* entry; - FT_Int nn; + FT_UShort nn, valid_entries; static const FT_Frame_Field offset_table_fields[] = { @@ -375,85 +379,114 @@ if ( sfnt.format_tag != TTAG_OTTO ) { /* check first */ - error = check_table_dir( &sfnt, stream ); + error = check_table_dir( &sfnt, stream, &valid_entries ); if ( error ) { FT_TRACE2(( "tt_face_load_font_dir:" " invalid table directory for TrueType\n" )); - goto Exit; } } + else + valid_entries = sfnt.num_tables; - face->num_tables = sfnt.num_tables; + face->num_tables = valid_entries; face->format_tag = sfnt.format_tag; if ( FT_QNEW_ARRAY( face->dir_tables, face->num_tables ) ) goto Exit; - if ( FT_STREAM_SEEK( sfnt.offset + 12 ) || - FT_FRAME_ENTER( face->num_tables * 16L ) ) + if ( FT_STREAM_SEEK( sfnt.offset + 12 ) || + FT_FRAME_ENTER( sfnt.num_tables * 16L ) ) goto Exit; - entry = face->dir_tables; - FT_TRACE2(( "\n" " tag offset length checksum\n" " ----------------------------------\n" )); + valid_entries = 0; for ( nn = 0; nn < sfnt.num_tables; nn++ ) { - entry->Tag = FT_GET_TAG4(); - entry->CheckSum = FT_GET_ULONG(); - entry->Offset = FT_GET_ULONG(); - entry->Length = FT_GET_ULONG(); + TT_TableRec entry; + FT_UShort i; + FT_Bool duplicate; + + + entry.Tag = FT_GET_TAG4(); + entry.CheckSum = FT_GET_ULONG(); + entry.Offset = FT_GET_ULONG(); + entry.Length = FT_GET_ULONG(); /* ignore invalid tables that can't be sanitized */ - if ( entry->Offset > stream->size ) + if ( entry.Offset > stream->size ) continue; - else if ( entry->Length > stream->size - entry->Offset ) + else if ( entry.Length > stream->size - entry.Offset ) { - if ( entry->Tag == TTAG_hmtx || - entry->Tag == TTAG_vmtx ) + if ( entry.Tag == TTAG_hmtx || + entry.Tag == TTAG_vmtx ) { #ifdef FT_DEBUG_LEVEL_TRACE - FT_ULong old_length = entry->Length; + FT_ULong old_length = entry.Length; #endif /* make metrics table length a multiple of 4 */ - entry->Length = ( stream->size - entry->Offset ) & ~3U; + entry.Length = ( stream->size - entry.Offset ) & ~3U; FT_TRACE2(( " %c%c%c%c %08lx %08lx %08lx" - " (sanitized; original length %08lx)\n", - (FT_Char)( entry->Tag >> 24 ), - (FT_Char)( entry->Tag >> 16 ), - (FT_Char)( entry->Tag >> 8 ), - (FT_Char)( entry->Tag ), - entry->Offset, - entry->Length, - entry->CheckSum, + " (sanitized; original length %08lx)", + (FT_Char)( entry.Tag >> 24 ), + (FT_Char)( entry.Tag >> 16 ), + (FT_Char)( entry.Tag >> 8 ), + (FT_Char)( entry.Tag ), + entry.Offset, + entry.Length, + entry.CheckSum, old_length )); - entry++; } else continue; } +#ifdef FT_DEBUG_LEVEL_TRACE + else + FT_TRACE2(( " %c%c%c%c %08lx %08lx %08lx", + (FT_Char)( entry.Tag >> 24 ), + (FT_Char)( entry.Tag >> 16 ), + (FT_Char)( entry.Tag >> 8 ), + (FT_Char)( entry.Tag ), + entry.Offset, + entry.Length, + entry.CheckSum )); +#endif + + /* ignore duplicate tables – the first one wins */ + duplicate = 0; + for ( i = 0; i < valid_entries; i++ ) + { + if ( face->dir_tables[i].Tag == entry.Tag ) + { + duplicate = 1; + break; + } + } + if ( duplicate ) + { + FT_TRACE2(( " (duplicate, ignored)\n" )); + continue; + } else { - FT_TRACE2(( " %c%c%c%c %08lx %08lx %08lx\n", - (FT_Char)( entry->Tag >> 24 ), - (FT_Char)( entry->Tag >> 16 ), - (FT_Char)( entry->Tag >> 8 ), - (FT_Char)( entry->Tag ), - entry->Offset, - entry->Length, - entry->CheckSum )); - entry++; + FT_TRACE2(( "\n" )); + + /* we finally have a valid entry */ + face->dir_tables[valid_entries++] = entry; } } + /* final adjustment to number of tables */ + face->num_tables = valid_entries; + FT_FRAME_EXIT(); FT_TRACE2(( "table directory loaded\n\n" )); diff --git a/reactos/lib/3rdparty/freetype/src/sfnt/ttsbit.c b/reactos/lib/3rdparty/freetype/src/sfnt/ttsbit.c index 143f276d318..3b351ecfce4 100644 --- a/reactos/lib/3rdparty/freetype/src/sfnt/ttsbit.c +++ b/reactos/lib/3rdparty/freetype/src/sfnt/ttsbit.c @@ -254,15 +254,15 @@ metrics->x_ppem = (FT_UShort)strike[44]; metrics->y_ppem = (FT_UShort)strike[45]; - metrics->ascender = (FT_Char)strike[16] << 6; /* hori.ascender */ - metrics->descender = (FT_Char)strike[17] << 6; /* hori.descender */ + metrics->ascender = (FT_Char)strike[16] * 64; /* hori.ascender */ + metrics->descender = (FT_Char)strike[17] * 64; /* hori.descender */ metrics->height = metrics->ascender - metrics->descender; /* Is this correct? */ metrics->max_advance = ( (FT_Char)strike[22] + /* min_origin_SB */ strike[18] + /* max_width */ (FT_Char)strike[23] /* min_advance_SB */ - ) << 6; + ) * 64; return FT_Err_Ok; } diff --git a/reactos/lib/3rdparty/freetype/src/smooth/ftgrays.c b/reactos/lib/3rdparty/freetype/src/smooth/ftgrays.c index d2e439c47e1..56d2b553319 100644 --- a/reactos/lib/3rdparty/freetype/src/smooth/ftgrays.c +++ b/reactos/lib/3rdparty/freetype/src/smooth/ftgrays.c @@ -24,8 +24,8 @@ /* */ /* - copy `src/smooth/ftgrays.c' (this file) to your current directory */ /* */ - /* - copy `include/ftimage.h' and `src/smooth/ftgrays.h' to the same */ - /* directory */ + /* - copy `include/freetype/ftimage.h' and `src/smooth/ftgrays.h' to the */ + /* same directory */ /* */ /* - compile `ftgrays' with the _STANDALONE_ macro defined, as in */ /* */ @@ -317,7 +317,6 @@ typedef ptrdiff_t FT_PtrDist; #undef SCALED #define ONE_PIXEL ( 1L << PIXEL_BITS ) -#define PIXEL_MASK ( -1L << PIXEL_BITS ) #define TRUNC( x ) ( (TCoord)( (x) >> PIXEL_BITS ) ) #define SUBPIXELS( x ) ( (TPos)(x) << PIXEL_BITS ) #define FLOOR( x ) ( (x) & -ONE_PIXEL ) @@ -440,11 +439,8 @@ typedef ptrdiff_t FT_PtrDist; FT_PtrDist max_cells; FT_PtrDist num_cells; - TCoord cx, cy; TPos x, y; - TPos last_ey; - FT_Vector bez_stack[32 * 3 + 1]; int lev_stack[32]; @@ -677,7 +673,6 @@ typedef ptrdiff_t FT_PtrDist; ras.cover = 0; ras.ex = ex - ras.min_ex; ras.ey = ey - ras.min_ey; - ras.last_ey = SUBPIXELS( ey ); ras.invalid = 0; gray_set_cell( RAS_VAR_ ex, ey ); @@ -758,7 +753,7 @@ typedef ptrdiff_t FT_PtrDist; mod -= (int)dx; - while ( ex1 != ex2 ) + do { delta = lift; mod += rem; @@ -773,7 +768,7 @@ typedef ptrdiff_t FT_PtrDist; y1 += delta; ex1 += incr; gray_set_cell( RAS_VAR_ ex1, ey ); - } + } while ( ex1 != ex2 ); } delta = y2 - y1; @@ -796,29 +791,18 @@ typedef ptrdiff_t FT_PtrDist; int delta, rem, lift, incr; - ey1 = TRUNC( ras.last_ey ); + ey1 = TRUNC( ras.y ); ey2 = TRUNC( to_y ); /* if (ey2 >= ras.max_ey) ey2 = ras.max_ey-1; */ - fy1 = (TCoord)( ras.y - ras.last_ey ); + fy1 = (TCoord)( ras.y - SUBPIXELS( ey1 ) ); fy2 = (TCoord)( to_y - SUBPIXELS( ey2 ) ); dx = to_x - ras.x; dy = to_y - ras.y; /* perform vertical clipping */ - { - TCoord min, max; - - - min = ey1; - max = ey2; - if ( ey1 > ey2 ) - { - min = ey2; - max = ey1; - } - if ( min >= ras.max_ey || max < ras.min_ey ) - goto End; - } + if ( ( ey1 >= ras.max_ey && ey2 >= ras.max_ey ) || + ( ey1 < ras.min_ey && ey2 < ras.min_ey ) ) + goto End; /* everything is on a single scanline */ if ( ey1 == ey2 ) @@ -896,7 +880,7 @@ typedef ptrdiff_t FT_PtrDist; FT_DIV_MOD( int, p, dy, lift, rem ); mod -= (int)dy; - while ( ey1 != ey2 ) + do { delta = lift; mod += rem; @@ -914,7 +898,7 @@ typedef ptrdiff_t FT_PtrDist; ey1 += incr; gray_set_cell( RAS_VAR_ TRUNC( x ), ey1 ); - } + } while ( ey1 != ey2 ); } gray_render_scanline( RAS_VAR_ ey1, x, @@ -924,7 +908,6 @@ typedef ptrdiff_t FT_PtrDist; End: ras.x = to_x; ras.y = to_y; - ras.last_ey = SUBPIXELS( ey2 ); } @@ -1847,7 +1830,7 @@ typedef ptrdiff_t FT_PtrDist; bands[0].max = max; band = bands; - while ( band >= bands ) + do { TPos bottom, top, middle; int error; @@ -1923,7 +1906,7 @@ typedef ptrdiff_t FT_PtrDist; band[0].min = middle; band[0].max = top; band++; - } + } while ( band >= bands ); } if ( ras.band_shoot > 8 && ras.band_size > 16 ) diff --git a/reactos/lib/3rdparty/freetype/src/smooth/ftspic.h b/reactos/lib/3rdparty/freetype/src/smooth/ftspic.h index 99b9f0ed303..071afcff203 100644 --- a/reactos/lib/3rdparty/freetype/src/smooth/ftspic.h +++ b/reactos/lib/3rdparty/freetype/src/smooth/ftspic.h @@ -20,10 +20,11 @@ #define __FTSPIC_H__ -FT_BEGIN_HEADER - #include FT_INTERNAL_PIC_H + +FT_BEGIN_HEADER + #ifndef FT_CONFIG_OPTION_PIC #define FT_GRAYS_RASTER_GET ft_grays_raster diff --git a/reactos/lib/3rdparty/freetype/src/tools/chktrcmp.py b/reactos/lib/3rdparty/freetype/src/tools/chktrcmp.py index ce6500c7e25..4c40bdafdb5 100644 --- a/reactos/lib/3rdparty/freetype/src/tools/chktrcmp.py +++ b/reactos/lib/3rdparty/freetype/src/tools/chktrcmp.py @@ -15,7 +15,7 @@ USED_COMPONENT = {} KNOWN_COMPONENT = {} SRC_FILE_DIRS = [ "src" ] -TRACE_DEF_FILES = [ "include/internal/fttrace.h" ] +TRACE_DEF_FILES = [ "include/freetype/internal/fttrace.h" ] # -------------------------------------------------------------- diff --git a/reactos/lib/3rdparty/freetype/src/tools/docmaker/content.py b/reactos/lib/3rdparty/freetype/src/tools/docmaker/content.py index 6887f0b84ca..1961878a7d6 100644 --- a/reactos/lib/3rdparty/freetype/src/tools/docmaker/content.py +++ b/reactos/lib/3rdparty/freetype/src/tools/docmaker/content.py @@ -53,9 +53,10 @@ re_identifier = re.compile( r'((?:\w|-)*)' ) # # We collect macro names ending in `_H' (group 1), as defined in -# `config/ftheader.h'. While outputting the object data, we use this info -# together with the object's file location (group 2) to emit the appropriate -# header file macro and its associated file name before the object itself. +# `freetype/config/ftheader.h'. While outputting the object data, we use +# this info together with the object's file location (group 2) to emit the +# appropriate header file macro and its associated file name before the +# object itself. # # Example: # diff --git a/reactos/lib/3rdparty/freetype/src/tools/docmaker/sources.py b/reactos/lib/3rdparty/freetype/src/tools/docmaker/sources.py index 0cf21ce03f3..be38132d1df 100644 --- a/reactos/lib/3rdparty/freetype/src/tools/docmaker/sources.py +++ b/reactos/lib/3rdparty/freetype/src/tools/docmaker/sources.py @@ -150,10 +150,11 @@ re_crossref = re.compile( r'@((?:\w|-)*)(.*)' ) # @foo # Group 1 is the markup, group 2 the rest of the line. # # Note that the markup is limited to words consisting of letters, digits, -# the character `_', or an apostrophe (but not as the first character). +# the characters `_' and `-', or an apostrophe (but not as the first +# character). # -re_italic = re.compile( r"_(\w(?:\w|')*)_(.*)" ) # _italic_ -re_bold = re.compile( r"\*(\w(?:\w|')*)\*(.*)" ) # *bold* +re_italic = re.compile( r"_((?:\w|-)(?:\w|'|-)*)_(.*)" ) # _italic_ +re_bold = re.compile( r"\*((?:\w|-)(?:\w|'|-)*)\*(.*)" ) # *bold* # # This regular expression code to identify an URL has been taken from diff --git a/reactos/lib/3rdparty/freetype/src/tools/docmaker/utils.py b/reactos/lib/3rdparty/freetype/src/tools/docmaker/utils.py index 52af17a3a16..254083e92e9 100644 --- a/reactos/lib/3rdparty/freetype/src/tools/docmaker/utils.py +++ b/reactos/lib/3rdparty/freetype/src/tools/docmaker/utils.py @@ -79,7 +79,7 @@ def check_output(): if not os.path.isdir( output_dir ): sys.stderr.write( "argument" + " '" + output_dir + "' " - + "is not a valid directory" ) + + "is not a valid directory\n" ) sys.exit( 2 ) else: output_dir = None diff --git a/reactos/lib/3rdparty/freetype/src/truetype/ttgload.c b/reactos/lib/3rdparty/freetype/src/truetype/ttgload.c index e1acd6912c9..a792ad44a06 100644 --- a/reactos/lib/3rdparty/freetype/src/truetype/ttgload.c +++ b/reactos/lib/3rdparty/freetype/src/truetype/ttgload.c @@ -120,7 +120,7 @@ tt_get_metrics( TT_Loader loader, FT_UInt glyph_index ) { - TT_Face face = (TT_Face)loader->face; + TT_Face face = loader->face; #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING TT_Driver driver = (TT_Driver)FT_FACE_DRIVER( face ); #endif @@ -182,7 +182,7 @@ tt_get_metrics_incr_overrides( TT_Loader loader, FT_UInt glyph_index ) { - TT_Face face = (TT_Face)loader->face; + TT_Face face = loader->face; FT_Short left_bearing = 0, top_bearing = 0; FT_UShort advance_width = 0, advance_height = 0; @@ -248,29 +248,6 @@ #endif /* FT_CONFIG_OPTION_INCREMENTAL */ - /*************************************************************************/ - /* */ - /* Translates an array of coordinates. */ - /* */ - static void - translate_array( FT_UInt n, - FT_Vector* coords, - FT_Pos delta_x, - FT_Pos delta_y ) - { - FT_UInt k; - - - if ( delta_x ) - for ( k = 0; k < n; k++ ) - coords[k].x += delta_x; - - if ( delta_y ) - for ( k = 0; k < n; k++ ) - coords[k].y += delta_y; - } - - /*************************************************************************/ /* */ /* The following functions are used by default with TrueType fonts. */ @@ -656,20 +633,20 @@ if ( subglyph->flags & WE_HAVE_A_SCALE ) { - xx = (FT_Fixed)FT_NEXT_SHORT( p ) << 2; + xx = (FT_Fixed)FT_NEXT_SHORT( p ) * 4; yy = xx; } else if ( subglyph->flags & WE_HAVE_AN_XY_SCALE ) { - xx = (FT_Fixed)FT_NEXT_SHORT( p ) << 2; - yy = (FT_Fixed)FT_NEXT_SHORT( p ) << 2; + xx = (FT_Fixed)FT_NEXT_SHORT( p ) * 4; + yy = (FT_Fixed)FT_NEXT_SHORT( p ) * 4; } else if ( subglyph->flags & WE_HAVE_A_2X2 ) { - xx = (FT_Fixed)FT_NEXT_SHORT( p ) << 2; - yx = (FT_Fixed)FT_NEXT_SHORT( p ) << 2; - xy = (FT_Fixed)FT_NEXT_SHORT( p ) << 2; - yy = (FT_Fixed)FT_NEXT_SHORT( p ) << 2; + xx = (FT_Fixed)FT_NEXT_SHORT( p ) * 4; + yx = (FT_Fixed)FT_NEXT_SHORT( p ) * 4; + xy = (FT_Fixed)FT_NEXT_SHORT( p ) * 4; + yy = (FT_Fixed)FT_NEXT_SHORT( p ) * 4; } subglyph->transform.xx = xx; @@ -754,7 +731,7 @@ FT_Bool is_composite ) { #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING - TT_Face face = (TT_Face)loader->face; + TT_Face face = loader->face; TT_Driver driver = (TT_Driver)FT_FACE_DRIVER( face ); #endif @@ -781,7 +758,7 @@ FT_ARRAY_COPY( zone->org, zone->cur, zone->n_points ); /* Reset graphics state. */ - loader->exec->GS = ((TT_Size)loader->size)->GS; + loader->exec->GS = loader->size->GS; /* XXX: UNDOCUMENTED! Hinting instructions of a composite glyph */ /* completely refer to the (already) hinted subglyphs. */ @@ -794,10 +771,8 @@ } else { - loader->exec->metrics.x_scale = - ((TT_Size)loader->size)->metrics.x_scale; - loader->exec->metrics.y_scale = - ((TT_Size)loader->size)->metrics.y_scale; + loader->exec->metrics.x_scale = loader->size->metrics.x_scale; + loader->exec->metrics.y_scale = loader->size->metrics.y_scale; } #endif @@ -897,13 +872,13 @@ #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT - if ( ((TT_Face)loader->face)->doblend ) + if ( loader->face->doblend ) { /* Deltas apply to the unscaled data. */ - error = TT_Vary_Apply_Glyph_Deltas( (TT_Face)(loader->face), - loader->glyph_index, - outline, - (FT_UInt)n_points ); + error = TT_Vary_Apply_Glyph_Deltas( loader->face, + loader->glyph_index, + outline, + (FT_UInt)n_points ); if ( error ) return error; } @@ -920,7 +895,7 @@ { #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING - TT_Face face = (TT_Face)loader->face; + TT_Face face = loader->face; TT_Driver driver = (TT_Driver)FT_FACE_DRIVER( face ); FT_String* family = face->root.family_name; @@ -953,9 +928,9 @@ if ( ( loader->load_flags & FT_LOAD_NO_SCALE ) == 0 || x_scale_factor != 1000 ) { - x_scale = FT_MulDiv( ((TT_Size)loader->size)->metrics.x_scale, + x_scale = FT_MulDiv( loader->size->metrics.x_scale, (FT_Long)x_scale_factor, 1000 ); - y_scale = ((TT_Size)loader->size)->metrics.y_scale; + y_scale = loader->size->metrics.y_scale; /* compensate for any scaling by de/emboldening; */ /* the amount was determined via experimentation */ @@ -975,8 +950,8 @@ /* scale the glyph */ if ( ( loader->load_flags & FT_LOAD_NO_SCALE ) == 0 ) { - x_scale = ((TT_Size)loader->size)->metrics.x_scale; - y_scale = ((TT_Size)loader->size)->metrics.y_scale; + x_scale = loader->size->metrics.x_scale; + y_scale = loader->size->metrics.y_scale; do_scale = TRUE; } @@ -1023,30 +998,29 @@ FT_UInt start_point, FT_UInt num_base_points ) { - FT_GlyphLoader gloader = loader->gloader; - FT_Vector* base_vec = gloader->base.outline.points; - FT_UInt num_points = (FT_UInt)gloader->base.outline.n_points; + FT_GlyphLoader gloader = loader->gloader; + FT_Outline current; FT_Bool have_scale; FT_Pos x, y; + current.points = gloader->base.outline.points + + num_base_points; + current.n_points = gloader->base.outline.n_points - + (short)num_base_points; + have_scale = FT_BOOL( subglyph->flags & ( WE_HAVE_A_SCALE | WE_HAVE_AN_XY_SCALE | WE_HAVE_A_2X2 ) ); /* perform the transform required for this subglyph */ if ( have_scale ) - { - FT_UInt i; - - - for ( i = num_base_points; i < num_points; i++ ) - FT_Vector_Transform( base_vec + i, &subglyph->transform ); - } + FT_Outline_Transform( ¤t, &subglyph->transform ); /* get offset */ if ( !( subglyph->flags & ARGS_ARE_XY_VALUES ) ) { + FT_UInt num_points = (FT_UInt)gloader->base.outline.n_points; FT_UInt k = (FT_UInt)subglyph->arg1; FT_UInt l = (FT_UInt)subglyph->arg2; FT_Vector* p1; @@ -1135,8 +1109,8 @@ if ( !( loader->load_flags & FT_LOAD_NO_SCALE ) ) { - FT_Fixed x_scale = ((TT_Size)loader->size)->metrics.x_scale; - FT_Fixed y_scale = ((TT_Size)loader->size)->metrics.y_scale; + FT_Fixed x_scale = loader->size->metrics.x_scale; + FT_Fixed y_scale = loader->size->metrics.y_scale; x = FT_MulFix( x, x_scale ); @@ -1151,9 +1125,7 @@ } if ( x || y ) - translate_array( num_points - num_base_points, - base_vec + num_base_points, - x, y ); + FT_Outline_Translate( ¤t, x, y ); return FT_Err_Ok; } @@ -1215,7 +1187,7 @@ FT_TRACE5(( " Instructions size = %d\n", n_ins )); /* check it */ - max_ins = ((TT_Face)loader->face)->max_profile.maxSizeOfInstructions; + max_ins = loader->face->max_profile.maxSizeOfInstructions; if ( n_ins > max_ins ) { /* don't trust `maxSizeOfInstructions'; */ @@ -1412,7 +1384,7 @@ FT_Error error = FT_Err_Ok; FT_Fixed x_scale, y_scale; FT_ULong offset; - TT_Face face = (TT_Face)loader->face; + TT_Face face = loader->face; FT_GlyphLoader gloader = loader->gloader; FT_Bool opened_frame = 0; @@ -1445,8 +1417,8 @@ if ( ( loader->load_flags & FT_LOAD_NO_SCALE ) == 0 ) { - x_scale = ((TT_Size)loader->size)->metrics.x_scale; - y_scale = ((TT_Size)loader->size)->metrics.y_scale; + x_scale = loader->size->metrics.x_scale; + y_scale = loader->size->metrics.y_scale; } else { @@ -1552,7 +1524,7 @@ #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT - if ( ((TT_Face)(loader->face))->doblend ) + if ( loader->face->doblend ) { /* a small outline structure with four elements for */ /* communication with `TT_Vary_Apply_Glyph_Deltas' */ @@ -1579,10 +1551,10 @@ outline.contours = contours; /* this must be done before scaling */ - error = TT_Vary_Apply_Glyph_Deltas( (TT_Face)(loader->face), - glyph_index, - &outline, - outline.n_points ); + error = TT_Vary_Apply_Glyph_Deltas( loader->face, + glyph_index, + &outline, + (FT_UInt)outline.n_points ); if ( error ) goto Exit; @@ -1679,7 +1651,7 @@ if ( face->doblend ) { - FT_UInt i, limit; + short i, limit; FT_SubGlyph subglyph; FT_Outline outline; @@ -1690,11 +1662,11 @@ FT_Memory memory = face->root.memory; - limit = gloader->current.num_subglyphs; + limit = (short)gloader->current.num_subglyphs; /* construct an outline structure for */ /* communication with `TT_Vary_Apply_Glyph_Deltas' */ - outline.n_points = gloader->current.num_subglyphs + 4; + outline.n_points = (short)( gloader->current.num_subglyphs + 4 ); outline.n_contours = outline.n_points; if ( FT_NEW_ARRAY( points, outline.n_points ) || @@ -1702,7 +1674,7 @@ FT_NEW_ARRAY( contours, outline.n_points ) ) goto Exit1; - subglyph = gloader->current.subglyphs + gloader->base.num_subglyphs; + subglyph = gloader->current.subglyphs; for ( i = 0; i < limit; i++, subglyph++ ) { @@ -1748,10 +1720,10 @@ face, glyph_index, &outline, - outline.n_points ) ) != 0 ) + (FT_UInt)outline.n_points ) ) != 0 ) goto Exit1; - subglyph = gloader->current.subglyphs + gloader->base.num_subglyphs; + subglyph = gloader->current.subglyphs; for ( i = 0; i < limit; i++, subglyph++ ) { @@ -1935,7 +1907,7 @@ compute_glyph_metrics( TT_Loader loader, FT_UInt glyph_index ) { - TT_Face face = (TT_Face)loader->face; + TT_Face face = loader->face; #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING TT_Driver driver = (TT_Driver)FT_FACE_DRIVER( face ); #endif @@ -1943,7 +1915,7 @@ FT_BBox bbox; FT_Fixed y_scale; TT_GlyphSlot glyph = loader->glyph; - TT_Size size = (TT_Size)loader->size; + TT_Size size = loader->size; y_scale = 0x10000L; @@ -1964,8 +1936,10 @@ glyph->metrics.horiAdvance = loader->pp2.x - loader->pp1.x; /* adjust advance width to the value contained in the hdmx table */ - if ( !face->postscript.isFixedPitch && - IS_HINTED( loader->load_flags ) ) + /* unless FT_LOAD_COMPUTE_METRICS is set */ + if ( !face->postscript.isFixedPitch && + IS_HINTED( loader->load_flags ) && + !( loader->load_flags & FT_LOAD_COMPUTE_METRICS ) ) { FT_Byte* widthp; @@ -1988,7 +1962,7 @@ ( ( ignore_x_mode && loader->exec->compatible_widths ) || !ignore_x_mode || SPH_OPTION_BITMAP_WIDTHS ) ) - glyph->metrics.horiAdvance = *widthp << 6; + glyph->metrics.horiAdvance = *widthp * 64; } else @@ -1996,7 +1970,7 @@ { if ( widthp ) - glyph->metrics.horiAdvance = *widthp << 6; + glyph->metrics.horiAdvance = *widthp * 64; } } @@ -2136,16 +2110,16 @@ glyph->outline.n_points = 0; glyph->outline.n_contours = 0; - glyph->metrics.width = (FT_Pos)metrics.width << 6; - glyph->metrics.height = (FT_Pos)metrics.height << 6; + glyph->metrics.width = (FT_Pos)metrics.width * 64; + glyph->metrics.height = (FT_Pos)metrics.height * 64; - glyph->metrics.horiBearingX = (FT_Pos)metrics.horiBearingX << 6; - glyph->metrics.horiBearingY = (FT_Pos)metrics.horiBearingY << 6; - glyph->metrics.horiAdvance = (FT_Pos)metrics.horiAdvance << 6; + glyph->metrics.horiBearingX = (FT_Pos)metrics.horiBearingX * 64; + glyph->metrics.horiBearingY = (FT_Pos)metrics.horiBearingY * 64; + glyph->metrics.horiAdvance = (FT_Pos)metrics.horiAdvance * 64; - glyph->metrics.vertBearingX = (FT_Pos)metrics.vertBearingX << 6; - glyph->metrics.vertBearingY = (FT_Pos)metrics.vertBearingY << 6; - glyph->metrics.vertAdvance = (FT_Pos)metrics.vertAdvance << 6; + glyph->metrics.vertBearingX = (FT_Pos)metrics.vertBearingX * 64; + glyph->metrics.vertBearingY = (FT_Pos)metrics.vertBearingY * 64; + glyph->metrics.vertAdvance = (FT_Pos)metrics.vertAdvance * 64; glyph->format = FT_GLYPH_FORMAT_BITMAP; @@ -2414,8 +2388,8 @@ loader->load_flags = (FT_ULong)load_flags; - loader->face = (FT_Face)face; - loader->size = (FT_Size)size; + loader->face = face; + loader->size = size; loader->glyph = (FT_GlyphSlot)glyph; loader->stream = stream; diff --git a/reactos/lib/3rdparty/freetype/src/truetype/ttgxvar.c b/reactos/lib/3rdparty/freetype/src/truetype/ttgxvar.c index 2b12483bafc..dd9e250c941 100644 --- a/reactos/lib/3rdparty/freetype/src/truetype/ttgxvar.c +++ b/reactos/lib/3rdparty/freetype/src/truetype/ttgxvar.c @@ -357,8 +357,8 @@ for ( j = 0; j < segment->pairCount; j++ ) { /* convert to Fixed */ - segment->correspondence[j].fromCoord = FT_GET_SHORT() << 2; - segment->correspondence[j].toCoord = FT_GET_SHORT() << 2; + segment->correspondence[j].fromCoord = FT_GET_SHORT() * 4; + segment->correspondence[j].toCoord = FT_GET_SHORT() * 4; FT_TRACE5(( " mapping %.4f to %.4f\n", segment->correspondence[j].fromCoord / 65536.0, @@ -514,7 +514,7 @@ for ( j = 0 ; j < (FT_UInt)gvar_head.axisCount; j++ ) { blend->tuplecoords[i * gvar_head.axisCount + j] = - FT_GET_SHORT() << 2; /* convert to FT_Fixed */ + FT_GET_SHORT() * 4; /* convert to FT_Fixed */ FT_TRACE5(( "%.4f ", blend->tuplecoords[i * gvar_head.axisCount + j] / 65536.0 )); } @@ -698,7 +698,8 @@ /* TT_Get_MM_Var initializes the blend structure. */ /* */ /* <Output> */ - /* master :: The `fvar' data (must be freed by caller). */ + /* master :: The `fvar' data (must be freed by caller). Can be NULL, */ + /* which makes this function simply load MM support. */ /* */ /* <Return> */ /* FreeType error code. 0 means success. */ @@ -1378,7 +1379,7 @@ if ( tupleIndex & GX_TI_EMBEDDED_TUPLE_COORD ) { for ( j = 0; j < blend->num_axis; j++ ) - tuple_coords[j] = FT_GET_SHORT() << 2; /* convert from */ + tuple_coords[j] = FT_GET_SHORT() * 4; /* convert from */ /* short frac to fixed */ } else @@ -1396,9 +1397,9 @@ if ( tupleIndex & GX_TI_INTERMEDIATE_TUPLE ) { for ( j = 0; j < blend->num_axis; j++ ) - im_start_coords[j] = FT_GET_SHORT() << 2; + im_start_coords[j] = FT_GET_SHORT() * 4; for ( j = 0; j < blend->num_axis; j++ ) - im_end_coords[j] = FT_GET_SHORT() << 2; + im_end_coords[j] = FT_GET_SHORT() * 4; } apply = ft_var_apply_tuple( blend, @@ -1649,13 +1650,13 @@ { FT_Vector* out_points; - FT_UInt first_point; - FT_UInt end_point; + FT_Int first_point; + FT_Int end_point; - FT_UInt first_delta; - FT_UInt cur_delta; + FT_Int first_delta; + FT_Int cur_delta; - FT_UInt point; + FT_Int point; FT_Short contour; @@ -1849,7 +1850,7 @@ if ( tupleIndex & GX_TI_EMBEDDED_TUPLE_COORD ) { for ( j = 0; j < blend->num_axis; j++ ) - tuple_coords[j] = FT_GET_SHORT() << 2; /* convert from */ + tuple_coords[j] = FT_GET_SHORT() * 4; /* convert from */ /* short frac to fixed */ } else if ( ( tupleIndex & GX_TI_TUPLE_INDEX_MASK ) >= blend->tuplecount ) @@ -1866,9 +1867,9 @@ if ( tupleIndex & GX_TI_INTERMEDIATE_TUPLE ) { for ( j = 0; j < blend->num_axis; j++ ) - im_start_coords[j] = FT_GET_SHORT() << 2; + im_start_coords[j] = FT_GET_SHORT() * 4; for ( j = 0; j < blend->num_axis; j++ ) - im_end_coords[j] = FT_GET_SHORT() << 2; + im_end_coords[j] = FT_GET_SHORT() * 4; } apply = ft_var_apply_tuple( blend, diff --git a/reactos/lib/3rdparty/freetype/src/truetype/ttinterp.c b/reactos/lib/3rdparty/freetype/src/truetype/ttinterp.c index 089f604b50f..ae2a82adc5e 100644 --- a/reactos/lib/3rdparty/freetype/src/truetype/ttinterp.c +++ b/reactos/lib/3rdparty/freetype/src/truetype/ttinterp.c @@ -88,13 +88,6 @@ #define BOUNDSL( x, n ) ( (FT_ULong)(x) >= (FT_ULong)(n) ) - /*************************************************************************/ - /* */ - /* This macro computes (a*2^14)/b and complements TT_MulFix14. */ - /* */ -#define TT_DivFix14( a, b ) FT_DivFix( a, (b) << 2 ) - - #undef SUCCESS #define SUCCESS 0 @@ -2580,26 +2573,23 @@ FT_F26Dot6 Vy, FT_UnitVector* R ) { - FT_F26Dot6 W; + FT_Vector V; - if ( FT_ABS( Vx ) < 0x4000L && FT_ABS( Vy ) < 0x4000L ) + if ( Vx == 0 && Vy == 0 ) { - if ( Vx == 0 && Vy == 0 ) - { - /* XXX: UNDOCUMENTED! It seems that it is possible to try */ - /* to normalize the vector (0,0). Return immediately. */ - return SUCCESS; - } - - Vx *= 0x4000; - Vy *= 0x4000; + /* XXX: UNDOCUMENTED! It seems that it is possible to try */ + /* to normalize the vector (0,0). Return immediately. */ + return SUCCESS; } - W = FT_Hypot( Vx, Vy ); + V.x = Vx; + V.y = Vy; - R->x = (FT_F2Dot14)TT_DivFix14( Vx, W ); - R->y = (FT_F2Dot14)TT_DivFix14( Vy, W ); + FT_Vector_NormLen( &V ); + + R->x = (FT_F2Dot14)( V.x / 4 ); + R->y = (FT_F2Dot14)( V.y / 4 ); return SUCCESS; } @@ -5157,11 +5147,11 @@ Ins_INSTCTRL( TT_ExecContext exc, FT_Long* args ) { - FT_Long K, L, Kf; + FT_ULong K, L, Kf; - K = args[1]; - L = args[0]; + K = (FT_ULong)args[1]; + L = (FT_ULong)args[0]; /* selector values cannot be `OR'ed; */ /* they are indices starting with index 1, not flags */ @@ -6505,8 +6495,6 @@ dx = exc->zp0.cur[b0].x - exc->zp1.cur[a0].x; dy = exc->zp0.cur[b0].y - exc->zp1.cur[a0].y; - exc->zp2.tags[point] |= FT_CURVE_TAG_TOUCH_BOTH; - discriminant = FT_MulDiv( dax, -dby, 0x40 ) + FT_MulDiv( day, dbx, 0x40 ); dotproduct = FT_MulDiv( dax, dbx, 0x40 ) + @@ -6543,6 +6531,8 @@ exc->zp0.cur[b0].y + exc->zp0.cur[b1].y ) / 4; } + + exc->zp2.tags[point] |= FT_CURVE_TAG_TOUCH_BOTH; } diff --git a/reactos/lib/3rdparty/freetype/src/truetype/ttobjs.c b/reactos/lib/3rdparty/freetype/src/truetype/ttobjs.c index 202aa046f42..6060d6f5d1e 100644 --- a/reactos/lib/3rdparty/freetype/src/truetype/ttobjs.c +++ b/reactos/lib/3rdparty/freetype/src/truetype/ttobjs.c @@ -191,7 +191,7 @@ { FT_Error error; FT_UInt32 checksum = 0; - int i; + FT_UInt i; if ( FT_FRAME_ENTER( length ) ) @@ -200,8 +200,8 @@ for ( ; length > 3; length -= 4 ) checksum += (FT_UInt32)FT_GET_ULONG(); - for ( i = 3; length > 0; length --, i-- ) - checksum += (FT_UInt32)( FT_GET_BYTE() << ( i * 8 ) ); + for ( i = 3; length > 0; length--, i-- ) + checksum += (FT_UInt32)FT_GET_BYTE() << ( i * 8 ); FT_FRAME_EXIT(); @@ -490,7 +490,10 @@ /* <Input> */ /* stream :: The source font stream. */ /* */ - /* face_index :: The index of the font face in the resource. */ + /* face_index :: The index of the TrueType font, if we are opening a */ + /* collection, in bits 0-15. The numbered instance */ + /* index~+~1 of a GX (sub)font, if applicable, in bits */ + /* 16-30. */ /* */ /* num_params :: Number of additional generic parameters. Ignored. */ /* */ @@ -599,7 +602,7 @@ ttface->face_flags &= ~FT_FACE_FLAG_SCALABLE; } -#else +#else /* !FT_CONFIG_OPTION_INCREMENTAL */ if ( !error ) error = tt_face_load_loca( face, stream ); @@ -623,10 +626,56 @@ ttface->face_flags &= ~FT_FACE_FLAG_SCALABLE; } -#endif +#endif /* !FT_CONFIG_OPTION_INCREMENTAL */ } +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT + + { + FT_Int instance_index = face_index >> 16; + + + if ( FT_HAS_MULTIPLE_MASTERS( ttface ) && + instance_index > 0 ) + { + error = TT_Get_MM_Var( face, NULL ); + if ( error ) + goto Exit; + + if ( face->blend->mmvar->namedstyle ) + { + FT_Memory memory = ttface->memory; + + FT_Var_Named_Style* named_style; + FT_String* style_name; + + + /* in `face_index', the instance index starts with value 1 */ + named_style = face->blend->mmvar->namedstyle + instance_index - 1; + error = sfnt->get_name( face, + (FT_UShort)named_style->strid, + &style_name ); + if ( error ) + goto Exit; + + /* set style name; if already set, replace it */ + if ( face->root.style_name ) + FT_FREE( face->root.style_name ); + face->root.style_name = style_name; + + /* finally, select the named instance */ + error = TT_Set_Var_Design( face, + face->blend->mmvar->num_axis, + named_style->coords ); + if ( error ) + goto Exit; + } + } + } + +#endif /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */ + #if defined( TT_CONFIG_OPTION_UNPATENTED_HINTING ) && \ !defined( TT_CONFIG_OPTION_BYTECODE_INTERPRETER ) diff --git a/reactos/lib/3rdparty/freetype/src/truetype/ttobjs.h b/reactos/lib/3rdparty/freetype/src/truetype/ttobjs.h index 7ac4123cac1..9396089a991 100644 --- a/reactos/lib/3rdparty/freetype/src/truetype/ttobjs.h +++ b/reactos/lib/3rdparty/freetype/src/truetype/ttobjs.h @@ -39,17 +39,6 @@ FT_BEGIN_HEADER typedef struct TT_DriverRec_* TT_Driver; - /*************************************************************************/ - /* */ - /* <Type> */ - /* TT_Instance */ - /* */ - /* <Description> */ - /* A handle to a TrueType size object. */ - /* */ - typedef struct TT_SizeRec_* TT_Size; - - /*************************************************************************/ /* */ /* <Type> */ diff --git a/reactos/lib/3rdparty/freetype/src/truetype/ttpic.h b/reactos/lib/3rdparty/freetype/src/truetype/ttpic.h index 48ba4aaf06c..076ae56efa8 100644 --- a/reactos/lib/3rdparty/freetype/src/truetype/ttpic.h +++ b/reactos/lib/3rdparty/freetype/src/truetype/ttpic.h @@ -20,7 +20,8 @@ #define __TTPIC_H__ -FT_BEGIN_HEADER +#include FT_INTERNAL_PIC_H + #ifndef FT_CONFIG_OPTION_PIC @@ -37,6 +38,8 @@ FT_BEGIN_HEADER #include FT_SERVICE_PROPERTIES_H +FT_BEGIN_HEADER + typedef struct TTModulePIC_ { FT_ServiceDescRec* tt_services; @@ -68,13 +71,12 @@ FT_BEGIN_HEADER FT_Error tt_driver_class_pic_init( FT_Library library ); +FT_END_HEADER + #endif /* FT_CONFIG_OPTION_PIC */ /* */ - -FT_END_HEADER - #endif /* __TTPIC_H__ */ diff --git a/reactos/lib/3rdparty/freetype/src/truetype/ttpload.c b/reactos/lib/3rdparty/freetype/src/truetype/ttpload.c index fb338bde3c6..4647c938aea 100644 --- a/reactos/lib/3rdparty/freetype/src/truetype/ttpload.c +++ b/reactos/lib/3rdparty/freetype/src/truetype/ttpload.c @@ -152,6 +152,14 @@ FT_TRACE2(( "adjusting num_locations to %d\n", face->num_locations )); } + else + { + face->root.num_glyphs = face->num_locations + ? (FT_Long)face->num_locations - 1 : 0; + + FT_TRACE2(( "adjusting num_glyphs to %d\n", + face->root.num_glyphs )); + } } } diff --git a/reactos/lib/3rdparty/freetype/src/truetype/ttsubpix.c b/reactos/lib/3rdparty/freetype/src/truetype/ttsubpix.c index dbda4d968f6..0d391e95a07 100644 --- a/reactos/lib/3rdparty/freetype/src/truetype/ttsubpix.c +++ b/reactos/lib/3rdparty/freetype/src/truetype/ttsubpix.c @@ -903,7 +903,7 @@ sph_set_tweaks( TT_Loader loader, FT_UInt glyph_index ) { - TT_Face face = (TT_Face)loader->face; + TT_Face face = loader->face; FT_String* family = face->root.family_name; FT_UInt ppem = loader->size->metrics.x_ppem; FT_String* style = face->root.style_name; diff --git a/reactos/lib/3rdparty/freetype/src/type1/t1gload.c b/reactos/lib/3rdparty/freetype/src/type1/t1gload.c index 5727577d4f9..56d7ccdf1ad 100644 --- a/reactos/lib/3rdparty/freetype/src/type1/t1gload.c +++ b/reactos/lib/3rdparty/freetype/src/type1/t1gload.c @@ -436,7 +436,6 @@ { FT_BBox cbox; FT_Glyph_Metrics* metrics = &t1glyph->metrics; - FT_Vector advance; /* copy the _unscaled_ advance width */ @@ -468,23 +467,26 @@ #if 1 /* apply the font matrix, if any */ - if ( font_matrix.xx != 0x10000L || font_matrix.yy != font_matrix.xx || - font_matrix.xy != 0 || font_matrix.yx != 0 ) + if ( font_matrix.xx != 0x10000L || font_matrix.yy != 0x10000L || + font_matrix.xy != 0 || font_matrix.yx != 0 ) + { FT_Outline_Transform( &t1glyph->outline, &font_matrix ); + metrics->horiAdvance = FT_MulFix( metrics->horiAdvance, + font_matrix.xx ); + metrics->vertAdvance = FT_MulFix( metrics->vertAdvance, + font_matrix.yy ); + } + if ( font_offset.x || font_offset.y ) + { FT_Outline_Translate( &t1glyph->outline, font_offset.x, font_offset.y ); - advance.x = metrics->horiAdvance; - advance.y = 0; - FT_Vector_Transform( &advance, &font_matrix ); - metrics->horiAdvance = advance.x + font_offset.x; - advance.x = 0; - advance.y = metrics->vertAdvance; - FT_Vector_Transform( &advance, &font_matrix ); - metrics->vertAdvance = advance.y + font_offset.y; + metrics->horiAdvance += font_offset.x; + metrics->vertAdvance += font_offset.y; + } #endif if ( ( load_flags & FT_LOAD_NO_SCALE ) == 0 ) diff --git a/reactos/lib/3rdparty/freetype/src/type1/t1load.c b/reactos/lib/3rdparty/freetype/src/type1/t1load.c index 376c90ce27e..dbf4eafd716 100644 --- a/reactos/lib/3rdparty/freetype/src/type1/t1load.c +++ b/reactos/lib/3rdparty/freetype/src/type1/t1load.c @@ -615,6 +615,15 @@ goto Exit; } + name = (FT_Byte*)blend->axis_names[n]; + if ( name ) + { + FT_TRACE0(( "parse_blend_axis_types:" + " overwriting axis name `%s' with `%*.s'\n", + name, len, token->start )); + FT_FREE( name ); + } + if ( FT_ALLOC( blend->axis_names[n], len + 1 ) ) goto Exit; @@ -787,6 +796,13 @@ goto Exit; } + if ( map->design_points ) + { + FT_ERROR(( "parse_blend_design_map: duplicate table\n" )); + error = FT_THROW( Invalid_File_Format ); + goto Exit; + } + /* allocate design map data */ if ( FT_NEW_ARRAY( map->design_points, num_points * 2 ) ) goto Exit; @@ -1107,6 +1123,7 @@ FT_Int result; + /* input is scaled by 1000 to accommodate default FontMatrix */ result = T1_ToFixedArray( parser, 6, temp, 3 ); if ( result < 6 ) @@ -1124,15 +1141,12 @@ return; } - /* Set Units per EM based on FontMatrix values. We set the value to */ - /* 1000 / temp_scale, because temp_scale was already multiplied by */ - /* 1000 (in t1_tofixed, from psobjs.c). */ - - root->units_per_EM = (FT_UShort)FT_DivFix( 1000, temp_scale ); - - /* we need to scale the values by 1.0/temp_scale */ + /* atypical case */ if ( temp_scale != 0x10000L ) { + /* set units per EM based on FontMatrix values */ + root->units_per_EM = (FT_UShort)FT_DivFix( 1000, temp_scale ); + temp[0] = FT_DivFix( temp[0], temp_scale ); temp[1] = FT_DivFix( temp[1], temp_scale ); temp[2] = FT_DivFix( temp[2], temp_scale ); @@ -1194,10 +1208,27 @@ else count = (FT_Int)T1_ToInt( parser ); + /* only composite fonts (which we don't support) */ + /* can have larger values */ + if ( count > 256 ) + { + FT_ERROR(( "parse_encoding: invalid encoding array size\n" )); + parser->root.error = FT_THROW( Invalid_File_Format ); + return; + } + T1_Skip_Spaces( parser ); if ( parser->root.cursor >= limit ) return; + /* PostScript happily allows overwriting of encoding arrays */ + if ( encode->char_index ) + { + FT_FREE( encode->char_index ); + FT_FREE( encode->char_name ); + T1_Release_Table( char_table ); + } + /* we use a T1_Table to store our charnames */ loader->num_chars = encode->num_chars = count; if ( FT_NEW_ARRAY( encode->char_index, count ) || @@ -1510,7 +1541,7 @@ PSAux_Service psaux = (PSAux_Service)face->psaux; - FT_Byte* cur; + FT_Byte* cur = parser->root.cursor; FT_Byte* limit = parser->root.limit; FT_Int n, num_glyphs; FT_Int notdef_index = 0; @@ -1524,6 +1555,15 @@ goto Fail; } + /* we certainly need more than 8 bytes per glyph */ + if ( num_glyphs > ( limit - cur ) >> 3 ) + { + FT_TRACE0(( "parse_charstrings: adjusting number of glyphs" + " (from %d to %d)\n", + num_glyphs, ( limit - cur ) >> 3 )); + num_glyphs = ( limit - cur ) >> 3; + } + /* some fonts like Optima-Oblique not only define the /CharStrings */ /* array but access it also */ if ( num_glyphs == 0 || parser->root.error ) diff --git a/reactos/lib/3rdparty/freetype/src/type1/t1objs.c b/reactos/lib/3rdparty/freetype/src/type1/t1objs.c index af898885545..d921063eaa4 100644 --- a/reactos/lib/3rdparty/freetype/src/type1/t1objs.c +++ b/reactos/lib/3rdparty/freetype/src/type1/t1objs.c @@ -345,7 +345,7 @@ goto Exit; /* check the face index */ - if ( face_index > 0 ) + if ( ( face_index & 0xFFFF ) > 0 ) { FT_ERROR(( "T1_Face_Init: invalid face index\n" )); error = FT_THROW( Invalid_Argument ); @@ -375,9 +375,6 @@ if ( face->blend ) root->face_flags |= FT_FACE_FLAG_MULTIPLE_MASTERS; - /* XXX: TODO -- add kerning with .afm support */ - - /* The following code to extract the family and the style is very */ /* simplistic and might get some things wrong. For a full-featured */ /* algorithm you might have a look at the whitepaper given at */ diff --git a/reactos/lib/3rdparty/freetype/src/type1/t1parse.c b/reactos/lib/3rdparty/freetype/src/type1/t1parse.c index c73b2b25da4..0b685026067 100644 --- a/reactos/lib/3rdparty/freetype/src/type1/t1parse.c +++ b/reactos/lib/3rdparty/freetype/src/type1/t1parse.c @@ -334,7 +334,6 @@ /* first of all, look at the `eexec' keyword */ FT_Byte* cur = parser->base_dict; FT_Byte* limit = cur + parser->base_len; - FT_Byte c; FT_Pointer pos_lf; FT_Bool test_cr; @@ -342,9 +341,9 @@ Again: for (;;) { - c = cur[0]; - if ( c == 'e' && cur + 9 < limit ) /* 9 = 5 letters for `eexec' + */ - /* whitespace + 4 chars */ + if ( cur[0] == 'e' && + cur + 9 < limit ) /* 9 = 5 letters for `eexec' + */ + /* whitespace + 4 chars */ { if ( cur[1] == 'e' && cur[2] == 'x' && @@ -374,8 +373,15 @@ while ( cur < limit ) { - if ( *cur == 'e' && ft_strncmp( (char*)cur, "eexec", 5 ) == 0 ) - goto Found; + if ( cur[0] == 'e' && + cur + 5 < limit ) + { + if ( cur[1] == 'e' && + cur[2] == 'x' && + cur[3] == 'e' && + cur[4] == 'c' ) + goto Found; + } T1_Skip_PS_Token( parser ); if ( parser->root.error ) @@ -389,6 +395,15 @@ cur = limit; limit = parser->base_dict + parser->base_len; + + if ( cur >= limit ) + { + FT_ERROR(( "T1_Get_Private_Dict:" + " premature end in private dictionary\n" )); + error = FT_THROW( Invalid_File_Format ); + goto Exit; + } + goto Again; /* now determine where to write the _encrypted_ binary private */ diff --git a/reactos/lib/3rdparty/freetype/src/type42/t42objs.c b/reactos/lib/3rdparty/freetype/src/type42/t42objs.c index 2756adfee38..430871aced6 100644 --- a/reactos/lib/3rdparty/freetype/src/type42/t42objs.c +++ b/reactos/lib/3rdparty/freetype/src/type42/t42objs.c @@ -208,7 +208,7 @@ goto Exit; /* check the face index */ - if ( face_index > 0 ) + if ( ( face_index & 0xFFFF ) > 0 ) { FT_ERROR(( "T42_Face_Init: invalid face index\n" )); error = FT_THROW( Invalid_Argument ); @@ -652,11 +652,16 @@ FT_Error error; T42_GlyphSlot t42slot = (T42_GlyphSlot)glyph; T42_Size t42size = (T42_Size)size; + T42_Face t42face = (T42_Face)size->face; FT_Driver_Class ttclazz = ((T42_Driver)glyph->face->driver)->ttclazz; FT_TRACE1(( "T42_GlyphSlot_Load: glyph index %d\n", glyph_index )); + /* map T42 glyph index to embedded TTF's glyph index */ + glyph_index = (FT_UInt)ft_atol( + (const char *)t42face->type1.charstrings[glyph_index] ); + t42_glyphslot_clear( t42slot->ttslot ); error = ttclazz->load_glyph( t42slot->ttslot, t42size->ttsize, diff --git a/reactos/lib/3rdparty/freetype/src/type42/t42parse.c b/reactos/lib/3rdparty/freetype/src/type42/t42parse.c index 109e996e061..003b63ed775 100644 --- a/reactos/lib/3rdparty/freetype/src/type42/t42parse.c +++ b/reactos/lib/3rdparty/freetype/src/type42/t42parse.c @@ -246,13 +246,12 @@ T42_Parser parser = &loader->parser; FT_Matrix* matrix = &face->type1.font_matrix; FT_Vector* offset = &face->type1.font_offset; - FT_Face root = (FT_Face)&face->root; FT_Fixed temp[6]; FT_Fixed temp_scale; FT_Int result; - result = T1_ToFixedArray( parser, 6, temp, 3 ); + result = T1_ToFixedArray( parser, 6, temp, 0 ); if ( result < 6 ) { @@ -264,18 +263,12 @@ if ( temp_scale == 0 ) { - FT_ERROR(( "t1_parse_font_matrix: invalid font matrix\n" )); + FT_ERROR(( "t42_parse_font_matrix: invalid font matrix\n" )); parser->root.error = FT_THROW( Invalid_File_Format ); return; } - /* Set Units per EM based on FontMatrix values. We set the value to */ - /* 1000 / temp_scale, because temp_scale was already multiplied by */ - /* 1000 (in t1_tofixed, from psobjs.c). */ - - root->units_per_EM = (FT_UShort)FT_DivFix( 1000, temp_scale ); - - /* we need to scale the values by 1.0/temp_scale */ + /* atypical case */ if ( temp_scale != 0x10000L ) { temp[0] = FT_DivFix( temp[0], temp_scale ); @@ -339,10 +332,27 @@ else count = (FT_Int)T1_ToInt( parser ); + /* only composite fonts (which we don't support) */ + /* can have larger values */ + if ( count > 256 ) + { + FT_ERROR(( "t42_parse_encoding: invalid encoding array size\n" )); + parser->root.error = FT_THROW( Invalid_File_Format ); + return; + } + T1_Skip_Spaces( parser ); if ( parser->root.cursor >= limit ) return; + /* PostScript happily allows overwriting of encoding arrays */ + if ( encode->char_index ) + { + FT_FREE( encode->char_index ); + FT_FREE( encode->char_name ); + T1_Release_Table( char_table ); + } + /* we use a T1_Table to store our charnames */ loader->num_chars = encode->num_chars = count; if ( FT_NEW_ARRAY( encode->char_index, count ) || @@ -421,6 +431,13 @@ { charcode = (FT_Int)T1_ToInt( parser ); T1_Skip_Spaces( parser ); + + /* protect against invalid charcode */ + if ( cur == parser->root.cursor ) + { + parser->root.error = FT_THROW( Unknown_File_Format ); + return; + } } cur = parser->root.cursor; @@ -455,10 +472,10 @@ /* immediates-only mode we would get an infinite loop if */ /* we don't do anything here. */ /* */ - /* This encoding array is not valid according to the type1 */ - /* specification (it might be an encoding for a CID type1 */ - /* font, however), so we conclude that this font is NOT a */ - /* type1 font. */ + /* This encoding array is not valid according to the */ + /* type42 specification (it might be an encoding for a CID */ + /* type42 font, however), so we conclude that this font is */ + /* NOT a type42 font. */ parser->root.error = FT_THROW( Unknown_File_Format ); return; } @@ -494,7 +511,7 @@ face->type1.encoding_type = T1_ENCODING_TYPE_ISOLATIN1; else - parser->root.error = FT_THROW( Ignore ); + parser->root.error = FT_ERR( Ignore ); } } @@ -824,6 +841,15 @@ /* initialize tables */ + /* contrary to Type1, we disallow multiple CharStrings arrays */ + if ( swap_table->init ) + { + FT_ERROR(( "t42_parse_charstrings:" + " only one CharStrings array allowed\n" )); + error = FT_THROW( Invalid_File_Format ); + goto Fail; + } + error = psaux->ps_table_funcs->init( code_table, loader->num_glyphs, memory ); diff --git a/reactos/lib/3rdparty/freetype/src/winfonts/winfnt.c b/reactos/lib/3rdparty/freetype/src/winfonts/winfnt.c index 06f1861afbe..4bfa55a4296 100644 --- a/reactos/lib/3rdparty/freetype/src/winfonts/winfnt.c +++ b/reactos/lib/3rdparty/freetype/src/winfonts/winfnt.c @@ -269,16 +269,19 @@ static FT_Error fnt_face_get_dll_font( FNT_Face face, - FT_Int face_index ) + FT_Int face_instance_index ) { FT_Error error; FT_Stream stream = FT_FACE( face )->stream; FT_Memory memory = FT_FACE( face )->memory; WinMZ_HeaderRec mz_header; + FT_Long face_index; face->font = NULL; + face_index = FT_ABS( face_instance_index ) & 0xFFFF; + /* does it begin with an MZ header? */ if ( FT_STREAM_SEEK( 0 ) || FT_STREAM_READ_FIELDS( winmz_header_fields, &mz_header ) ) @@ -317,6 +320,21 @@ size_shift = FT_GET_USHORT_LE(); + /* Microsoft's specification of the executable-file header format */ + /* for `New Executable' (NE) doesn't give a limit for the */ + /* alignment shift count; however, in 1985, the year of the */ + /* specification release, only 32bit values were supported, thus */ + /* anything larger than 16 doesn't make sense in general, given */ + /* that file offsets are 16bit values, shifted by the alignment */ + /* shift count */ + if ( size_shift > 16 ) + { + FT_TRACE2(( "invalid alignment shift count for resource data\n" )); + error = FT_THROW( Invalid_File_Format ); + goto Exit; + } + + for (;;) { FT_UShort type_id, count; @@ -359,13 +377,14 @@ face->root.num_faces = font_count; + if ( face_instance_index < 0 ) + goto Exit; + if ( face_index >= font_count ) { error = FT_THROW( Invalid_Argument ); goto Exit; } - else if ( face_index < 0 ) - goto Exit; if ( FT_NEW( face->font ) ) goto Exit; @@ -689,13 +708,14 @@ static FT_Error FNT_Face_Init( FT_Stream stream, FT_Face fntface, /* FNT_Face */ - FT_Int face_index, + FT_Int face_instance_index, FT_Int num_params, FT_Parameter* params ) { FNT_Face face = (FNT_Face)fntface; FT_Error error; FT_Memory memory = FT_FACE_MEMORY( face ); + FT_Int face_index; FT_UNUSED( num_params ); FT_UNUSED( params ); @@ -703,9 +723,11 @@ FT_TRACE2(( "Windows FNT driver\n" )); + face_index = FT_ABS( face_instance_index ) & 0xFFFF; + /* try to load font from a DLL */ - error = fnt_face_get_dll_font( face, face_index ); - if ( !error && face_index < 0 ) + error = fnt_face_get_dll_font( face, face_instance_index ); + if ( !error && face_instance_index < 0 ) goto Exit; if ( FT_ERR_EQ( error, Unknown_File_Format ) ) @@ -726,10 +748,11 @@ if ( !error ) { + if ( face_instance_index < 0 ) + goto Exit; + if ( face_index > 0 ) error = FT_THROW( Invalid_Argument ); - else if ( face_index < 0 ) - goto Exit; } } diff --git a/reactos/media/doc/3rd Party Files.txt b/reactos/media/doc/3rd Party Files.txt index 50f1a60c88f..5e389e60d83 100644 --- a/reactos/media/doc/3rd Party Files.txt +++ b/reactos/media/doc/3rd Party Files.txt @@ -23,7 +23,7 @@ Used Version: 1.1 Website: http://www.geocities.com/dborca/opengl/tc.html Title: FreeType -Used Version: 2.6.0 +Used Version: 2.6.1 Website: http://www.freetype.org Title: Mesa3D