summaryrefslogtreecommitdiffstats
path: root/include/minikin/FontFamily.h
Commit message (Collapse)AuthorAgeFilesLines
* Improve Paint.measureText and Paint.hasGlyph for variation sequences.Seigo Nonaka2016-02-171-1/+9
| | | | | | | | | | | | | | | | | | | | Before this patch, the font fallback chain iterated all installed font families if a variation selector was specified. This CL narrows down the range of iteration. To decide the font family for the variation sequence, we need to search for both the variation sequence and its base code point. The new range of the iteration is a union of them. With this change, the running time of Paint.hasGlyph for the variation sequence improves 50% and the running time of Paint.measureText for the variation sequence improves 40% for the large text case on Nexus 6 userdebug. Bug: 26784699 Bug: 11750374 Change-Id: Iced1349e3ca750821d8882c551551f65bb569794
* Improve Paint.hasGlyph performance by caching hb_font_tSeigo Nonaka2016-02-041-9/+2
| | | | | | | | | | | | | | | | | It turned out that hb_font_t creation is not a lightweight operation. Especially, Paint.hasGlyph creates hb_font_t for all existing fonts every time. To improve the performance, cache hb_font_t instead of hb_face_t. Note that to calculate horizontal advance, MinikinPaint needs to be associated with hb_font_t by calling hb_font_set_funcs. With this patch, hb_font_set_funcs may be called multiple times for the same hb_font_t object. However this is not an issue since MinikinPaint is unique during layout. Bug: 26784699 Change-Id: I516498ae9f0127d700fc9829327e9789845a1416
* Save all kind of script tags into FontLanguage.Seigo Nonaka2016-01-051-59/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is 2nd attempt of I8df992a6851021903478972601a9a5c9424b100c. The main purpose of this CL is expanding FontLanguage to be able to save full script tag. Previously, FontLangauge kept only limited script tags. With this CL, FontLanguage keeps all script tags. This CL contains the following changes: - FontLanguage changes: -- Moved to private directory not to be instantiated outside of Minikin. -- Removed bool(), bits(), FontLanguage(uint32_t) methods which are no longer used. -- Change the FontLanguage internal data structure. -- Introduces script match logic. - FontLanguages changes: -- Moved to private directory not to be instantiated outside of Minikin. -- This is now std::vector<FontLanguage> - FontLanguageListCache changes: -- Now FontLanguageListCache::getId through FontStyle::registerLanguageList is the only way to instantiate the FontLanguage. -- Normalize input to be BCP47 compliant identifier by ICU. Bug: 26168983 Change-Id: I431b3f361a7635497c05b85e8ecbeb48d9aef63e
* Revert "Save all kind of script tags into FontLanguage."Bart Sears2015-12-221-5/+59
| | | | | | This reverts commit 5e995fb850c2b32631914c3815dfb421855fba9b. Change-Id: I761e0e41906742fbe3d3ac34170af3101e18042a
* Save all kind of script tags into FontLanguage.Seigo Nonaka2015-12-221-59/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | The main purpose of this CL is expanding FontLanguage to be able to save full script tag. Previously, FontLangauge kept only limited script tags. With this CL, FontLanguage keeps all script tags. This CL contains the following changes: - FontLanguage changes: -- Moved to private directory not to be instantiated outside of Minikin. -- Removed bool(), bits(), FontLanguage(uint32_t) methods which are no longer used. -- Change the FontLanguage internal data structure. -- Introduces script match logic. - FontLanguages changes: -- Moved to private directory not to be instantiated outside of Minikin. -- This is now std::vector<FontLanguage> - FontLanguageListCache changes: -- Now FontLanguageListCache::getId through FontStyle::registerLanguageList is the only way to instantiate the FontLanguage. -- Normalize input to be BCP47 compliant identifier by ICU. Bug: 26168983 Change-Id: I8df992a6851021903478972601a9a5c9424b100c
* Remove script matching score from the font selection fallback.Seigo Nonaka2015-12-101-1/+1
| | | | | | | | Removing the extra score of 2 for the script matching from the font fallback score calculation. If the two langauges have different scripts, we should treat them as different languages. Change-Id: Ie0d6f27bd1086248895935a7bd01b5d404044ad0
* Introduce FontLanguageListCache.Seigo Nonaka2015-12-081-15/+22
| | | | | | | | | FontLanguageListCache is an intentionally leaky singleton and its internal cache won't be purged. BUG: 25122318 Change-Id: I272097e979fe44b83fd86822235350e12eda8f51
* Select emoji font based on variation selectors.Seigo Nonaka2015-12-071-1/+3
| | | | | | | | | | If U+FE0E is appended to the emoji code point, the glyph should have a text presentation. On the other hand, if U+FE0F is appended to the emoji code point, the glyph should have an emoji presentation. Bug: 11256006 Change-Id: I5187d44500b13a138e7ffbcf2c72e2da06374c8c
* Basic scaffolding for handling a language list.Roozbeh Pournader2015-10-221-0/+23
| | | | | | | The behavior hasn't changed much yet: all languages are ignored for rendering text, except the very first supported language. Change-Id: I1695fb985927ae5e28e4f59c1b531e4993af8688
* Introduce FontFamily::hasVariationSelectorSeigo Nonaka2015-10-121-2/+15
| | | | | | | | | | | | | | This CL introduces new method hasVariationSelector into FontFamily but it is not used in production code. So no behavior changes are expected. This CL contains the following changes: - Introduce hasVariationSelector which returns true if the corresponding font has a glyph for a code point and variation selector pair. - Introduce purgeHbFontCache since hb_face_t won't be released by keeping hb_font_t. - Introduce unit tests with self-built font. Change-Id: I659a6d03d9ec446b409e1fba2758452abb9f44fa
* Support three-letter language codes in FontLanguage.Roozbeh Pournader2015-08-071-5/+8
| | | | | | | Also handle the case of weird language code that we don't understand properly better, by treating them not equal to each other. Change-Id: Iaccb251fa38d700932f6eadac254d3d1fa09b3ea
* Minikin: Remove unused variables, fix init orderAndreas Gampe2014-12-031-1/+2
| | | | | | | | | For build-system CFLAGS clean-up, fix unused variables. Reorder initializer list to initialize in the order of member declarations. Change-Id: I64358b2dcf0e39d0f4e18fdc3473de867f84fcba
* Move coverage bitmap from FontCollection to FontFamilyRaph Levien2014-12-031-0/+7
| | | | | | | | | | This will significantly reduce memory usage and also speed the creation of new font families. In particular, the coverage bitmaps for the fonts in the fallback stack will be computed once in the Zygote, rather than separately in each app process. Bug: 17756900 Change-Id: I66f5706bddd4658d78fe5b709f7251ca9d2ff4f8
* Towards CSS removalBehdad Esfahbod2014-07-241-0/+4
| | | | | | | Extract language from FontStyle during shaping. Don't attach CSS to LayoutContext. Change-Id: Ie621d3415410178d0d15fa7b810eb8e412342ab6
* Support for fake bold and italicsRaph Levien2014-06-101-1/+20
| | | | | | | | | | This patch adds support for computing when fake bold and fake italics are needed (because the styles are requested but not provided by the matching FontFamily), and providing them as part of the layout result. Part of the fix for bug 15436379 Fake bold doesn't fully work (Minikin) Change-Id: I180c034b559837943673b5c272c8e890178dff0d
* Language and variant selectionRaph Levien2014-05-291-3/+58
| | | | | | | | | | | | | | This patch adds a "lang" pseudo-CSS property and uses it both to select an appropriate font and control the "locl" OpenType feature to get the most appropriate rendering for the langauge and script. In addition, the "-minikin-variant" property selects between "compact" and "elegant" variants of a font, as the former is needed for vertically cramped spaces. This is part of the fix for bug 15179652 "Japanese font isn't shown on LMP". Change-Id: I7fab23c12d4c797a6d339a16e497b79a3afe9df1
* Caching for layouts and harfbuzz facesRaph Levien2014-05-271-3/+11
| | | | | | | | | | | | | | | | | This patch adds caching for both layouts and for HarfBuzz face objects. The granularity of the cache for layouts is words, so it splits the input string at word boundaries (using a heuristic). There are is also some refactoring to reduce the amount of allocation and copying, and movement towards properly supporting contexts. The size of the caches is a fixed number of entries; thus, it is possible to consume a large amount of memory by filling the cache with lots of large strings. This should be refined towards a scheme that bounds the total memory used by the cache. This patch fixes bug 15237293 "Regression: Measure performance is significantly slower with minikin". Change-Id: Ie8176857e2d78656ce5479a7c04969819ef2718d
* Fix incomplete refcounting and lockingRaph Levien2014-05-191-0/+2
| | | | | | | | These changes were supposed to be committed in the previous patch "Better refcounting and locking" but seem to have gotten lost in a rebase. It fixes a memory leak and some possible race conditions. Change-Id: I54ca1e37500ec49756fe317cc6d6d03da9911501
* Better refcounting and lockingRaph Levien2014-05-121-1/+5
| | | | | | | | | | | All major externally accessible objects (especially FontFamily and FontCollection) are now reference counted. In addition, there is a global lock intended to make operations thread-safe. WIP notice: in this version of the patch, not all external API entry points are protected by the lock. That should be fixed. Change-Id: I14106196e99eb101e8bf1bcb4b81359759d2086c
* Introduce MinikinFont abstractionRaph Levien2013-06-141-6/+6
| | | | | | | | | | | This commit removes the direct dependency on FreeType and replaces it with a MinikinFont abstraction, which is designed to support both FreeType and Skia fonts (and possibly others in the future). Also adds a "total advance" to the Layout, with an API for retrieving it. Change-Id: If20f92db9a43fd15b0fe9794b761ba00fb21338c
* Initial commit of Minikin libraryRaph Levien2013-04-251-0/+67
This is the initial draft of Minikin, a library intended to perform text layout functions. This version does basic weight selection and font runs for scripts, and also has a simple renderer for drawing into bitmaps, but is lacking measurement, line breaking, and a number of other important features. It also lacks caching and other performance refinements. Change-Id: I789a2e47d11d71202dc84b4751b51a5e2cd9c451