1. 17 2月, 2016 1 次提交
    • S
      Improve Paint.measureText and Paint.hasGlyph for variation sequences. · 6b1c227d
      Seigo Nonaka 提交于
      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
      6b1c227d
  2. 04 2月, 2016 1 次提交
    • S
      Improve Paint.hasGlyph performance by caching hb_font_t · 89e80237
      Seigo Nonaka 提交于
      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
      89e80237
  3. 15 1月, 2016 1 次提交
    • S
      Introduce multiple language based font fallback. · 6f9966ea
      Seigo Nonaka 提交于
      The motivation of this CL is enhance the font fallback score design
      to support multiple language font fallback.
      
      This CL contains following changes:
      - Break language based font score into two: script-based score and
        primary-language-based score.
      - The primary-language-based score is 0 if the script-based score is 0.
        If the script-based score is not 0 and the primary language is the
        as same as the requested one, the font gets an extra score of 1.
      - The language score gets a higher multiplier for languages higher in
        the locale list.
      
      Bug: 25122318
      Bug: 26168983
      Change-Id: Ib999997a88e6977e341f4c325e2a1b41a59db2d5
      6f9966ea
  4. 06 1月, 2016 1 次提交
    • S
      Fix race condition in Paint.hasGlyph() · a6f5c468
      Seigo Nonaka 提交于
      The caller of FontFamily::hasVariationSelector needs to acquire the
      lock before calling it, but FontCollection::hasVariationSelector
      didn't acquire the lock. This caused a race condition.
      This CL fixes this race condition.
      
      Also, it turned out that assertMinikinLocked didn't assert even on
      eng or userdebug device. This CL enables assertion on eng and userdebug
      device since this assertion must be treated as bug.
      
      BUG: 26323806
      
      Change-Id: I9c4b1e1f09c6793e387fbdb8bb654cc0a13c65d5
      a6f5c468
  5. 05 1月, 2016 1 次提交
    • S
      Save all kind of script tags into FontLanguage. · 198b46f1
      Seigo Nonaka 提交于
      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
      198b46f1
  6. 22 12月, 2015 2 次提交
    • B
      Revert "Save all kind of script tags into FontLanguage." · 6c4c098c
      Bart Sears 提交于
      This reverts commit 5e995fb8.
      
      Change-Id: I761e0e41906742fbe3d3ac34170af3101e18042a
      6c4c098c
    • S
      Save all kind of script tags into FontLanguage. · 5e995fb8
      Seigo Nonaka 提交于
      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
      5e995fb8
  7. 11 12月, 2015 1 次提交
  8. 09 12月, 2015 1 次提交
    • S
      Introduce FontLanguageListCache. · 6d9dcd2c
      Seigo Nonaka 提交于
      FontLanguageListCache is an intentionally leaky singleton and its
      internal cache won't be purged.
      
      BUG: 25122318
      
      Change-Id: I272097e979fe44b83fd86822235350e12eda8f51
      6d9dcd2c
  9. 08 12月, 2015 1 次提交
    • S
      Select emoji font based on variation selectors. · 369d2d44
      Seigo Nonaka 提交于
      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
      369d2d44
  10. 19 11月, 2015 3 次提交
    • S
      Search all families instead of using mRanges for variation sequence. · fc119c68
      Seigo Nonaka 提交于
      To optimize the font family search, mRanges is used for narrowing down
      the search range. However, mRanges is constructed from format 4 or
      format 12 entries. So, if the font supports a variation sequence but doesn't
      support the base character of the sequence, the font may not be listed in
      mRanges.
      
      The proper way to fix this issue is using format 14 subtable information
      for mRanges construction. However, this is not a trivial work since currently
      we rely on HarfBuzz for variation sequence lookup and it doesn't provide any
      API for retrieving coverage information.
      
      Thus, as the quick fix, iterate all font families in font fallback chain if
      the variation sequence is specified.
      
      Change-Id: I278da84be8fb8f553590e2e42ed450b7e4a34eca
      fc119c68
    • S
      Introduce FontCollection::hasVariationSelector method. · 80d113bc
      Seigo Nonaka 提交于
      To implement Paint.hasGlyph(), we need a new method to ask the
      FontCollection if it has a glyph for the code point and variation
      selector pair.
      
      Bug: 11256006
      Change-Id: Ie4185c91bcaa4d01aee6beb97784b1f9d2a88f12
      80d113bc
    • R
      Accept variation selector in emoji sequences - DO NOT MERGE · 35e4ebec
      Raph Levien 提交于
      This patch basically ignores variation selectors for the purpose of
      itemization into font runs. This allows GSUB to be applied when input
      sequences contain variation selectors.
      
      Bug: 25368653
      Change-Id: I9c1d325ae0cd322c21b7e850d0ec4d73551b2372
      35e4ebec
  11. 13 11月, 2015 1 次提交
    • S
      Fix invalid decrement range of KEYCAP handling in itemize. · 3dd8757f
      Seigo Nonaka 提交于
      This issue was introduced by I22ce0e9eadc941f84e3a9b23462f194e51dd7180.
      Need to decrement the two utf16 chars in KEYCAP handling.
      
      To add unit tests, this CL also addresses the Bug: 24184208 by
      introducing self built fonts since there is no good example in system
      installed fonts.
      
      Bug: 24184208
      Change-Id: I23fa008adbaced78a3cb96442a6bc8892ab84ce8
      3dd8757f
  12. 30 10月, 2015 1 次提交
    • R
      Accept variation selector in emoji sequences - DO NOT MERGE · adaf42f0
      Raph Levien 提交于
      This patch basically ignores variation selectors for the purpose of
      itemization into font runs. This allows GSUB to be applied when input
      sequences contain variation selectors.
      
      Bug: 25368653
      Change-Id: I9c1d325ae0cd322c21b7e850d0ec4d73551b2372
      adaf42f0
  13. 28 10月, 2015 1 次提交
    • S
      Add -Werror -Wall -Wextra to compiler option. · bae34768
      Seigo Nonaka 提交于
      This is 2nd trial of I30a0914a4633bd93eb60957cdf378770f04d8428
      
      - To suppress noisy unused parameter warnings, comment out unused
        arguments.
      - Add -Werror for suppressing further warning.
      - Add -Wall -Wextra for safety.
      - Use "z" prefix for format string of size_t.
      
      Verified that compile succeeded on all arm,arm64,mips,x86,x86_64.
      
      Change-Id: I7ad208464486b8a35da53929cb1cfe541ed0052f
      bae34768
  14. 20 10月, 2015 1 次提交
    • S
      Support Variation Selector in font selection. · bbdd73ec
      Seigo Nonaka 提交于
      This CL contains the following changes:
      - Add a variation selector argument into getFamilyForChar to be able to
        select fonts which support variation selector.
      - In case no fonts support the codepoint and variation selector pair,
        add a fallback rule which selects font family with ignoring variation
        selector.
      - Change FontCollection::itemize to not change the font family
        immediately preceding a variation selector.
      - Introduce unit tests for variation selectors.
      
      With this CL, TextView can render the variation selectors correctly.
      
      Bug: 11256006
      Change-Id: I22ce0e9eadc941f84e3a9b23462f194e51dd7180
      bbdd73ec
  15. 12 10月, 2015 1 次提交
    • S
      Introduce FontFamily::hasVariationSelector · 0f2a025d
      Seigo Nonaka 提交于
      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
      0f2a025d
  16. 30 7月, 2015 1 次提交
    • R
      Improve fallback where explicit variant is not given · 90a09c3f
      Raph Levien 提交于
      In computing scores for which fallback font to choose, a match of a
      variant given explicitly in the xml config file scores higher than a
      family with no explicit variant. One consequence is that U+2010
      HYPHEN is chosen from the Naskh Arabic font in the fallback case.
      
      This patch scores families with no variants as a match (effectively
      the same as if the xml file specified both variants). Thus, it will
      choose the first matching font (Roboto), which is a better choice.
      
      This patch also revises the list of "sticky" characters to include
      various hyphens, so Arabic (and potentially other scripts) text that
      includes hyphens can access the script-specific variants matched to
      the underlying text.
      
      Bug: 22824219
      Change-Id: I6ec1043037f89cad50ca99ac24c473395546bcdf
      90a09c3f
  17. 04 12月, 2014 2 次提交
    • A
      Minikin: Remove unused variables, fix init order · cb20a2f0
      Andreas Gampe 提交于
      For build-system CFLAGS clean-up, fix unused variables.
      
      Reorder initializer list to initialize in the order of member
      declarations.
      
      Change-Id: I64358b2dcf0e39d0f4e18fdc3473de867f84fcba
      cb20a2f0
    • R
      Move coverage bitmap from FontCollection to FontFamily · 13f1aae0
      Raph Levien 提交于
      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
      13f1aae0
  18. 30 10月, 2014 1 次提交
    • R
      Move coverage bitmap from FontCollection to FontFamily · 253320d2
      Raph Levien 提交于
      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
      253320d2
  19. 27 8月, 2014 1 次提交
    • R
      Try Unicode decomposition for selecting fallback font · 997c799e
      Raph Levien 提交于
      This patch finds an appropriate fallback font in the case where no font
      directly maps the requested character, but a font does exist for the
      character's canonical decomposition. This yields correct rendering of
      compatibility characters such as U+FA70.
      
      Bug: 15816880
      Bug: 16856221
      Change-Id: Idff8ed6b942fec992a0815a32028b95af091d0ee
      997c799e
  20. 09 8月, 2014 1 次提交
    • B
      Choose same font for Emoji keycap and its base character · f952161b
      Behdad Esfahbod 提交于
      The U+20E3 COMBINING KEYCAP is used in our fonts to generate an emoji
      rendering of ASCII numbers and letters through GSUB.  For that to work
      we need to choose the same (Emoji) font for the character coming
      *before* the COMBINING KEYCAP character.
      
      This is a special-case of a broader need to choose fonts per grapheme
      cluster as opposed to per character, but for now, special-case U+20E3.
      
      Bug: 7557244
      Change-Id: I958e5a01068df8495bbb9bc3b9ed871cea1838b6
      f952161b
  21. 10 7月, 2014 1 次提交
    • R
      Assign non-coverage font runs to base font · 156acb18
      Raph Levien 提交于
      When a run has no cmap coverage in any font, use the base font. Most of
      the time, this will cause rendering of the .notdef glyph, which is
      preferable to displaying nothing. In some cases, Harfbuzz may be able to
      decompose the characters (not in the cmap) to ones that are, in which
      case we'll render those, as long as they're in the base font.
      
      Bug: 6629748
      Bug: 15816880
      Change-Id: Ibb1b9242c83626e0c7db363ad65ce44a967a005e
      156acb18
  22. 20 6月, 2014 1 次提交
    • R
      Make font runs less sticky · bb601b67
      Raph Levien 提交于
      Fixes b/15734816 In the text "Wi-Fi", "-Fi" appears bolder than "Wi"
      
      The problem was caused by "stickiness" in choosing fonts, where layout
      would prefer using a font used for preceding characters as long as it
      mapped the following characters in a run, in favor of the "best match"
      rules. This patch adds a whitelist for making the stickiness more
      conservative, only applying it for characters necessary for correct
      shaping (ZWJ and ZWNJ in particular) and basic punctuation, where it is
      desirable to match the style of the preceding text.
      
      Change-Id: I1cf116879f074a5a71c351846707bfdd07b0d320
      bb601b67
  23. 12 6月, 2014 3 次提交
    • R
      Fix missing text on nonexistent font file · bd36ec76
      Raph Levien 提交于
      Fix for bug 15570313 "Missing text on nonexistent font file"
      
      This patch makes sure that the lastChar and mInstances arrays are in
      sync with each other even when a FontFamily being added has no valid
      fonts in it. Previously, when they got out of sync, unicode coverage
      calculation would be wrong, resulting in missing text.
      
      Change-Id: I69c727ef69e2c61e2b2d6b81d5a28c806327f865
      bd36ec76
    • R
      Support for fake bold and italics · 15651697
      Raph Levien 提交于
      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
      15651697
    • R
      Add baseFont method to FontCollection · b1eae5ea
      Raph Levien 提交于
      This patch adds a method to retrieve the base font from a
      FontCollection, which is useful when querying global font metrics.
      
      Part of the fix for bug 15467288 "Inconsistent line heights on
      Minikin builds"
      
      Change-Id: I268ae5128d0852a020d746bc22af81fc1a623228
      b1eae5ea
  24. 11 6月, 2014 1 次提交
    • R
      Support for fake bold and italics · 9a5f713a
      Raph Levien 提交于
      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
      9a5f713a
  25. 07 6月, 2014 1 次提交
    • R
      Add baseFont method to FontCollection · 89566f0a
      Raph Levien 提交于
      This patch adds a method to retrieve the base font from a
      FontCollection, which is useful when querying global font metrics.
      
      Part of the fix for bug 15467288 "Inconsistent line heights on
      Minikin builds"
      
      Change-Id: I268ae5128d0852a020d746bc22af81fc1a623228
      89566f0a
  26. 30 5月, 2014 2 次提交
    • R
      Fix ZWJ not working for Indic fonts · 066e8575
      Raph Levien 提交于
      This is a fix for bug 15185229 ZWJ not working in Sinhala and Kannada.
      
      Indic fonts (unlike Arabic) require the entire string, including ZWJ,
      to be passed to Harfbuzz; it's not enough for the ZWJ to be present in
      the context. The solution is to be "sticky" in font itemization,
      continuing to use the same font as long as it has Unicode coverage.
      
      Change-Id: I7673bc56fbda09f1e1a4582e8d88342343b706f1
      066e8575
    • R
      Language and variant selection · 7b221d97
      Raph Levien 提交于
      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
      7b221d97
  27. 27 5月, 2014 1 次提交
    • R
      Caching for layouts and harfbuzz faces · 4d4e6bc8
      Raph Levien 提交于
      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
      4d4e6bc8
  28. 24 5月, 2014 1 次提交
    • R
      Fix native crash in Latin-1 typefaces · 72fe9422
      Raph Levien 提交于
      This is a fix for bug 15171911 Timely crashes (native crash in
      libminikin) when I go to add a new alarm
      
      This patch fixes an off-by-one error that caused typefaces with only one
      page of Unicode coverage (ASCII or Latin-1) to have nPages = 0 instead
      of the correct value of 1 in the corresponding FontCollection.
      
      Change-Id: Id8be0c9e5713b8af22d863992921ee6382416a34
      72fe9422
  29. 23 5月, 2014 1 次提交
    • R
      Caching for layouts and harfbuzz faces · cf6d68c3
      Raph Levien 提交于
      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.
      
      Change-Id: Ie8176857e2d78656ce5479a7c04969819ef2718d
      cf6d68c3
  30. 20 5月, 2014 2 次提交
    • R
      Fix incomplete refcounting and locking · 55f3653a
      Raph Levien 提交于
      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
      55f3653a
    • R
      Fix incomplete refcounting and locking · c31e3883
      Raph Levien 提交于
      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
      c31e3883
  31. 13 5月, 2014 2 次提交
    • R
      Better refcounting and locking · b80c1f19
      Raph Levien 提交于
      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
      b80c1f19
    • R
      A basket of features: itemization, bounds, refcount · ecc2d34a
      Raph Levien 提交于
      This patch improves script run itemization and also exposes metrics
      and bounds for layouts. In addition, there is a fair amount of internal
      cleanup, including ref counting, and making the MinikinFont abstraction
      strong enough to support both FreeType and Skia implementations. There
      is also a sample implementation using Skia, in the sample directory.
      
      As part of its functionality, his patch measures the bounds of the
      layout and gives access through Layout::GetBounds().  The corresponding
      method is not implemented in the FreeType-only implementation of
      MinikinFont, so that will probably have to be fixed.
      
      Change-Id: Ib1a3fe9d7c90519ac651fb4aa957848e4bb758ec
      ecc2d34a