summaryrefslogtreecommitdiffstats
path: root/core/java/android/text/Layout.java
Commit message (Collapse)AuthorAgeFilesLines
* Uses VMRuntime.newUnpaddedArray for ideal array sizesAdam Lesinski2014-03-271-8/+4
| | | | | | Bug:13028925 Change-Id: I0a9301248b10a339afbdc5e4ffe3310ac4fa1fb7
* Fix for "Can't place cursor after combining accent"Raph Levien2013-09-201-1/+1
| | | | | | | | | | | | | | This patch fixes behavior where attempting to place the cursor at the end of a string where the last character is a combining accent actually placed it before that accent. This was especially annoying for editing Thai text, because it made it difficult to delete a trailing tone mark. Fixes bug 8947569 "Can't place cursor after combining accent" and bug 10398332 "[Thailand] Thai Language(IME) -- Can't delete Thai tone mark while writing message" Change-Id: Ida1933c8f0ab6cdb0200db39891e9389e4bdba86
* Suppress horizontal scrolling with trailing blanksRaph Levien2012-12-201-9/+48
| | | | | | | | | | | | | | | | The existing behavior of EditText is that trailing blanks can cause a line to exceed the layout width, causing the cursor to extend past the line, which in turn causes horizontal scrolling. This patch clamps the cursor to the layout width in the non-scrolling case, which makes the spaces effectively invisible when they're at the end of the line, but at least suppresses the scrolling. The clamping only works reliably in left-to-right alignments, so this patch checks for than and only enables the clamping in those cases. Fix for bug 7699295. Change-Id: I22bc4e6c9ded3d7716edfcf10dd2b5c31a5da9de
* Fix bug #7282594 EditText does not allow to move the cursor when typing RTL ↵Fabrice Di Meglio2012-10-031-6/+9
| | | | | | | | text and if gravity is set to LEFT - fold LEFT/RIGHT into NORMAL/OPPOSITE cases Change-Id: Idf14342ffed4840e7b4ea53cc42f1cde8f196a4c
* Merge "Fix bug #6661824 Hebrew Text can be clipped" into jb-devFabrice Di Meglio2012-06-141-3/+11
|\
| * Fix bug #6661824 Hebrew Text can be clippedFabrice Di Meglio2012-06-131-3/+11
| | | | | | | | | | | | - use the correct ellipsis char in both measurement and rendered string Change-Id: Ia00285fc16da528f18702719026503b5d0610642
* | Prevent a crash when maxLines is set to 0Gilles Debunne2012-06-111-0/+1
|/ | | | | | | | | | | | Bug 6642222 Using setMaxLines(0) and setMinHeight(30) causes a crash because Layout#getLineRangeForDraw() returns a [0,0] interval in that case. Accessing the Direction in draw causes a NPE. Change-Id: If50f9b554e3cdc598a721b623992e9196982838c
* Basic renaming refactoring in LayoutGilles Debunne2012-04-251-15/+15
| | | | Change-Id: I79f5444a097f1e2b2a81ececf1f0a14b6d7d5179
* Use SpanSet to accelerate Layout.drawBackgroundGilles Debunne2012-03-131-32/+60
| | | | | | | | | The main performance improvement should come from the fact that we entirely skip the loop (which calls getLineStart, getLineTop and getLineDescent on each line) in the frequent case where there are no LineBackgroundSpans. Change-Id: Ie2d3168521e88d43f1a4236da2b3e8447606df1e
* EditText caches only text in its internal display list.Gilles Debunne2012-03-051-117/+120
| | | | | | | | | | Decorelate background and text in layout display. This allows to only store the text in the editable TextView's display list. Selection and cursor changes no longer need to invalidate the display list, leading to faster rendering. Change-Id: I3af3a98846e1bfe2d9ec6c42590e71bf3704595e
* Fix bug #5243493 TextView selection is not working correctly when there is ↵Fabrice Di Meglio2011-09-021-0/+29
| | | | | | | | | | some RTL run into it Part 2 - make selection handles aware of the run direction Change-Id: Idf41036de53d8968e7ae27eb87aea09e86bcd652
* Fix bug #5243493 TextView selection is not working correctly when there is ↵Fabrice Di Meglio2011-08-311-1/+4
| | | | | | | | some RTL run into it - make the selection green highlight work Change-Id: I4e3b88e3720288f973b1b9e68afa8f800ad13779
* Fix bug #3388534 Long file names are improperly displayed when playedFabrice Di Meglio2011-08-151-11/+4
| | | | | | | | | | - force ellipsising when there are more lines found than maxLines - do not care about lines when we have reached maxLines - also fix relayouting when changing maxLines thru setMaxLines() - do not allow START / MIDDLE ellipsis when there are multiple lines (and print a log accordingly) Change-Id: I90f5a7f5200a220aceee01fb7300bec2c4c3a075
* Implement textDirection heuristic selection.Doug Felt2011-07-141-3/+36
| | | | Change-Id: I2fcf18de573f2d66494fa5ed61e4273c3c6078c7
* Support control of text alignment.Doug Felt2011-06-291-10/+34
| | | | Change-Id: Id6f3682f67ba2e6811e3014cd34a281e6dd0a469
* am 8b22ef66: am e41d2aed: Merge "Using robust equality check."Conley Owens2011-04-291-1/+1
|\ | | | | | | | | * commit '8b22ef66ef1a67333e2f1d4250d2c134b50ef91a': Using robust equality check.
| * Using robust equality check.Jozef BABJAK2011-03-171-1/+1
| | | | | | | | Change-Id: Ie30684c472bfa38d0432f855f7075c34709958d5
| * Support surrogate pairs when layouting textTakako Ishibashi2010-08-261-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | The current framework does not consider surrogate pairs when getting the index of the character. This bug becomes visible when creating the text including Emojis. For example cursor breaks up when it moves around the Emojis. Our proposed solution will consider the surrogate pairs when calculating the index. It will fix not only the Emoji case, but also the letters that use surrogate pairs. Change-Id: I4983f2e4df933c8af9d5f0cc27df871e8e10fed4
* | Bugfixes in StaticLayout.Gilles Debunne2011-02-181-10/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bug 3422121 With ellipsize, lines starting with a very long word that does not fit inside the width were simply ignored. Cut the long word instead. start - widthStart index offset shift in BiDi. The original ellipsize-end patch that added '...' after the last word on end-ellipsized lines has been punted in favor of a true ellipsize support in I. I believe the StaticLayout calculateEllipsise is a no-op since textwidth <= avail by construction: fitWidth and okwidth are < outerWidth. The only exception is the paraEnd != here case in generate (when not a single character fits in width). This case is exercised by StaticLayoutTest in cts (width of 8 pixels) and revealed an offset error in widstart. All in all, it looks like this code was probably never really tested. I tried some typical text configuration to make sure these changes improved the situation. Change-Id: Ibee410bd7db453abf93e10e8beb844eae998922c
* | Text insertion cursor is now defined by a Drawable.Gilles Debunne2011-02-141-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Bug 3261766 If defined, the drawable is used instead of directly drawing a 1 pixel line. This makes the cursor more fancy and more visible. The drawable is currently clipped by the TextView's limits, which is currently visible on the left when the cursor is at the first position. To solve this issue properly, we would need to propagate a do-not-clip up in the hierarchy. Change-Id: I99f6001048eed14104994acf6bab942dda8eb38e
* | Pixel were missing on the last line of text when using MaxLines.Gilles Debunne2011-01-301-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Bug 3295544 Only the last line of text includes the bottomPadding (extra line spacing below the characters' descent. When The text is clipped using maxLines, the desired height correctly added this value, but getLineTop and getLineDescent are also used when the layout is drawn. The fix is to make the layout aware of its clipping so that these values are correctly updated. Change-Id: I703656cf45022d34a90f55f0ed8fc5e4b30f80b1
* | Fix for IOOBoundsExc in SpannableStringBuilderGilles Debunne2010-11-161-10/+18
| | | | | | | | | | | | Bug 3182953 Change-Id: Idc7faa86b8250bf325e2547d7d4c094300a06686
* | Add keycodes and meta-key modifiers to support external keyboards.Jeff Brown2010-10-151-6/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added new key maps for external keyboards. These maps are intended to be shared across devices by inheriting the "keyboards.mk" product makefile as part of the device's product definition. One of the trickier changes here was to unwind some code in MetaKeyKeyListener that assumed that only the low 8 bits of the meta key state were actually used. The new code abandons bitshifts in favor of simple conditionals that are probably easier to read anyways. The special meta key state constants used by MetaKeyKeyListener are now (@hide) defined in KeyEvent now so as to make it clearer that they share the same code space even if those codes are not valid for KeyEvents. The EventHub now takes care of detecting the appropriate key layout map and key character map when the device is added and sets system properties accordingly. This avoids having duplicate code in KeyCharacterMap to probe for the appropriate key character map although the current probing mechanism has been preserved for legacy reasons just in case. Added support for tracking caps lock, num lock and scroll lock and turning their corresponding LEDs on and off as needed. The key character map format will need to be updated to correctly support PC style external keyboard semantics related to modifier keys. That will come in a later change so caps lock doesn't actually do anything right now except turn the shiny LEDs on and off... Added a list of symbolic key names to KeyEvent and improved the toString() output for debug diagnosis. Having this list in a central place in the framework also allows us to remove it from Monkey so there is one less thing to maintain when we add new keycodes. Bug: 2912307 Change-Id: If8c25e8d50a7c29bbf5d663c94284f5f86de5da4
* | Speedup TextView fades (no more layers required.)Romain Guy2010-08-181-1/+1
| | | | | | | | | | | | | | Also fixes a crash in the drop shadows cache and improves drop shadows caching. Change-Id: I9c0208a49467f9201d786ae0c129194b8d423923
* | Fix a bug where paragraph styles could leak onto an adjacent empty line.Eric Fischer2010-08-051-9/+41
| | | | | | | | | | | | | | | | When the text ends with an empty line, the getSpans() call to retrieve styles for it would also retrieve the styles of the preceding line. Add a special case to detect and prevent this. Change-Id: I888131cacce6bf45e68c53c931ebe8d58db0b7a9
* | Move shaping to native.Doug Felt2010-06-101-20/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add internal API (getTextRunAdvances) to Paint, use when measuring. Add internal API (getTextRunCursor) to Paint, use when determining valid cursor positions. Remove java-level shaping code. Remove 'prep' code in TextLine (except for replacement text) since shaping now is done on the fly as needed in native. Provide explicit shaping context bounds to internal text measuring, cursor movement, and rendering APIs. Update for to changes in external API in ushape.h. Change-Id: I146958b624802ce8553125e5c3c6c03031bc9608
* | Fix alignment issues with RTL paragraphs.Doug Felt2010-06-031-154/+320
| | | | | | | | | | | | | | Also remove unused debugging code that depends on junit. Remove trailing whitespace in changed code. Change-Id: Ie02d1b8220c599a672ee6e91af0fba634e0f620c
* | Refactor Styled utility functions into reusable objects.Doug Felt2010-04-071-549/+82
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This takes utility functions from Styled and a few other classes and incorporates them into two new utility classes, TextLine and MeasuredText. The main point of this is to support shaping by skia, to experiment with how this will look, this also introduces character-based Arabic shaping. MeasuredText is used by code that determines line breaks by generating and examining character widths in logical order. Factoring the code in this way makes it usable by the ellipsize functions in TextUtils as well as by StaticLayout. This class takes over the caching of widths and chars arrays that was previously performed by StyledText. A small number of MeasuredText objects are themselves cached by the class and accesed using static obtain and recycle methods. Generally only these few cached instances are ever created. TextLine is used by code that draws or measures text on a line. This unifies the line measuring and rendering code, and pushes assumptions about how rtl text is treated closer to the points where skia code is invoked. TextLine implements the functions that were previously provided by Styled, working on member arrays rather than explicitly-passed arguments. It implements the same kind of static cache as MeasuredText. TextLine and MeasureText simulate arabic glyph generation and shaping by using ArabicShaping, ported with very minor changes from ICU4J's ArabicShaping. This class generates shaped Arabic glyphs and Lam-Alef ligatures using Unicode presentation forms. ArabicShaping is not intended to be permanent, but to be replaced by real shaping from the skia layer. It is introduced in order to emulate the behavior of real shaping so that higher level code dealing with rendering shaped text and cursor movement over ligatures can be developed and tested; it also provides basic-level support for Arabic. Since cursor movement depends on conjuncts whose formation is font-dependent, cursor movement code that was formerly in Layout and StaticLayout was moved into TextLine so that it can work on the shaped text. Other than these changes, the other major change is a rework of the ellipsize utility functions to combine multiple branches into fewer branches with additional state. Updated copyright notices on new files. Change-Id: I492cb58b51f5aaf6f14cb1419bdbed49eac5ba29
* | Don't measure for a secondary caret unless we have one.Doug Felt2010-03-311-18/+29
| | | | | | | | | | | | Also, clean up imports and trailing whitespace. Change-Id: I5ebaaceb756600a1ca7370ab3ef078ce200545ef
* | Enable nested bidi levels in a paragraph.Doug Felt2010-03-311-308/+368
|/ | | | | | | | | | | | Changes the internal representation of direction information in the Directions object to be a visually-ordered list of start/length+direction pairs instead of a list of directionality inversion offsets. Rewrite Layout.getOffsetToLeft/RightOf to use run information instead of width metrics. Remove java Bidi, use native. Switch bidi tests to test native, expect levels instead of dirs. Add test of directionality. Leave in switch to turn new code off and restore previous behavior for now. Change-Id: Iea8bb46c678a18820e237c90f76007a084c83051
* Factor bidi algorithm into separate method.Doug Felt2010-02-241-0/+5
| | | | | Add rudimentary support for overriding default base line direction heuristic. Add some simple tests of the bidi implementation.
* Enhance text docs, rename some variables for clarity, comment places in the codeDoug Felt2010-02-161-72/+145
| | | | for further investigation.
* support for multiline paragraph style indentationMark Wagner2009-10-161-2/+13
| | | | | | | | | | | | | | | | | | | | This change is likely incomplete and perhaps not right in other ways. The gist of the change is that the span can return the number of lines to which to apply the "leading margin". Some specific things that should be looked at: 1) if the user has nested multiple LeadingMarginSpans then they will inherit the "line count" feature. This is wrong but I didn't want to spend time fixing it until it was clear that this overall approach was acceptible. 2) The units for how many lines should indented is "lines" rather than something like dips. 3) I wasn't sure what our strategy was for binary compatibility so I didn't want to modify the methods in LeadingMarginSpan. Instead I made another interface with extends LeadingMarginSpan that has the extra method to return the line count.
* Fix an emoji-measuring bug that caused an exception when editing a contact.Eric Fischer2009-09-011-1/+1
| | | | | | | | | | | | | | | It was measuring the text to try to determine the size that it needed to scale the emoji character to. Unfortunately it was accidentally trying to measure the character under the cursor instead of the emoji character itself, which is wrong, but more seriously doesn't work at all when the cursor is at the end of the line. This was already fixed before in change 144474, but that change never got merged over to donut. So this merges it now. Bug 2087915 Change-Id: Ib4804d330a029a966207b3b07271f84e6b2652c0
* text: Remove references to android.util.ConfigDave Bort2009-04-131-4/+5
| | | | | | | The semantics of Config.DEBUG will be changing soon, and all other Config.* fields will become deprecated/hidden. BUG=1780938
* AI 143165: am: CL 142861 Make TextView Emoji scale to match the size of the ↵Eric Fischer2009-03-271-16/+45
| | | | | | | | | text. Original author: enf Merged from: //branches/cupcake/... Automated import of CL 143165
* auto import from //branches/cupcake_rel/...@140373The Android Open Source Project2009-03-181-5/+100
|
* auto import from //depot/cupcake/@135843The Android Open Source Project2009-03-031-0/+1747
|
* auto import from //depot/cupcake/@135843The Android Open Source Project2009-03-031-1747/+0
|
* auto import from //branches/cupcake/...@125939The Android Open Source Project2009-01-091-1/+3
|
* Initial ContributionThe Android Open Source Project2008-10-211-0/+1745