Commit Graph

3183 Commits

Author SHA1 Message Date
Behdad Esfahbod 9df099b483 [ft] Don't set *glyph in get_glyph() if glyph not found 2015-05-18 18:37:46 -07:00
Behdad Esfahbod 5801521532 Add note re OpenType 1.7 language tags 2015-05-06 00:40:31 -07:00
Roozbeh Pournader f6266ad291 [minor] Remove comment about Navajo OpenType code.
Apparently the code is already standardized:
https://www.microsoft.com/typography/otspec/languagetags.htm
2015-05-05 22:39:04 -07:00
Behdad Esfahbod 42b00118ea Merge pull request #102 from roozbehp/master
Add OpenType language tag 'NAV ' for Navajo.
2015-05-05 14:49:47 -07:00
Behdad Esfahbod be66ec5373 Use TRUE/FALSE instead of true/false in docs 2015-04-30 18:27:13 -04:00
Khaled Hosny d055e1fc78 Some attempt into initial hb-shape documentation
Very anaemic, needs to descripe the format understood by
hb_feature_from_string() etc., but it is just start.
2015-04-30 18:24:45 -04:00
Behdad Esfahbod 81bedda58c New API: hb_buffer_reverse_range() 2015-04-30 13:04:16 -04:00
Roozbeh Pournader cfeb0562eb Add OpenType language tag 'NAV ' for Navajo.
The code is not standardized yet, but is used in some Google fonts.
2015-04-29 09:32:42 -07:00
Jonathan Kew f724cc3516 Don't apply Arabic shaping to vertical text. 2015-04-24 12:19:02 -07:00
Behdad Esfahbod 97942420bb Update check-libstdc++ for clang 2015-04-23 18:56:24 -07:00
Behdad Esfahbod 39851ce84e [coretext] Oops; fix issue number for previous commit 2015-04-21 19:23:27 -07:00
Behdad Esfahbod 24f17afeaf [coretext] Fix positioning with trailing whitespace
Fixes https://code.google.com/p/chromium/issues/detail?id=476913
2015-04-21 19:21:32 -07:00
Behdad Esfahbod dba482fc44 [ot-font] Accept MS Symbol cmap if nothing else found 2015-04-17 13:08:08 -07:00
Behdad Esfahbod 3029e8b59d Revert "Add MSVC pragma for UTF-8 source code"
This reverts commit 89cbd4d953.

See discussion:
https://bugzilla.gnome.org/show_bug.cgi?id=747772
2015-04-14 13:32:22 -07:00
Behdad Esfahbod 89cbd4d953 Add MSVC pragma for UTF-8 source code
Not sure we have any right now; motivated by this:
https://bugzilla.gnome.org/show_bug.cgi?id=747772
2015-04-13 12:27:08 -07:00
Behdad Esfahbod 713f99ff61 Merge pull request #99 from khaledhosny/introspection-fixes2
More ntrospection fixes
2015-04-10 14:34:05 -07:00
Khaled Hosny 22524a514f [bindings] Fix hb_buffer_get_segment_properties
Annotate the output parameter.
2015-04-10 22:57:38 +02:00
Behdad Esfahbod 1086f21e54 Merge branch 'hb-fc' 2015-04-10 12:21:04 -07:00
Khaled Hosny 04f89e8f7d [bindings] Fix ownership of returned hb_language_t
It should not be freed by the caller.
2015-04-10 18:17:02 +02:00
Konstantin Ritt 855a5d7cb8 Fix build on WEC2013
Based on patch from Björn Breitmeyer
2015-04-10 17:18:01 +04:00
Behdad Esfahbod eb0bf3ae66 Relax inert checks
Previously, when creating an object from inert inputs (eg:
"hb_font_create(hb_face_get_empty())") we returned the inert
empty object.  This is not helpful as there are legitimate
usecases to do that.

We now never return the inert object unless allocation failed.

Tests are revised to reflect.
2015-04-09 19:16:57 -07:00
Behdad Esfahbod 9c974360fe Minor rename 2015-04-09 12:04:14 -07:00
Behdad Esfahbod f3b170bdd9 Minor 2015-04-08 16:26:24 -07:00
Behdad Esfahbod 2958f2c147 Fixup 2015-04-08 16:26:16 -07:00
Behdad Esfahbod b931e0b0ce Fix warnings
Part of https://github.com/behdad/harfbuzz/pull/68
2015-04-08 14:43:33 -07:00
Behdad Esfahbod cdcdfe61b9 Err, instead of warn, if mutex / atomic / unicode funcs are missing
Hopefully this results in fewer badly built HarfBuzz integrations.
2015-04-08 13:25:04 -07:00
Behdad Esfahbod fc3c59a1d7 Fix unused var warnings 2015-04-08 13:04:29 -07:00
Konstantin Ritt 3f174cd020 Minor refactoring to the atomics implementation
s/atomic_int/atomic_int_impl/ and s/atomic_ptr/atomic_ptr_impl/
to bring it in par with hb_mutex_impl_t, then re-introduce
hb_atomic_int_t as a wrapper around hb_atomic_int_impl_t.

In hb_reference_count_t, make it clear the non-atomic get and set
are intentional due to nature of the cases they are used in
(comparison to -1 and the debug output/tracing).
2015-04-08 13:04:22 -07:00
Behdad Esfahbod 24930d544e Minor 2015-04-08 12:52:06 -07:00
Behdad Esfahbod 45a8b46f47 Allow implementing atomic and mutex ops in config
Motivated by
https://github.com/behdad/harfbuzz/pull/92
2015-04-08 12:49:38 -07:00
Behdad Esfahbod 3fe4e92bc5 Minor 2015-04-08 12:49:23 -07:00
Behdad Esfahbod ce01ad7c2f MSVC 2015 supports snprintf and not _snprintf 2015-04-01 11:05:59 -07:00
Behdad Esfahbod 560718862f Move WinCE define to better place 2015-04-01 11:04:58 -07:00
Behdad Esfahbod aee685086c Fix VC++ /analyze warnings
out\debug\hb-buffer-deserialize-text.rl(47) : warning C6001: Using
uninitialized memory 'pos'.
2015-03-26 14:13:53 -04:00
Khaled Hosny a394bb6670 [bindings] Fix *_from_string functions
Without the element-type they will be getting garbage, at least with
Python.
2015-03-22 20:29:10 +02:00
Behdad Esfahbod 9e401f6890 Fix reverse_range() for empty range
Fixes coretext notdef loop consisting of all default_ignorable glyphs

https://code.google.com/p/chromium/issues/detail?id=464755
2015-03-20 16:08:38 -04:00
Behdad Esfahbod 98e3ea8e34 Fix hb-uniscribe build 2015-03-04 12:03:39 -08:00
Behdad Esfahbod 8ac345e5c0 Fix reverse_range() to only reverse alt array if positions are used
In hb-coretext, when we were using scratch buffer for book-keeping,
a reverse_range() caused by the notdef-insertion loop could mess up
our log_clusters.  Ouch!
2015-03-02 16:06:55 -08:00
Behdad Esfahbod 5f541f8f7b Minor refactoring 2015-02-25 15:43:35 -08:00
Behdad Esfahbod ef79bdf73b Minor 2015-02-25 15:43:35 -08:00
Behdad Esfahbod 68e04afbb1 Typo 2015-02-25 15:43:34 -08:00
Behdad Esfahbod 55553699b3 Minor 2015-02-25 15:43:34 -08:00
Behdad Esfahbod 5175300fba [layout] Fix comparison of GlyphID and hb_codepoint_t
Before, the IntType::cmp functions providing this and was truncating
the hb_codepoint_t to 16bits before comparison.  I have no idea how
this was never discovered, and I'm too lazy to try to reproduce this
with Pango (which uses non-16bit codepoint numbers for missing glyphs).
2015-02-25 15:43:34 -08:00
Behdad Esfahbod 7cce809cb1 Remove unused (and wrong as of a few commits ago) cmp() function 2015-02-25 15:43:34 -08:00
Behdad Esfahbod 8e3d4bae03 Minor 2015-02-25 15:43:33 -08:00
Behdad Esfahbod f47cf1f12d Minor 2015-02-25 15:43:33 -08:00
Behdad Esfahbod 640b66c634 [layout] If lookup has only one subtable, move the forward loop down to subtable
I was hoping to see a nice speedup, but it resulted in a very minor one.
2015-02-25 15:43:33 -08:00
Behdad Esfahbod e2f50f2a7e [layout] Add apply_forward / apply_backward 2015-02-25 15:43:32 -08:00
Behdad Esfahbod 1d4a328472 [layout] Remove unneeded return value from apply() 2015-02-25 15:43:32 -08:00
Behdad Esfahbod bbdd6fd21c Minor simpilfy BEInt 2015-02-25 15:43:32 -08:00
Behdad Esfahbod 88a399acdc Optimize IntType comparison to avoid branches for 16bit numbers 2015-02-25 15:43:32 -08:00
Behdad Esfahbod 37de2d5331 Minor simplify IntType 2015-02-25 15:43:31 -08:00
Behdad Esfahbod bd047d3b7f [layout] Minor 2015-02-25 15:43:31 -08:00
Behdad Esfahbod b9d3f60520 [layout] Minor 2015-02-25 15:43:31 -08:00
Behdad Esfahbod 1a2322134a [layout] Don't check glyph props against lookup flags when recursing
Shouldn't be needed.  I have a hard time imagining this breaking any
legitimate use case.
2015-02-25 15:43:30 -08:00
Behdad Esfahbod 095a1257cc [layout] Port sanitize() to use dispatch()
Needed some rework of Extension table.  Hopefully I got it right, and
the new template usage doesn't break any compilers...
2015-02-25 15:43:30 -08:00
Behdad Esfahbod 758fb20630 Remove unused macro 2015-02-25 15:43:30 -08:00
Behdad Esfahbod 40c58923cb [layout] Refactor Lookup::dispatch() 2015-02-25 15:43:30 -08:00
Behdad Esfahbod 70366f5d19 [layout] Refactor get_subtable() 2015-02-25 15:43:29 -08:00
Behdad Esfahbod f72f326aea Minor 2015-02-25 15:43:29 -08:00
Behdad Esfahbod 8e36ccfd4f [layout] Use dispatch() for add_coverage() 2015-02-25 15:43:29 -08:00
Behdad Esfahbod 50b8dc79da [layout] Add may_dispatch()
No functional change right now.
2015-02-25 15:43:29 -08:00
Behdad Esfahbod de2118ed7a Make sanitize() a const method
This makes a lot of code safer.  We only try modifying the object in one
place, after making sure it's safe to do so.  So, do a const_cast<> in
that one place...
2015-02-25 15:43:28 -08:00
Behdad Esfahbod 6759ed95a3 Minor 2015-02-25 15:43:28 -08:00
Behdad Esfahbod 6b599dac1f Remove unnecessary check in sanitize 2015-02-25 15:43:28 -08:00
Behdad Esfahbod 365576d246 [layout] Allocate iters in the context
Can be further optimized, but I think I didn't break anything.

Saves another 3% off Roboto shaping.
2015-02-25 15:43:28 -08:00
Behdad Esfahbod 514564f544 [layout] Move skippy_iter setup from constructor into init() 2015-02-25 15:43:27 -08:00
Behdad Esfahbod b051be542a [lookup] Add skippy_iter.reset()
Towards reducing the cost of initializing skippy_iter()
2015-02-25 15:43:27 -08:00
Behdad Esfahbod 2cecc38c7c [layout] Shuffle code around 2015-02-25 15:43:27 -08:00
Behdad Esfahbod 696266981d [layout] Merge forward and backward iterators 2015-02-25 15:43:26 -08:00
Behdad Esfahbod 1f038eec3c [layout] Fix backward reject()
Has no functional effect since reject was never used with
match_glyph_data.
2015-02-25 15:43:26 -08:00
Behdad Esfahbod 37d13acd8d [layout] Remove some unnecessary checks in skippy 2015-02-25 15:43:26 -08:00
Behdad Esfahbod baa14e1814 [lookup] Don't initialize skippy if coverage match fails
Currently:

  - Initializing skippy is very expensive,

  - Our lookup accelerator (using set-digests) can be very ineffecite,

As such, we end up many times initializing skippy but then failing
coverage check.  Reordering fixes that.

When, later, we fix our accelerator to have truly small false-positive
rate (for example by using the frozen-sets), then we might want to
reorder these checks such that we wouldn't calculate coverage number
if skippy is going to fail.

This shows a 5% speedup with Roboto already.
2015-02-25 15:43:26 -08:00
Behdad Esfahbod 7788993bc1 [layout] Use setter method to set c->lookup_props 2015-02-25 15:43:25 -08:00
Behdad Esfahbod f4ee48fd7b [layout] Remove unused wrapper method 2015-02-25 15:43:25 -08:00
Behdad Esfahbod 7b7129c7a9 Add hb_frozen_set_t
I experimented with replacing use of hb_set_digest_t with this new
hb_frozen_set_t, hoping to get a huge speedup for busy lookups
(like kern lookup in Roboto), but I only got 6% speendup in Roboto
and 4% in NotoNastaliqUrduDraft :(.
2015-02-25 15:43:25 -08:00
Behdad Esfahbod 241eac9559 Hide internals of lookup accelerators 2015-02-25 15:43:25 -08:00
Konstantin Ritt 9768e651be Fix build with MSVC on CE
This code is C++ only. There isn't a single C++ compiler that fails to
understand the "inline" keyword, since it's required by C++98. Any
compiler older than C++98 is likely to choke on the template usage
further down, so this isn't necessary.

Moreover, the C++ standard says you cannot define macros.
[lib.macro.names] says "Nor shall such a translation unit define macros
for names lexically identical to keywords." -- technically, it's a
promise that the Standard Library headers won't do it, the wording means
that the entire translation unit won't do it, which implies no source
can do it.

MSVC complains about it:
fatal error C1189: #error : The C++ Standard Library forbids macroizing
keywords. Enable warning C4005 to find the forbidden macro.

Author: Thiago Macieira <thiago.macieira@intel.com>
2015-02-14 00:58:51 +04:00
Behdad Esfahbod 7888a6b07a [ft] Handle negative scales with vertical writing 2015-01-28 12:40:40 -08:00
Behdad Esfahbod 982d94eaa2 [coretext] Don't generate notdef glyph for default-ignorables
As discovered on Chrome Mac:
https://code.google.com/p/chromium/issues/detail?id=452326
2015-01-28 10:51:33 -08:00
Behdad Esfahbod 6917a045fd [coretext] Unbreak glyph positioning in presence of notdef runs
As discovered on Chrome Mac:
https://code.google.com/p/chromium/issues/detail?id=452326

This was originally broken in:

	commit 5a0eed3b50
	Author: Behdad Esfahbod <behdad@behdad.org>
	Date:   Mon Aug 11 23:47:16 2014 -0400

	    [coretext] Implement vertical shaping
2015-01-28 10:50:54 -08:00
Behdad Esfahbod 1eff435023 Minor optimization 2015-01-27 12:26:04 -08:00
Konstantin Ritt 675956aca0 Do not leak hb_language_t on hb_language_item_t destruction 2015-01-27 10:06:56 -08:00
Konstantin Ritt b306f9674a Minor improvement to HB_SHAPER_DATA_DESTROY 2015-01-27 10:02:34 -08:00
Behdad Esfahbod 61820bc4ca [API] Add hb_buffer_add_latin1()
This is by no ways to promote non-Unicode encodings.  This is an entry
point that takes Unicode codepoints that happen to all be the first
256 characters and hence fit in 8bit strings.  This is useful eg in Chrome
where strings that can fit in 8bit are implemented that way, and this
avoids copying into UTF-8 or UTF-16.

Perhaps we should rename this to hb_buffer_add_codepoints8().  I'm also
curious if anyone would be really interested in hb_buffer_add_codepoints16().

Please discuss!
2015-01-26 14:25:52 -08:00
Behdad Esfahbod 78c6e86c04 Fix hb_buffer_add_codepoints to actually NOT validate 2015-01-26 14:08:36 -08:00
Konstantin Ritt f3537b620b Move some code around
Just to keep Windows specific workarounds in a single place.
2015-01-25 09:50:51 +04:00
Konstantin Ritt afb62d88d7 Do not define MemoryBarrier on WinCE
There is a _HBMemoryBarrier() wrapper function that emulates
MemoryBarrier() behavior when it is not defined.
2015-01-25 08:16:26 +04:00
Konstantin Ritt 7db326a15b Fix build on WinRT
There is no environment (like WinCE) and the basic version
of InitializeCriticalSection is unsupported.

https://codereview.qt-project.org/#/c/92496/
2015-01-25 08:13:24 +04:00
Behdad Esfahbod a319d0777b [ft] Handle negative x_scale / y_scale 2015-01-23 12:44:24 -08:00
Behdad Esfahbod b0b38bb892 [coretext] Fix positioning of notdef 2015-01-21 19:19:33 -08:00
Behdad Esfahbod 70622e5089 [coretext] Fix scaling
Before we were not accounting for possible differences in x_scale and
y_scale, as well as the signs of those.  All should be in good shape
now.
2015-01-21 18:51:42 -08:00
Behdad Esfahbod 221ba02b08 [coretext] Use vertical advance for notdef in vertical direction 2015-01-21 18:51:42 -08:00
Behdad Esfahbod 7988da24c5 Add convenience make target "make lib" in src/ 2015-01-21 18:33:50 -08:00
Behdad Esfahbod 67dfa8c7c2 When matching second glyph of kerning pairs, use bsearch
Roboto has glyphs (like 'F') that have 200 kerning pairs.
Add a handcoded bsearch instead of previous linear search.

This doesn't show much speedup though, apparently we spend the
bulk of the time somewhere before here.
2015-01-19 17:00:31 -08:00
Behdad Esfahbod e9f5c65be0 [bindings] Minor 2015-01-19 16:15:32 -08:00
Roozbeh Pournader 5eb939ddfe Change New Tai Lue shaping engine from SEA to default
This is to reflect the UTC decision to change the encoding model of
New Tai Lue from logical to visual to be similar to Thai, Lao, and
Tai Viet: http://www.unicode.org/L2/L2014/14250.htm#141-C26

The visual encoding is already the current practice of encoding New
Tai Lue on the web anyway:
http://www.unicode.org/L2/L2014/14195-newtailue.txt

Fixes behdad/harfbuzz#66.
2015-01-18 14:39:18 -08:00
Behdad Esfahbod 1aaa7d6799 [indic] Fix out-of-bounds access 2015-01-17 20:16:56 -08:00
Behdad Esfahbod 238d6a38f2 [bindings] Update sample.py 2015-01-07 10:51:44 -08:00
Behdad Esfahbod 2cd5323531 [bindings] Use hb_glib_blob_create() in sample
hb_blob_create() is considered C-only API.
2015-01-06 19:16:38 -08:00