Commit Graph

13791 Commits

Author SHA1 Message Date
Behdad Esfahbod 68b2742fe4 [GPOS] Move code around 2022-07-07 16:11:15 -06:00
Behdad Esfahbod 6a3043a0c1 Fix tests 2022-07-07 14:51:37 -06:00
Behdad Esfahbod aa68657434 [Makefile.sources/meson.build] Sort file names 2022-07-07 14:07:45 -06:00
Behdad Esfahbod 0b0e3b30ce [GPOS] Break down PairPosFormat1 into new layout 2022-07-07 14:06:44 -06:00
Not-a-Bug Won't Fix aec34e17eb Fix target_link_libraries signatures mixing 2022-07-07 13:35:50 -06:00
Behdad Esfahbod a64fc71033
Merge pull request #3710 from googlefonts/24bit_repacking
[subset] Prepare the repacker for handling 24bit offsets in GSUB/GPOS.
2022-07-07 13:35:38 -06:00
Garret Rieger 6fad6b4113 [repacker] add tests for special casing of 24bit offsets. 2022-07-06 19:18:27 +00:00
Garret Rieger b4f561dbbf [subset] Add some comments to find_space_roots/find_32_bit_roots methods. 2022-07-06 18:49:23 +00:00
Garret Rieger 401066bf3d [subset] Prepare the repacker for handling 24bit offsets in GSUB/GPOS.
The boring expansion (https://github.com/be-fonts/boring-expansion-spec) plans to introduce 24bit offsets into GSUB/GPOS. This changes the repacker to treat 24 bit offsets similar to 32 bit offsets and assign the top level 24 bit offsets into spaces to improve packing.
2022-07-06 18:44:40 +00:00
Luca Bacci 3a722c5354 Fixes for DWrite header checks 2022-07-06 12:00:36 -06:00
Behdad Esfahbod c091d029c2
Merge pull request #3706 from lb90/dwrite-dll
Load DirectWrite dynamically
2022-07-06 10:51:04 -06:00
Luca Bacci 1abc14b463 Do not link with the DWrite lib
It's loaded dynamically now
2022-07-06 17:55:39 +02:00
Luca Bacci c22acfa8bd Fix function pointer typedef 2022-07-06 17:55:24 +02:00
Behdad Esfahbod 2587dced4c
Merge pull request #3707 from kleisauke/workaround-gcc-bug
Fix build on GCC < 7
2022-07-06 09:38:18 -06:00
Kleis Auke Wolthuizen 79eb0f7486 [GSUB] Fix build on GCC < 7 2022-07-06 14:00:16 +02:00
Kleis Auke Wolthuizen 3238cb744b [GPOS] Fix build on GCC < 7 2022-07-06 14:00:16 +02:00
Luca Bacci 3e881efbe4 Revert "Revert "Revert "[hb-directwrite] Don't load dwrit.dll dynamically"""
This reverts commit 361a438658.
2022-07-06 13:51:56 +02:00
Kleis Auke Wolthuizen 7b51bc95d9 [cplusplus] Fix build on GCC < 7 2022-07-06 13:12:00 +02:00
Behdad Esfahbod 386e1bbad8
Merge pull request #3699 from googlefonts/filter_scripts
[subset] Add support for --layout-scripts
2022-07-05 12:46:05 -06:00
Garret Rieger 30309ec8d3 [subset] add null element in _filter_tag_list. 2022-07-05 18:33:19 +00:00
Garret Rieger 216cf5946b [subset] Allocate space for null entry in script/feature list. 2022-07-05 17:49:12 +00:00
Behdad Esfahbod d9ab805e61 Fix LookupFlag negation
Fixes https://github.com/harfbuzz/harfbuzz/issues/3703
2022-07-05 11:45:10 -06:00
Behdad Esfahbod b0cb9a1a63 Make get_leading_bearing return bool
Fixes https://github.com/harfbuzz/harfbuzz/issues/3496

Part of supporting >64k glyphs correctly.
2022-07-03 15:32:32 -06:00
Behdad Esfahbod 115e1a03e7 [glyf] Relax condition for matching number of coords 2022-07-03 14:45:12 -06:00
Behdad Esfahbod 800760c5bd [glyf] Rename get_extents functions for clarity 2022-07-03 13:21:06 -06:00
Behdad Esfahbod ab327f93b7 [glyf] Fix another bug with scaling
Of advances this time.

That codepath is never exercised though, if font has HVAR table.
2022-07-03 13:17:03 -06:00
Behdad Esfahbod f46ddeba48 [hmtx/glyf] Rename side-bearing functions for clarity 2022-07-03 13:12:49 -06:00
Behdad Esfahbod 23435d5285 [hvar] Rename advance function for clarity 2022-07-03 13:04:27 -06:00
Behdad Esfahbod 9f974cae4a [hvar] Rename lsb function for clarity 2022-07-03 13:03:12 -06:00
Behdad Esfahbod ab5ce64313 [VVAR] Rename vorg function for clarity 2022-07-03 13:00:22 -06:00
Behdad Esfahbod b2d60cbd6e [glyf] Rename advance functions for clarity 2022-07-03 12:56:48 -06:00
Behdad Esfahbod 35c00c1216 [hmtx] Rename advance functions for clarity 2022-07-03 12:54:17 -06:00
Behdad Esfahbod 6b82d4faa1 [glyf] Make an optional argument non-optional 2022-07-03 12:45:27 -06:00
Behdad Esfahbod 3ef590808f [glyf] Internal flip a variable 2022-07-03 12:44:24 -06:00
Behdad Esfahbod b07fa2bb1a [ot-font] Respect VORG even if it has no variations 2022-07-03 12:39:55 -06:00
Behdad Esfahbod 71d52e10aa [var] Fix getting side-bearing variations
In HVAR/VVAR, if the side-bearing mappings are null, it means the
table does not have them and they should be loaded from glyf table.
Previous logic was returning zer0.

Part of fixing https://github.com/harfbuzz/harfbuzz/issues/1694
2022-07-03 12:39:55 -06:00
Behdad Esfahbod 78b4f39821 [glyf] Fix confusion between scaled vs unscaled lsb
Was always broken.
2022-07-03 12:39:55 -06:00
Behdad Esfahbod 6665881c7d [glyf] Change side-bearing rounding 2022-07-03 12:39:55 -06:00
Behdad Esfahbod 0a295fcde6 [var] Fix DeltaSetIndexMapFormat1
Fixes https://github.com/harfbuzz/harfbuzz/issues/3692
2022-07-01 17:16:24 -06:00
Behdad Esfahbod 351cccdb75 [buffer-deserialize] Deserialize glyph flags
Fixes https://github.com/harfbuzz/harfbuzz/issues/1482
2022-07-01 16:52:49 -06:00
Behdad Esfahbod 5134041f21 [deserialize-json] Make it actually work!
Was not correctly deserializing glyph names as it was not dropping
double-quotes from glyph name before parsing.
2022-07-01 16:48:47 -06:00
Behdad Esfahbod 534b0911f7 [aat-layout] Add an unlikely() 2022-07-01 16:20:31 -06:00
Behdad Esfahbod b8c7c0a0e6 [fuzzer] In 50% of runs don't fail the allocator 2022-07-01 15:25:09 -06:00
Stephan Bergmann 14b018124c hb_graphite2_cluster_t::advance can apparently be negative
...as seen with HarfBuzz used by LibreOffice, with `instdir/program/soffice
--headless --convert-to pdf` of doc/abi6073-2.doc from the LibreOffice crash-
testing corpus when run under UBSan,

> hb-graphite2.cc:361:15: runtime error: -1024 is outside the range of representable values of type 'unsigned int'
>  #0 in _hb_graphite2_shape at workdir/UnpackedTarball/harfbuzz/src/hb-graphite2.cc:361:15
>  #1 in _hb_shape_plan_execute_internal(hb_shape_plan_t*, hb_font_t*, hb_buffer_t*, hb_feature_t const*, unsigned int) at workdir/UnpackedTarball/harfbuzz/src/./hb-shaper-list.hh:38:1
>  #2 in hb_shape_plan_execute at workdir/UnpackedTarball/harfbuzz/src/hb-shape-plan.cc:453:14
>  #3 in hb_shape_full at workdir/UnpackedTarball/harfbuzz/src/hb-shape.cc:139:19
>  #4 in GenericSalLayout::LayoutText(ImplLayoutArgs&, SalLayoutGlyphsImpl const*) at vcl/source/gdi/CommonSalLayout.cxx:495:23
>  #5 in OutputDevice::getFallbackLayout(LogicalFontInstance*, int, ImplLayoutArgs&, SalLayoutGlyphs const*) const at vcl/source/outdev/font.cxx:1232:21
>  #6 in OutputDevice::ImplGlyphFallbackLayout(std::unique_ptr<SalLayout, std::default_delete<SalLayout> >, ImplLayoutArgs&, SalLayoutGlyphs const*) const at vcl/source/outdev/font.cxx:1300:48
>  #7 in OutputDevice::ImplLayout(rtl::OUString const&, int, int, Point const&, long, long const*, SalLayoutFlags, vcl::TextLayoutCache const*, SalLayoutGlyphs const*) const at vcl/source/outdev/text.cxx:1332:22
>  #8 in lcl_CreateLayout(SwTextGlyphsKey const&, __gnu_debug::_Safe_iterator<std::_Rb_tree_iterator<std::pair<SwTextGlyphsKey const, SwTextGlyphsData> >, std::__debug::map<SwTextGlyphsKey, SwTextGlyphsData, std::less<SwTextGlyphsKey>, std::allocator<std::pair<SwTextGlyphsKey const, SwTextGlyphsData> > >, std::bidirectional_iterator_tag>) at sw/source/core/txtnode/fntcache.cxx:233:33
>  #9 in SwFntObj::GetCachedSalLayoutGlyphs(SwTextGlyphsKey const&) at sw/source/core/txtnode/fntcache.cxx:257:12
>  #10 in SwFont::GetTextBreak(SwDrawTextInfo const&, long) at sw/source/core/txtnode/fntcache.cxx:2551:58
>  #11 in SwTextSizeInfo::GetTextBreak(long, o3tl::strong_int<int, Tag_TextFrameIndex>, unsigned short, vcl::TextLayoutCache const*) const at sw/source/core/text/inftxt.cxx:450:20
>  #12 in SwTextGuess::Guess(SwTextPortion const&, SwTextFormatInfo&, unsigned short) at sw/source/core/text/guess.cxx:205:26
>  #13 in SwTextPortion::Format_(SwTextFormatInfo&) at sw/source/core/text/portxt.cxx:305:32
>  #14 in SwTextPortion::Format(SwTextFormatInfo&) at sw/source/core/text/portxt.cxx:456:12
>  #15 in SwLineLayout::Format(SwTextFormatInfo&) at sw/source/core/text/porlay.cxx:260:31

(where in frame #4 GenericSalLayout::LayoutText, pHbBuffer->props.direction is
HB_DIRECTION_RTL, in case that is relevant).

It is unclear to me whether it is sufficient to only change
hb_graphite2_cluster_t::advance from signed to unsigned int, as there are other
unsigned int variables (like curradv in _hb_graphite2_shape) whose value depend
on hb_graphite2_cluster_t::advance, and which thus might also become negative.
But unlike the float -> unsigned int conversion that UBSan warned about here
(where gr_slot_origin_X() and xscale are float), those are signed int ->
unsigned int conversions that do not cause undefined behavior.  At least, with
this change, the above --convert-to pdf and a full `make check screenshot`
succeeded for me under without further UBSan warnings.

(For the version of HarfBuzz optionally built as part of the LibreOffice build,
this has been addressed with
<https://git.libreoffice.org/core/+/6e53e03f752c2f85283c4d47efaaf0683299783c%5E!/>
"external/harfbuzz: hb_graphite2_cluster_t::advance can apparently be
negative.")
2022-07-01 12:00:09 -06:00
Garret Rieger dbfd2bf327 minor. 2022-06-30 23:04:35 +00:00
Garret Rieger d6f579e96a [subset] add tests that exercise script filtering. 2022-06-30 22:22:03 +00:00
Garret Rieger 79bdcbef0d [subset] Fix GDEF version downgrade logic. 2022-06-30 22:20:32 +00:00
Garret Rieger 587969af42 [subset] Drop scripts that are not in the layout_scripts list. 2022-06-30 21:37:42 +00:00
Garret Rieger 900476c635 Move GSUB.hh GPOS.hh back into the GPOS/GSUB sub directories. 2022-06-30 15:33:20 -06:00
Garret Rieger 5fdae68481 [reorg] Move GSUB.hh up one level and change GSUB namespace to GSUB_impl. 2022-06-30 15:33:20 -06:00