Commit Graph

10201 Commits

Author SHA1 Message Date
Behdad Esfahbod 3f2daae630 More GCC pragmas 2019-01-17 15:27:31 -05:00
Behdad Esfahbod d6c5473e1f Rename macro 2019-01-17 15:22:46 -05:00
Behdad Esfahbod a9946b7cfe Add more GCC warning pragmas 2019-01-17 15:22:28 -05:00
Behdad Esfahbod 868b0c0c2e Move -Wcast-align to hb.hh 2019-01-17 15:18:18 -05:00
Behdad Esfahbod 8874eef8ff Add pragram GCC diagnostic ignored "-Wunused-macros" 2019-01-17 15:04:44 -05:00
Behdad Esfahbod cc8e9a436f [AAT] Fully sanitize ankr table at sanitize time
Third try to fix access. Followup 6879efc2c1

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=12532
Fixes https://bugs.chromium.org/p/chromium/issues/detail?id=922303
2019-01-17 14:55:05 -05:00
Behdad Esfahbod 6879efc2c1 [AAT] Fix anchor bound checking, again
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=12532
Fixes https://bugs.chromium.org/p/chromium/issues/detail?id=922303
2019-01-17 14:08:02 -05:00
Behdad Esfahbod a262eb3d0b [aat] Minor 2019-01-17 14:06:32 -05:00
Behdad Esfahbod c986ca15a6 Improve overflow avoidance
Better fix for 480406cd3e
This way we behave the same on 32bit and 64bit archs.
2019-01-15 13:58:19 -05:00
Tor Arne Vestbø f401f85a5a Remove assumption about Core Text working in 96 DPI
Core Text doesn't actually have a concept of DPI internally, as it
doesn't rasterize anything by itself, it just generates vector paths
that get passed along to Core Graphics.

In practice this means Core Text operates in the classical macOS
logical DPI of 72, with one typographic point corresponding to one
point in the Core Graphics coordinate system, which for a normal
bitmap context then corresponds to one pixel -- or two pixels for
a "retina" context with a 2x scale transform.

Scaling the font point sizes given to HarfBuzz to an assumed DPI
of 96 is problematic with this in mind, as fonts with optical
features such as 'trak' tables for tracking, or color glyphs,
will then base the metrics off of the wrong point size compared
to what the client asked for.

This in turn causes mismatches between the metrics of the shaped
text and the actual rasterization, which doesn't include the 72
to 96 DPI scaling.

If a 96 DPI is needed, such as on the Web, the scaling should be
done outside of HarfBuzz, allowing the client to keep the DPI of
the shaping in sync with the rasterization.

The recommended way to do that is by scaling the font point size,
not by applying a transform to the target Core Graphics context,
to let Core Text choose the right optical features of the target
point size, as described in WWDC 2015 session 804:

  https://developer.apple.com/videos/play/wwdc2015/804/
2019-01-15 13:26:35 +01:00
Behdad Esfahbod 0d2727f4fe
fix FDSelect fuzzing bug (#1539)
Rewrote struct FDSelect3_4.ranges as ArrayOf
Updated FDSelect3_4::sanitize () to call ranges.sanitize ()
nRanges now a function to return a reference to ranges.len
2019-01-14 18:23:17 -08:00
Behdad Esfahbod 9f6172d669 Move _POSIX_SOURCE definition
Fixes https://github.com/harfbuzz/harfbuzz/issues/1308
2019-01-14 20:45:31 -05:00
Behdad Esfahbod 91d774712f [test] Add test for previous commit 2019-01-14 15:31:31 -05:00
Behdad Esfahbod 480406cd3e Fix assertion on address overflow
Fixes https://bugs.chromium.org/p/chromium/issues/detail?id=917031
2019-01-14 15:27:34 -05:00
Behdad Esfahbod 7a6686a589 [AAT] Fix mort ContextualSubtable offset access
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=12312
2019-01-14 15:09:14 -05:00
Behdad Esfahbod a3fa7d3336 [AAT] Fix ankr table access
Fixes https://bugs.chromium.org/p/chromium/issues/detail?id=918340
2019-01-14 14:37:36 -05:00
Michiharu Ariza 760303d411 deleted a duplicate fontdicts_mod.fini() call (#1538) 2019-01-11 15:27:35 -08:00
Ebrahim Byagowi 5110f3da9a
Add an initial .clang-format config
There are things can be improved on clang-format side I guess before
the full assertion, but is the best we can get for now I guess.

Fixes https://github.com/harfbuzz/harfbuzz/issues/1536
2019-01-09 16:01:11 +03:30
Ebrahim Byagowi 099bca6d40
Minor, hack .editorconfig for vscode use
As VSCode and Atom https://github.com/Microsoft/vscode/issues/44438 don't support it
2019-01-09 15:56:32 +03:30
Michiharu Ariza 7b48641aa8 fix leak in subset_enc_supp_codes (#1537)
oss-fuzz issue 12310
2019-01-08 15:37:48 -05:00
Ebrahim Byagowi 97f67a3c3d
[ci] Enable more of GCC compile warnings (#1533) 2019-01-04 23:10:39 +03:30
Nathan Willis ad95487038 Usermanual: small formatting and wording fixes. 2019-01-04 15:43:07 +02:00
Nathan Willis ed13caddf2 Usermanual: small updates. 2019-01-04 15:43:07 +02:00
cclauss 26c5b54fb0 CircleCI: Test for Python 3 syntax errors and undefined names (#1522)
Catch missing imports and errors like #1520 and #1521

__E901,E999,F821,F822,F823__ are the "_showstopper_" [flake8](http://flake8.pycqa.org) issues that can halt the runtime with a SyntaxError, NameError, etc. Most other flake8 issues are merely "style violations" -- useful for readability but they do not effect runtime safety.
* F821: undefined name `name`
* F822: undefined name `name` in `__all__`
* F823: local variable name referenced before assignment
* E901: SyntaxError or IndentationError
* E999: SyntaxError -- failed to compile a file into an Abstract Syntax Tree
2018-12-31 07:00:43 +03:30
Behdad Esfahbod 686e6f2e40 Fix automake warnings
[skip ci]
2018-12-30 11:28:06 -05:00
cclauss b5c12b9f4d print() is a function in Python 3 (#1520) 2018-12-30 15:37:28 +03:30
cclauss f4da28b1f1 Python 3 fixes to gen-os2-unicode-ranges.py (#1521)
In Python 3, __reload()__ was moved and __sys.setdefaultencoding()__ because the default is already utf-8.  Also __Error()__ is an _undefined name_ and __Exception()__ creates a generic exception.
2018-12-30 15:28:34 +03:30
Ebrahim Byagowi e5989e0962 [cmake] Enable C++11 on CMake (#1519) 2018-12-30 01:53:47 -05:00
Behdad Esfahbod d092fb2719 Ouch! Fix build on C++<11 2018-12-30 01:53:03 -05:00
Behdad Esfahbod 89949ed28d Fix ubsan with passing nullptr to qsort() 2018-12-30 01:52:19 -05:00
Behdad Esfahbod 357a0a7ad3 Fix build on C++ < 11 2018-12-27 18:29:23 -05:00
Behdad Esfahbod 54c0a17310 [vector] Fix warning 2018-12-27 18:28:07 -05:00
Behdad Esfahbod 1043ddbee8 [aat] Minor 2018-12-27 18:27:11 -05:00
Behdad Esfahbod 71da9ca62f [vector] Remove use of arrayZ() by using casts 2018-12-27 18:01:06 -05:00
Behdad Esfahbod fa333e34d6 [vector] Remove static_array
Was good idea, but with C++ types with constructor/destructor, was getting in
the way as compiler was destructing those items where it was not desired.
Since C++ does not allow zero-sized arrays, just remove it...
2018-12-27 17:56:22 -05:00
Behdad Esfahbod ab2258a419 [vector] Use allocated = -1 to signify failure 2018-12-27 17:45:05 -05:00
Michiharu Ariza 09fa536d89 fix lealk with cff2::accelerator_templ_t::topDict (#1517) 2018-12-27 11:33:09 -05:00
Behdad Esfahbod 3b81442cd5 [vector] Change pre-alloced count from 8 to 2
I'm thinking about dropping it to zero, but that needs slight code changes.
2018-12-24 11:31:04 -05:00
Behdad Esfahbod d25a2f1496 Fix a few warnings 2018-12-23 20:34:24 -05:00
Behdad Esfahbod 85003b594b [iter] Fix warning 2018-12-23 20:34:24 -05:00
Behdad Esfahbod e4355b1ca1 [set] Add iter_t as alias to const_iter_t 2018-12-23 20:34:24 -05:00
Behdad Esfahbod 33f8de6186 [set] Change to const_iter 2018-12-23 20:34:24 -05:00
Behdad Esfahbod f88fed5cd8 [set] Cache length in iterator 2018-12-23 20:34:24 -05:00
Ebrahim Byagowi d0a706c7fd Minor, remove redundant inline 2018-12-22 20:07:57 +03:30
Ebrahim Byagowi ae6e348d64 Minor, tweak spaces 2018-12-22 20:07:57 +03:30
Michiharu Ariza 29f0b6bce7 CFF renaming (#1507)
* reimplement ByteStr as byte_str_t based on hb_ubytes_t

Unuse start_embed<ByteStr>
Also renamed SubByteStr to byte_str_ref_t
More renaming to come

* substr renamed to str_ref in line with its type byte_str_ref_t

* uncamelize non-table struct names

* uncamelized non-struct types OpCode etc

* add byte_str_t copy ctor

* test

* test2

* undo tests

* fix bot failure

* undo the previous change

* fixed tabs, added inline

* Revert "fixed tabs, added inline"

This reverts commit 21163c30e9.

* fix tabs
2018-12-22 10:47:04 -05:00
Behdad Esfahbod 89d04129e2 [set] Actually derive iterator from hb_sorted_iter_t<> 2018-12-21 20:07:52 -05:00
Behdad Esfahbod fc35919d01 [set] Implement unified iterator 2018-12-21 20:06:17 -05:00
Behdad Esfahbod 4911e67d2d [set] Mark some internals protected 2018-12-21 20:00:52 -05:00
Behdad Esfahbod 954b985422 [iter] Add hb_sorted_iter_t<> 2018-12-21 19:55:02 -05:00