Commit Graph

13764 Commits

Author SHA1 Message Date
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
Garret Rieger 38e81f2be9 [subset] Add --layout-scripts command line flag. 2022-06-30 21:09:11 +00:00
Garret Rieger 70e32a662f [subset] Add layout_scripts to subset input. 2022-06-30 21:00:48 +00:00
Behdad Esfahbod 13c499cb26 [hvar] Minor internal rewiring
Not passing font to functions makes it more clear that they don't
scale values.
2022-06-30 14:25:09 -06:00
Garret Rieger 41d2c335bc [subset] Apply script list filter when doing layout collection. 2022-06-30 20:24:42 +00:00
Garret Rieger e5c8a2f4e1 [subset] Pass plan through to collect methods.
Allows to more easily access the filtering sets as they are added and enables propagating errors to the plan.
2022-06-30 20:14:29 +00:00
Behdad Esfahbod aba4a4957a [ot-font] Disable VORG variation code in HB_NO_VAR 2022-06-30 14:13:44 -06:00
Behdad Esfahbod d5921b379b [tt-font] Apply VVAR.vOrg variation to VORG origin
Mostly fixes https://github.com/harfbuzz/harfbuzz/issues/1694
2022-06-30 14:09:09 -06:00
Behdad Esfahbod eee29f7327 [hmtx] Specialize var_table 2022-06-30 14:09:09 -06:00
Behdad Esfahbod 031fd20a5a [perf] Update README 2022-06-30 14:09:09 -06:00
Garret Rieger 1bf051ef3b [subset] refactor feature tag filtering so it can be used for scripts as well. 2022-06-30 20:03:33 +00:00
Khaled Hosny f6f93c30f3 [docs] Fix warning
These comment blocks don’t use gtk-doc syntax.
2022-06-30 08:50:59 +02:00
Khaled Hosny d9c5292b27 [docs] Remove duplicate or non existing symbols 2022-06-30 08:47:49 +02:00
Khaled Hosny 98e90cc67c [docs] Reduce warnings
Use markdown syntax for inline code blocks instead of %true, %false, and
%NULL.
2022-06-30 08:44:40 +02:00
Behdad Esfahbod c69ec6f5bb [kern2] Fix sanitize issue on 32bit systems
Fixes https://github.com/harfbuzz/harfbuzz/issues/3483
2022-06-29 16:32:59 -06:00
Frédéric Wang 32e542d6f0 try & fix build errors on the bot 2022-06-29 10:08:07 -06:00
Frédéric Wang 03d2376745 [math] Improve fuzzing coverage
Extend testing to cover parts that are missing according to the recent
oss-fuzz-coverage report:
- Retriving all constants from MathConstants.
- Retrieving entries from MathKern, MathGlyphPartRecord and
  MathGlyphAssembly.
- Retrieving italic correction from MathGlyphAssembly.
- Choosing between horizontal/vertical offset in MathVariants.

https://storage.googleapis.com/oss-fuzz-coverage/harfbuzz/reports/20220627/linux/src/harfbuzz/src/hb-ot-math-table.hh.html
https://github.com/harfbuzz/harfbuzz/issues/3688
2022-06-29 10:08:07 -06:00
Khaled Hosny 22835dea29 [docs] Add missing symbol 2022-06-29 07:49:28 +02:00
Khaled Hosny 34d3d49e78 [docs] Fix Since annotation 2022-06-29 07:46:21 +02:00
Khaled Hosny 096aaa62a6 4.4.1 2022-06-29 07:30:05 +02:00
Khaled Hosny 4d1d7aec8d [docs] Add missing 4.4.0 index 2022-06-29 07:29:39 +02:00
Behdad Esfahbod 050f169078 [GPOS/kerx] Call into impl namespace from kerx 2022-06-28 18:52:27 -06:00
Garret Rieger 910a137f4e [reorg] Fix propagate_attachment_offsets definition. 2022-06-28 18:47:50 -06:00
Garret Rieger 3fbf2dece7 [reorg] Move OT::Layout::GPOS_impl::GPOS to OT::Layout::GPOS. 2022-06-28 18:47:50 -06:00
Garret Rieger 88ef3c5a9a [reorg] Change OT::Layout::GPOS to OT::Layout::GPOS_impl. 2022-06-28 18:47:50 -06:00
Garret Rieger 49ddf069e0 [reorg] Move GPOS reverse_cursive_minor_offset implementation into new directory layout. 2022-06-28 18:47:50 -06:00
Garret Rieger 74f45f7c2a [reorg] Move remaining GPOS lookup types to new directory. 2022-06-28 18:47:50 -06:00
Garret Rieger 197d9a5c99 [reorg] Move more GPOS lookups to new directory. 2022-06-28 18:47:50 -06:00