summaryrefslogtreecommitdiffstats
path: root/libs
Commit message (Collapse)AuthorAgeFilesLines
* Merge "Use ASCII HYPHEN-MINUS when there's no HYPHEN in the font." into mnc-devRoozbeh Pournader2015-06-121-1/+11
|\
| * Use ASCII HYPHEN-MINUS when there's no HYPHEN in the font.Roozbeh Pournader2015-06-121-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, we just assumed the font in use had a U+2010 HYPHEN character, resulting in a tofu (or an empty space) being shown when U+2010 was not supported in the font used to render the hyphenated word. Now we try to fallback to U+002D HYPHEN-MINUS, which has a very good chance of being available in at least any Latin font. We still show a tofu when neither character is supported, to intentionally alert that something is missing. Bug: 20497913 Bug: 21088552 Bug: 21570828 Change-Id: Iff69bbc38836c03495e9124502b5207c39270da2
* | Merge "Increase hyphenation penalty for short last line" into mnc-devRaph Levien2015-06-121-63/+37
|\ \
| * | Increase hyphenation penalty for short last lineRaph Levien2015-06-081-63/+37
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | Tuning for hyphenation parameters. We discourage hyphenation on the last line, but offset this penalty by also applying a penalty for each line, which optimizes for minimizing the number of lines. Thus, when hyphenation can reduce the number of lines, it increases the chance they're used. There's probably more tuning and refinement that can be done, but testing suggests that the tunable parameters are appropriate. Bug: 20883322 Change-Id: Ida7eaf8aced109e426694f5a386924a842d29c4b
* / Fix: getOffsetForAdvance can return worng offset.Keisuke Kuroyanagi2015-06-101-8/+14
|/ | | | | | | | | | searchStart was passed to getRunAdvance, but it can be different from the start that has been used to initialize Layout object. As a result, wrong index could be used in getRunAdvance. Bug: 21744454 Change-Id: Ibe83cc50ed6f0da2a1532318bc224502be350699
* Merge "Use context start correctly in getRunAdvance" into mnc-devRaph Levien2015-06-011-1/+1
|\
| * Use context start correctly in getRunAdvanceRaph Levien2015-06-011-1/+1
| | | | | | | | | | | | | | | | | | | | We were not taking context start into account when deciding whether to split a ligature, which was causing inconsistent behavior. This patch consistently references the widths array relative to the start of the context. Bug: 21549197 Change-Id: I7c71e10c1af84354fefe782fc0b87120016e6555
* | Disable hyphenation for unreasonably long wordsRaph Levien2015-06-011-1/+7
|/ | | | | | | | | Very long words cause O(n^2) behavior. These are unlikely to happen in real text, but do happen with synthetic strings, so in those cases we just disable hyphenation. Bug: 20790394 Change-Id: Idf957dd40b24efe1476f619f17093a48b5bc56f7
* Support hyphenation frequency in Minikin.Roozbeh Pournader2015-05-121-1/+7
| | | | | | | | | | | | | | | | Three hyphenation frequencies are now supported: kHyphenationFrequency_None, which turns off both automatic hyphenation and soft hyphens. kHyphenationFrequency_Normal, which has aconservative amount of hyphenation useful as a conservative default. kHyphenationFrequency_Full, which has a typographic-quality amount of hyphenation useful for running text and tight screens. Bug: 21038249 Change-Id: I2800f718c887c9389a1a059d7ec07d7fa2ca1dee
* Move Bitmap to a different namespaceJohn Reck2015-04-271-39/+43
| | | | | | | namespace naming collision. Move minikin's Bitmap out of android:: and into minikin:: Change-Id: I5ae3925f81b848dc79576429ab55243b96f7fed2
* Don't include trailing newline in width for line breakingRaph Levien2015-04-221-3/+4
| | | | | | | | | | | | | | | In a paragraph with a trailing newline, the width of the newline character was included in the line width for breaking purposes, basically as if it were a non-breaking space. This caused a discrepancy, where Layout.getDesiredWidth() suggested that the text would fit in a single line, but StaticLayout would break it because of the added width of the newline character. The proposed fix is simply to consider newline to be a space that disappears at the end of a line. Bug: 20152308 Change-Id: I539574c5b8ea892c8ed6aca6c59e90ccdf74a680
* Add functions for measuring cursor positioningRaph Levien2015-04-153-4/+121
| | | | | | | New functions for computing the correspondence between cursor position and advance, respecting grapheme boundaries. Change-Id: I620378d5f64cd74300cd43db522adeb555825dff
* Rename "margins" to "indents"Raph Levien2015-04-151-2/+2
| | | | | | | The name "margin" conflicts with another meaning, so we're making the name in the public api "idents" and the code consistent in naming. Change-Id: I9170116b4d972e4b25f0f319e78376310288eb41
* Add margins array to line widths objectRaph Levien2015-04-151-0/+5
| | | | | | | | | | | In order to support layout in non-rectangular regions, the LineWidths object needs to accept an arbitrary array of margins. This is implemented in addition to the existing firstWidthLineCount/restWidth mechanism for convenience, though using only arrays would have the same expressive power. Bug: 20182243 Change-Id: Iea96bca1a92012314ac27e617c67f306c1f1b2f2
* Revert "Fix build: Revert "Add hyphenation to line breaking""Raph Levien2015-03-303-36/+313
| | | | This reverts commit 0b25d5ac85533f64764a0d53d5e5d33b46b715fa.
* Fix build: Revert "Add hyphenation to line breaking"Ed Heyl2015-03-303-313/+36
| | | | | | This reverts commit daf6a6bdbf2ff1f66496d6200cb253e2f50759d5. Change-Id: I3fed65046274d3aeb748f0730585ab89927f5741
* Add hyphenation to line breakingRaph Levien2015-03-303-36/+313
| | | | | | | | | | | | | | | | This patch adds hyphenation using the Liang hyphenation algorithm, similar to TeX. It also improves the optimized line breaker so that it works correctly and efficiently even when the line width is not constant (there is a specialization for constant width, which is probably worthwhile, but performance TODOs remain). Still to be done: * hyphenator has many shortcuts, only tested with English * interaction between punctuation and hyphenation is problematic Change-Id: I2d94a1668ebc536398b7c43fcf486333eeb7c6aa
* Add LineBreaker to MinikinRaph Levien2015-03-263-13/+302
| | | | | | | | | | | | | This patch adds a LineBreaker class to Minikin, which will be used for computing line breaks in StaticLayout. The version in this patch contains basically the same functionality that existed before, but hopefully better performance and an interface that's suitable for more sophisticated paragraph layout. Note that this version contains a high quality strategy, which mostly works but doesn't respect varying line width. Change-Id: I02485d58b1e52856296a72cdd4efd963bc572933
* HyphenEdit in support of hyphenationRaph Levien2015-03-121-1/+17
| | | | | | | | Adds a "HyphenEdit" field to the Minikin Paint object, which represents an edit to the text to add a hyphen (and, in the future, other edits to support nonstandard hyphenation). Change-Id: Ib4ee690b0fe2137e1d1e2c9251e5526b274ec3a7
* Disable HarfBuzz's fallback to compatibility decompositionsRoozbeh Pournader2015-02-251-2/+13
| | | | | | | | | | | | | Previously, HarfBuzz's default fallback to compatibility decompositions resulted in Mathematical Alphanumeric Symbols getting rendered as normal letters and digits when there was no font available to render them. This patch disables that fallback, to ensure they are displayed as tofus. Based on a patch by Behdad Esfahbod. Bug: 19202569 Change-Id: I357f172302448d4ab0b24efc86119f1977b5996b
* am 79298c34: am 5870d4f0: Remove hardcoded ICU include paths.Narayan Kamath2015-01-051-1/+0
|\ | | | | | | | | * commit '79298c346088e13a0ddc93d49f4bb100afdbd14b': Remove hardcoded ICU include paths.
| * am 5870d4f0: Remove hardcoded ICU include paths.Narayan Kamath2015-01-051-1/+0
| |\ | | | | | | | | | | | | * commit '5870d4f0d46f185568a2d2ea45afe48ae999b223': Remove hardcoded ICU include paths.
| | * Remove hardcoded ICU include paths.Narayan Kamath2015-01-051-1/+0
| | | | | | | | | | | | | | | | | | | | | ICU exports them using LOCAL_EXPORT_C_INCLUDE_DIRS. bug: 18581021 Change-Id: Ia57b3b4d231966203274b0e7e7b850beb1bd11c0
* | | am 919fbb99: am cb20a2f0: Minikin: Remove unused variables, fix init orderAndreas Gampe2014-12-044-8/+20
|\| | | | | | | | | | | | | | * commit '919fbb99f1d5d0c95bf165cec9b7b178b42908ec': Minikin: Remove unused variables, fix init order
| * | am cb20a2f0: Minikin: Remove unused variables, fix init orderAndreas Gampe2014-12-044-8/+20
| |\| | | | | | | | | | | | | * commit 'cb20a2f0b366bfc16db3a489a60156dec7a9fe21': Minikin: Remove unused variables, fix init order
| | * Minikin: Remove unused variables, fix init orderAndreas Gampe2014-12-034-8/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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-032-51/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | am dc81fbad: am 69d4fba2: Move frameworks/minikin over to libc++.Dan Albert2014-11-122-5/+5
|\| | | | | | | | | | | | | | * commit 'dc81fbad809f08564199c8f08df7e7f72310961a': Move frameworks/minikin over to libc++.
| * | am 69d4fba2: Move frameworks/minikin over to libc++.Dan Albert2014-11-122-5/+5
| |\| | | | | | | | | | | | | * commit '69d4fba2f2b7bb2c248cc0e78cf277a6e44665f8': Move frameworks/minikin over to libc++.
| | * Move frameworks/minikin over to libc++.Dan Albert2014-11-112-5/+5
| | | | | | | | | | | | | | | Bug: 15193147 Change-Id: I5e15c95415c39515340e2663acd5fd26666db720
* | | am 253320d2: Move coverage bitmap from FontCollection to FontFamilyRaph Levien2014-10-312-51/+53
|\| | | | | | | | | | | | | | * commit '253320d25fccbb49621926d49dcf5ef64cf529c6': Move coverage bitmap from FontCollection to FontFamily
| * | Move coverage bitmap from FontCollection to FontFamilyRaph Levien2014-10-292-51/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | am 5f11abd3: Silently ignore invalid rangeOffset valuesRaph Levien2014-10-241-11/+12
|\| | | | | | | | | | | | | | * commit '5f11abd31fa8cfa723f54bd1c98ce4e27e7d3c77': Silently ignore invalid rangeOffset values
| * | Silently ignore invalid rangeOffset valuesRaph Levien2014-10-231-11/+12
| |/ | | | | | | | | | | | | | | | | | | | | Some fonts contain a cmap segment for char 0xffff that contains an invalid rangeOffset. This was rejected by the existing code, which means the font is considered to have empty Unicode coverage. This patch just discards the invalid segment (consistent with OpenType Sanitizer), making the custom font display. Bug: 18106256 Change-Id: Icc8616a3030f80e62db906332be64d434ae72ea2
* | am d5804e39: Fine-tune fake-bolding conditionRaph Levien2014-09-231-4/+4
|\| | | | | | | | | * commit 'd5804e3937a961736e5cef0e8a70eacf91ee00bb': Fine-tune fake-bolding condition
| * Fine-tune fake-bolding conditionstaging/cm-12.0-cafRaph Levien2014-09-221-4/+4
| | | | | | | | | | | | | | | | | | | | The old logic for fake bolding results in no fake bolding for a bold span on a light weight (300) because the target weight (600 in this case) didn't meet the condition. This patch fine-tunes the threshold to enable fake bolding for this. Bug: 17587185 Change-Id: I04abd00a74240cbed79c417f81486aa2158b2806
* | am 6740536e: Snap advance widths to integersRaph Levien2014-09-041-8/+18
|\| | | | | | | | | * commit '6740536e3927d25bf5c2567e5f6e8c175973cbb7': Snap advance widths to integers
| * Snap advance widths to integersRaph Levien2014-09-031-8/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | Fractional advance widths were causing subtle problems with text positioning when the same text was drawn with different spans in the hwui renderer. Quantizing the coordinates on layout (as opposed to waiting until the renderer draws the glyphs) solves the problem. This patch also fixes a discrepancy between x position and advance widths when letterspacing. Bug: 17347779 Change-Id: Ia705944047408c2839d5ad078eefd6bbec446872
* | am 997c799e: Try Unicode decomposition for selecting fallback fontRaph Levien2014-08-271-1/+15
|\| | | | | | | | | * commit '997c799e3ec6bf8adf687e29670d23d91e0f5fee': Try Unicode decomposition for selecting fallback font
| * Try Unicode decomposition for selecting fallback fontRaph Levien2014-08-261-1/+15
| | | | | | | | | | | | | | | | | | | | | | 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
* | am 56c7fb8c: Allocate font vector on stackBehdad Esfahbod2014-08-221-3/+12
|\| | | | | | | | | * commit '56c7fb8c0633f1b02115bb4370854016f8c84fb4': Allocate font vector on stack
| * Allocate font vector on stackBehdad Esfahbod2014-08-211-3/+12
| | | | | | | | | | | | | | | | This reduces another allocation (last one?) we were doing when fulfilling shaping requests from the cache. Bug: 17111260 Change-Id: Ieb8ae1ccfcaacedb257e1e9263777f10623aaf98
* | am 6da7796c: Fix Layout initialization in the skipCache pathBehdad Esfahbod2014-08-211-6/+11
|\| | | | | | | | | * commit '6da7796cbe8a17efd61a3302369e69bb222fdb4f': Fix Layout initialization in the skipCache path
| * Fix Layout initialization in the skipCache pathBehdad Esfahbod2014-08-211-6/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | C++ local var initialization always tricks me. Previously, Layout didn't have a constructor, which meant that defining it on the stack left mAdvance uninitialized. This was not an issue when we were doing "new Layout()", since that invokes zero-initialization, but was an issue for the skipCache path that was allocating layout on stack by just "Layout l" instead of "Layout l = Layout()". To avoid surprises, add a constructors that clears everything. Also adds reset() method to reset the layout for reuse. Change-Id: I3e02f00da9dd7d360abe13f63c310f6882292d0a
* | am 288c9159: Speed up cache lookupBehdad Esfahbod2014-08-211-35/+64
|\| | | | | | | | | * commit '288c915963b3500c7efb958ba613650e2ecdfdfa': Speed up cache lookup
| * Speed up cache lookupBehdad Esfahbod2014-08-211-35/+64
| | | | | | | | | | | | | | Avoid copying the string for cache lookup. Bug: 17111260 Change-Id: Ic220bfc991fc6b3dada197304aabdf72a8941bd7
* | am f952161b: Choose same font for Emoji keycap and its base characterBehdad Esfahbod2014-08-081-2/+17
|\| | | | | | | | | * commit 'f952161b874fd2e9af474b9fd2ebcca1f3bb4555': Choose same font for Emoji keycap and its base character
| * Choose same font for Emoji keycap and its base characterBehdad Esfahbod2014-08-081-2/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | am 5986f604: Support fontFeatureSettingsBehdad Esfahbod2014-07-301-12/+23
|\| | | | | | | | | * commit '5986f6048ae21e0ec094c1f2ca0169d0ca6ec6b5': Support fontFeatureSettings
| * Support fontFeatureSettingsBehdad Esfahbod2014-07-301-12/+23
| | | | | | | | | | Bug: 15246510 Change-Id: I544915d29b2be4fb9f82f1989188a3a918c50fbc