Commit Graph

64 Commits

Author SHA1 Message Date
Behdad Esfahbod 59c45f6deb Use hb_memcpy instead of memcpy consistently 2022-11-22 12:54:50 -07:00
Behdad Esfahbod a0bde1e1ea [open-type] Remove (Sorted)ArrayOf.sub_array() 2022-11-16 21:27:12 -07:00
Behdad Esfahbod b57ea3b053 Revert "[iter] Use && in uses of is_source_of"
This reverts commit ccbba667a9.
2022-08-05 14:29:27 -06:00
Behdad Esfahbod ccbba667a9 [iter] Use && in uses of is_source_of 2022-08-05 11:51:51 -06:00
Behdad Esfahbod f7a9c3ea93 [open-file] Use hb_is_source_of instead of hb_is_iterator 2021-08-05 13:05:07 -06:00
Behdad Esfahbod fa90cb8a31 Whitespace again 2021-08-05 12:31:06 -06:00
Behdad Esfahbod a110a47eb5 Whitespace 2021-08-05 12:28:39 -06:00
Garret Rieger c2ee1fdd40 [subset] remove unsed table_entry struct. 2021-08-05 11:47:07 -06:00
Garret Rieger dea0fe5717 [subset] discard extra copies of a table in face builder.
Fixes #2361. Stores tables in the builder in a hashmap so you end up with at most one copy of each table. Table serialization order is now based on tag sort order instead of order of insertion into the builder.
2021-08-05 11:47:07 -06:00
Behdad Esfahbod f0a1892ff9 [serialize] Remove unnecessary pointer indirection 2021-07-28 17:36:22 -06:00
Behdad Esfahbod ba6db26b65 Tolerate unsorted OT table entries for small number of entries
See comment.

Fixes https://github.com/harfbuzz/harfbuzz/issues/3065
2021-07-22 11:38:27 -07:00
Behdad Esfahbod 03cd9c5cba Align lfind() API to match bfind() 2021-07-22 11:38:27 -07:00
Behdad Esfahbod 29c9833e57 Remove Offset::serialize()
Finishing https://github.com/harfbuzz/harfbuzz/pull/2355
2021-07-09 11:58:36 -06:00
Behdad Esfahbod 2520a82df9 s/LArrayOf/Array32Of/g 2021-03-31 15:41:54 -06:00
Behdad Esfahbod ad28f973f3 Rename offset types to be explicit about their size
Add Offset16To<>, Offset24To<>, and Offset32To<> for most use-cases.
2021-03-31 13:00:07 -06:00
Behdad Esfahbod 505b3fc6cf [harfbuzz.cc] Fix OffsetTable name clash with Mac headers
There's no easy way to undo a "using namespace" in our sources, so by the time
we get to include hb-coretext.cc from harfbuzz.cc, we already have "using namespace OT"
active, which clashes with Mac headers.

Error was:
$ gcc -O3 -Wall -arch i386 -DHAVE_CORETEXT=1 -c harfbuzz.cc -o harfbuzz.o -std=c++11
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/TextUtils.h:288:3: error:
      reference to 'OffsetTable' is ambiguous
  OffsetTable     offsets,
  ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/IntlResources.h:115:41: note:
      candidate found by name lookup is 'OffsetTable'
typedef OffPair                         OffsetTable[3];
                                        ^
./hb-open-file.hh:81:16: note: candidate found by name lookup is 'OT::OffsetTable'
typedef struct OffsetTable
               ^
1 error generated.
2021-02-17 11:34:47 -07:00
Ebrahim Byagowi 25cf687443
Use dagger in OffsetTable::get_table_tags (#2477) 2020-06-19 14:06:50 -07:00
Ebrahim Byagowi 2dda6dd744 minor, tweak spacing
turn 8 spaces to tab, add space before Null/Crap
2020-04-20 16:18:29 +04:30
Behdad Esfahbod 858b627984 [machinery] Remove CastR<>() 2019-12-10 13:18:32 -06:00
Ebrahim Byagowi 0558413f27 Minor, tweak spaces 2019-10-01 13:50:11 +03:30
Ebrahim Byagowi a0b4ac4dce Turn 8 spaces to tab across the project
According to the current code style of the project
2019-08-27 02:40:41 +04:30
Ebrahim Byagowi a6065d05cf Don't call memcpy when a table is empty 2019-07-10 23:38:07 +04:30
Behdad Esfahbod 41248cce0e Remove MIN/MAX in favor of hb_min/hb_max 2019-05-07 20:54:31 -07:00
Ebrahim Byagowi 92588782d7
Remove space between right angle brackets now that we have C++11 (#1689) 2019-04-30 13:05:10 -07:00
Behdad Esfahbod 07776b6096 More tweaks to previous commit
Delete assignment operator of OffsetTo<> instead of Offset<>.

In simple ArrayOf<>::sanitize() assert that Type has assignment operator.
Ideally we should SFINAE this and fallback to calling Type::sanitize()
if assignment operator is not available.  But we don't have a case of
that in the codebase.
2019-04-15 16:43:34 -04:00
Behdad Esfahbod 95df00aec1 Hide a few static methods
Looks like static methods that do not get inlined end up exported.
We have a lot more.  Need to protect all at some point.  Wish there
was an easier way, like the visibility flag we pass that automatically
hides all inline methods.

Was exposed by check-symbols.sh when compiling on OS X 10.14 with:

$ make CPPFLAGS=-Oz CXXFLAGS=-flto=thin LDFLAGS=-lc++
2019-04-12 17:51:14 -04:00
Behdad Esfahbod b986c6a321 [C++11] Remove IntType::set() in favor of operator= 2019-03-29 20:21:21 -07:00
Behdad Esfahbod 6e1c3eaf70 Fix sign comparison error 2019-01-28 14:12:41 -05:00
Behdad Esfahbod b1152d5e66 Use NNOffsetTo<> 2019-01-17 18:17:04 -05:00
Behdad Esfahbod 474a12058d [array/vector] Rename len to length 2018-12-21 18:53:01 -05:00
Behdad Esfahbod f1e95e40ed [arrays] Remove hb_supplier_t<> 2018-12-18 16:49:08 -05:00
Behdad Esfahbod cf39c24205 [arrays] Rename Supplier to hb_supplier_t 2018-12-17 22:36:23 -05:00
Ebrahim Byagowi e412008599 Remove redundant void from C++ sources (#1486) 2018-12-17 13:01:01 -05:00
Behdad Esfahbod 0d0fe9df46 [arrays] Remove need of stride in Supplier<> 2018-12-16 22:31:13 -05:00
Ebrahim Byagowi b2ebaa9afa Remove redundant 'inline' from methods (#1483) 2018-12-16 14:08:10 -05:00
Behdad Esfahbod d77a098b73 [arrays] Improve bfind() interface
Much more useful now. :)
2018-11-24 10:06:13 -05:00
Behdad Esfahbod 30cb45b3ea Change ArrayOf.bsearch() return semantics
Towards consolidating all array bsearch/...
2018-11-24 00:48:26 -05:00
Behdad Esfahbod e2ffb33a53 Remove lsearch for small TableDirectorys 2018-11-23 16:24:28 -05:00
Behdad Esfahbod 72462eb765 Add UnsizedArrayOf::as_array() instead of hb_array() template 2018-11-02 11:46:42 -04:00
Behdad Esfahbod 8d689f8a7b Add hb_array<>() specialization for UnsizedArrayOf
Related https://github.com/harfbuzz/harfbuzz/issues/1301
2018-10-22 21:33:18 -07:00
Behdad Esfahbod abfbba1911 Add hb_array<>()
Simplifies transient object creation.

Fixes https://github.com/harfbuzz/harfbuzz/issues/1301
2018-10-22 21:27:45 -07:00
Behdad Esfahbod d7865107ea Remove const from hb_array_t details
Will come in through <T> if desired.
2018-10-22 16:24:16 -07:00
Bruce Mitchener 257d0e5aa3 Fix typos. 2018-10-19 19:24:05 +03:30
Behdad Esfahbod f8ccb545c4 [dfont] Disable null-processsing for offsets
An offset to unsized arrayis not safe to be redirected to our fixed-sized
null pool.  Plus, we want to reject, not repair, bad-looking dfonts.
2018-09-14 18:59:53 +02:00
Behdad Esfahbod 67449c3933 Don't dereference offset before check_struct() 2018-09-14 10:58:00 +02:00
Behdad Esfahbod ca746f261e [dfont] Also check dataLen range in sanitize
Just to disagree with myself re being done with this code...
2018-09-13 20:35:21 +02:00
Behdad Esfahbod 3789c557ca [dfont] Solve the mystery +2 offset thing!
Previously, ResourceForkHeader was defined as 30 bytes, having the typeCountM1 as last member.
There was a mysterious offset-by-2 in the code, derived from FontTools and JDK code this was
ported from.

In testing, I observed that typeListZ offset is actually 28.  Suggesting that the typeCountM1
does NOT actually belong to ResourceForkHeader, but belongs to the array itself.  Adjusting for
that resolves the mystery +2 offset hack, so everything is clean and good now.

This, concludes my dfont hacking.  The code looks great now, and I'm happy to leave it.
Fuzzers might disagree though, we will see!
2018-09-13 20:32:13 +02:00
Behdad Esfahbod 180a88a96c [dfont] Some more 2018-09-13 19:26:44 +02:00
Behdad Esfahbod 0ab0f1e5ac [dfont] Push methods further down 2018-09-13 19:13:01 +02:00
Behdad Esfahbod 8c9bdcc1fe [dfont] Minor 2018-09-13 19:08:22 +02:00