summaryrefslogtreecommitdiffstats
path: root/ui/gfx/render_text_pango.cc
Commit message (Collapse)AuthorAgeFilesLines
* Delete RenderTextWin and RenderTextPango.derat2015-02-031-535/+0
| | | | | | | | | | | | | | | | Windows, Linux, and Chrome OS use the cross-platform RenderTextHarfBuzz class as of M40. Remove the platform-specific RenderText implementations. Also update chrome://flags so that only Mac users can control whether RenderTextHarfBuzz is used. RenderTextMac is still used there by default. BUG=321868,398885 Review URL: https://codereview.chromium.org/891013003 Cr-Commit-Position: refs/heads/master@{#314242}
* MacViews: Use RenderTextHarfBuzz only for Textfieldsandresantoso2014-12-091-0/+4
| | | | | | | | | | | Using RenderTextHarfBuzz for string sizing and eliding on Mac is problematic because it may not match when drawn by Cocoa, so we use RenderTextMac. But RenderTextMac does not have support for editing that is needed by views::Textfield, so use RenderTextHarfBuzz for MacViews textfields. Review URL: https://codereview.chromium.org/779793006 Cr-Commit-Position: refs/heads/master@{#307396}
* Don't paint text outside display areaarjanl2014-09-161-3/+13
| | | | | | | | | | | | | | | | | When rendering text, we don't have to render glyphs that fall outside of the display area. This change stops processing glyps when we're outside the display area, and stops processing further style ranges if those are outside the display area. Note that the equivalent functionality is already in place for Windows text rendering. This fixes an issue where text rendering would become very slow when rendering big strings. BUG=413540 Review URL: https://codereview.chromium.org/543073002 Cr-Commit-Position: refs/heads/master@{#295023}
* linux: Make RenderTextPango avoid clipping underlines.derat2014-08-291-3/+12
| | | | | | | | | | | | | | | | | | | | | Adjust underline positions so the lines won't get clipped. I think that the inaccuracy may be occurring due to our conversion from PangoFontDescriptions (usually containing a point-based size) to a rounded pixel-based size and then back to a PangoFontDescription. Luckily, RenderTextPango will be replaced by RenderTextHarfBuzz soon. Also delete some dead code in PlatformFontPango for computing underline metrics. BUG=393117 TEST=manual: checked that the "Import bookmarks now..." underline is visible after setting my UI font to "Ubuntu 11" Review URL: https://codereview.chromium.org/509093004 Cr-Commit-Position: refs/heads/master@{#292537}
* Unify desktop Linux and Chrome OS font rendering params.derat@chromium.org2014-07-181-2/+4
| | | | | | | | | | | | | | | | | | | | | | | Use the same path to get font rendering settings on desktop Linux and Chrome OS: query the LinuxFontDelegate if it's set and then query Fontconfig. Also make the LinuxFontDelegate interface return a PangoFontDescription directly (as opposed to an opaque string that's actually a stringified PangoFontDescription) and make it return a cached FontRenderParams struct instead of exposing separate methods for looking up individual properties. Finally, add a missing build dependency on ui_test_pak, which is needed to get the default font resource when running gfx_unittests on Chrome OS. BUG=125235,393067 Review URL: https://codereview.chromium.org/400193004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@284255 0039d316-1c4b-4281-b951-d872f2087c98
* ui/gfx: Allow for font-specific rendering settings.derat@chromium.org2014-07-141-5/+5
| | | | | | | | | | | | | | Let implementations attach a FontRenderParams to a gfx::PlatformFont rather than using a single default everywhere. On Linux and Chrome OS, query FontConfig for font-specific rendering settings. BUG=125235,375824 TBR=jorgelo@chromium.org Review URL: https://codereview.chromium.org/382273002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@283001 0039d316-1c4b-4281-b951-d872f2087c98
* Apply hinting in SkiaTextRenderer::SetFontRenderParams().derat@chromium.org2014-07-111-19/+2
| | | | | | | | | | | | | Make SetFontRenderParams() pass the hinting setting through to SkPaint instead of exposing a separate SetFontHinting() method. Also add a default c'tor for FontRenderParams and pass its autohinter setting through to SkPaint as well. BUG=125235,375824 Review URL: https://codereview.chromium.org/387743002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@282703 0039d316-1c4b-4281-b951-d872f2087c98
* Move gfx::ElideText functionality to RenderText.msw@chromium.org2014-07-101-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a prerequisite for http://crrev.com/23228004 (RenderText must elide correctly for direct Label use) Use RenderText in gfx::ElideText on Win, Linux, Mac. (old impl still needed for iOS and Android, for now) Support additional eliding types in RenderText. (matches behavior of gfx::ElideText, see TextEliderTest) (still fixes the directionality of trailing ellipses) (respect head and middle eliding when truncating) Disambiguate gfx::NO_ELIDE from gfx::TRUNCATE. Make the ElideEmail helper a private RenderText function. Disable tests and no-op gfx::ElideText on iOS/Android. Improve ElideTextSurrogatePairs perf: 7561 ms -> 3196 ms. TODO: Fix RenderText::ElideEmail GetStringWidthF calls. TODO: Support eliding filenames, like gfx::ElideFilename. BUG=249938,327846,240037,125348,338784 R=asvitkine@chromium.org,sky@chromium.org TEST=No observable text eliding behavior changes. Review URL: https://codereview.chromium.org/354963003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@282433 0039d316-1c4b-4281-b951-d872f2087c98
* Support FontRenderParams on Win; fix RenderTextHarfBuzz.msw@chromium.org2014-07-101-8/+2
| | | | | | | | | | | | | | | | | Set FontRenderParams in RenderTextHarfBuzz on Linux. (required for text aliasing and subpixel settings) Replace font_smoothing_win with font_render_params_win.cc (unify the cross-platform methods of getting this info) BUG=391868,321868 TEST=Chrome OS tray button text looks good with --enable-harfbuzz-rendertext; no other font appearance changes on Win/Linux/CrOS and --enable-harfbuzz-rendertext uses the same font rendering settings as the default Uniscribe/Pango RenderText implementations. R=derat@chromium.org,ckocagil@chromium.org TBR=asvitkine@chromium.org,boliu@chromium.org Review URL: https://codereview.chromium.org/385463002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@282223 0039d316-1c4b-4281-b951-d872f2087c98
* Simplify PangoLayout configuration.derat@chromium.org2014-07-091-6/+2
| | | | | | | | | | | | | | | Remove SetupPangoLayout() and SetupPangoLayoutWithoutFontDescription(). Rename SetupPangoLayoutWithFontDescription() to SetUpPangoLayout() and pass a FontList to it instead of a PangoFontDescription, along with removing an unused "width" parameter. BUG=125235 Review URL: https://codereview.chromium.org/374833005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@281925 0039d316-1c4b-4281-b951-d872f2087c98
* More or less implement RenderTextHarfBuzzckocagil@chromium.org2014-05-221-1/+1
| | | | | | | | | | | Skia font lookup functions for HarfBuzz are from Blink. Much of the implementation copied from RenderTextWin. In the future we should either move the copied methods up, or get rid of all the other RenderText implementations in favor of this one. BUG=321868 TBR=behdad@chromium.org Review URL: https://codereview.chromium.org/152473008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@272260 0039d316-1c4b-4281-b951-d872f2087c98
* Reland: Fix Views inline autocomplete with multi-char graphemes.msw@chromium.org2014-05-021-22/+15
| | | | | | | | | | | | | | | | | | | | | | | (originally r267752, reverted in r267765 for XP test failures) (test disabled on XP for a lack of font support, issue 106450) Allow RenderText selection bounds amid multi-char graphemes. Add a consolidated IsValidLogicalIndex implementation. (this is less strict than the renamed IsValidCursorIndex) Use adjacent cursor positions in MoveCursor as needed. (prevents invalid cursors when collapsing selections) Skip painting empty glyph ranges on Windows. Add a unit test; minor cleanup and comment changes. BUG=327903,366786,106450 TEST=Search for "จำลอง" in the omnibox; enter "จ" and get a valid selection of the inline autocomplete text. TBR=asvitkine@chromium.org Review URL: https://codereview.chromium.org/265903004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@267826 0039d316-1c4b-4281-b951-d872f2087c98
* Revert of Fix Views inline autocomplete with multi-char graphemes. ↵falken@chromium.org2014-05-021-15/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (https://codereview.chromium.org/252563003/) Reason for revert: Sorry to revert. After this patch the following test started failing on XP Tests (3): RenderTextTest.MidGraphemeSelectionBounds Log: http://build.chromium.org/p/chromium.win/builders/XP%20Tests%20%283%29/builds/27345/steps/ui_unittests/logs/MidGraphemeSelectionBounds Snippet from log: c:\b\build\slave\cr-win-rel\build\src\ui\gfx\render_text_unittest.cc(930): error: Value of: render_text->IsValidCursorIndex(1) Actual: true Expected: false Original issue's description: > Fix Views inline autocomplete with multi-char graphemes. > > Allow RenderText selection bounds amid multi-char graphemes. > Add a consolidated IsValidLogicalIndex implementation. > (this is less strict than the renamed IsValidCursorIndex) > > Use adjacent cursor positions in MoveCursor as needed. > (prevents invalid cursors when collapsing selections) > > Skip painting empty glyph ranges on Windows. > Add a unit test; minor cleanup and comment changes. > > BUG=327903,366786 > TEST=Search for "จำลอง" in the omnibox; enter "จ" and get a valid selection of the inline autocomplete text. > R=asvitkine@chromium.org > > Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=267752 TBR=asvitkine@chromium.org,msw@chromium.org NOTREECHECKS=true NOTRY=true BUG=327903,366786 Review URL: https://codereview.chromium.org/263833010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@267765 0039d316-1c4b-4281-b951-d872f2087c98
* Fix Views inline autocomplete with multi-char graphemes.msw@chromium.org2014-05-021-22/+15
| | | | | | | | | | | | | | | | | | | | Allow RenderText selection bounds amid multi-char graphemes. Add a consolidated IsValidLogicalIndex implementation. (this is less strict than the renamed IsValidCursorIndex) Use adjacent cursor positions in MoveCursor as needed. (prevents invalid cursors when collapsing selections) Skip painting empty glyph ranges on Windows. Add a unit test; minor cleanup and comment changes. BUG=327903,366786 TEST=Search for "จำลอง" in the omnibox; enter "จ" and get a valid selection of the inline autocomplete text. R=asvitkine@chromium.org Review URL: https://codereview.chromium.org/252563003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@267752 0039d316-1c4b-4281-b951-d872f2087c98
* RenderTextWin: Draw continuous diagonal strikes with multiple colorsckocagil@chromium.org2014-03-271-0/+2
| | | | | | | | | BUG=164047 R=msw@chromium.org Review URL: https://codereview.chromium.org/100273002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@259796 0039d316-1c4b-4281-b951-d872f2087c98
* Infinite Suggest - views implementation skanuj@chromium.org2014-02-241-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (See comment 36 on crbug.com/327833 for screenshots) RenderText: Allow layout_text_ to be empty if there is no room to render a single character. ---------------- OmniboxResultView: Revises the OmniboxResultView to rely on RenderText for eliding and rendering. The match contents and description can not be rendered together as one string. See crbug.com/331153 for a possible error case. The relevant TODO is removed. ----------------------------------------------------------- Infinite Suggestion: These suggestions show a leading ellipsis to suggest tail completion. Ideally they should appear at an offset equivalent to that of omitted text. This is accomplished by computing the required width as if the full text is present and the actual width required to show the suggestion with leading ellipsis. If the window is not wide enough to show the suggestion at the offset of the omitted text, the suggestions are shifted towards the start edge such that the longest infinite suggestion is visible. The suggestions are never shifted beyond the start edge. The suggestions are shown aligned to the start edge when directionality of suggestion differs from directionality of UI. When the directionality of suggestion differs from directionality of UI, we try to show the suggestions such that the leading ellipsis is still vertically aligned for all suggestions. BUG=327833, 336543, 328699 TBR=msw@chromium.org Review URL: https://codereview.chromium.org/171153004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@252873 0039d316-1c4b-4281-b951-d872f2087c98
* Only use subpixel-positioned text in UI when requested.derat@chromium.org2014-02-151-1/+2
| | | | | | | | | | | | | | Update SkiaTextRenderer to explicitly take a |subpixel_positioning| parameter. Previously, it requested subpixel positioning whenever antialiasing was enabled, which prevented users' strong-hinting settings from being honored. BUG=318395 Review URL: https://codereview.chromium.org/166673005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@251580 0039d316-1c4b-4281-b951-d872f2087c98
* Renames gfx::FontList::Derive* family.yukishiino@chromium.org2014-01-311-1/+1
| | | | | | | | | | | | | | | | | | | 1. Removes obsolete methods. - DeriveFontList(font_style) # The method name and argument are not clear compared to other versions. Use DeriveWithStyle(style) below instead. - DeriveFontListWithSize(absolute_size) # Don't specify the absolute size. 2. Renames very long named methods. - DeriveFontListWithSizeDeltaAndStyle => Derive - DeriveFontListWithSizeDelta => DeriveWithSizeDelta - new method => DeriveWithStyle Since DeriveFontListWithSizeDeltaAndStyle is used more often than DeriveFontListWithSizeDelta, so give the former a shorter name. Review URL: https://codereview.chromium.org/142523003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@248131 0039d316-1c4b-4281-b951-d872f2087c98
* Plumb the font hinting settings from render_text_pango.cc to SkPaint.erg@chromium.org2013-12-191-0/+17
| | | | | | | | | | | This also doesn't fix the font hinting settings, but is another link in plumbing from the user settings to the actual rendering. BUG=318395 Review URL: https://codereview.chromium.org/110583007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@241749 0039d316-1c4b-4281-b951-d872f2087c98
* ozone: Allow building for ozone without depending on pangosadrul@chromium.org2013-11-061-0/+514
Notable changes in this CL: * Rename files that depend on pango to have _pango suffix. * Add a filename gyp rule to exclude _pango* files when use_pango = 0 * Add empty implementations for a few font-related API for ozone. BUG=313793 R=jam@chromium.org, msw@chromium.org, rjkroege@chromium.org Review URL: https://codereview.chromium.org/26541007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@233228 0039d316-1c4b-4281-b951-d872f2087c98