Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(130)

Issue 2222483002: Mac: Fix PlatformFontMac::DeriveFont. (Closed)

Created:
4 years, 4 months ago by karandeepb
Modified:
4 years, 4 months ago
Reviewers:
Avi (use Gerrit)
CC:
chromium-reviews, chrome-apps-syd-reviews_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@font_mac
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Mac: Fix PlatformFontMac::DeriveFont. 1. Currently, when we derive a font from an existing PlatformFontMac instance with only the size changed, we fail to persist the Font::UNDERLINE style in the derived font. 2. Also in all the other cases, instead of using the native_font_ instance to derive the font, we create a new PlatformFontMac instance from the font_name and other parameters. This can lead to unexpected results when the font from which we are deriving is a system font, since Apple explicitly forbids using a system font name to create a new font (See Potential API Pitfalls section in the WWDC talk Introducing the New System Fonts. Link - https://developer.apple.com/videos/play/wwdc2015/804/). For example, in the Text Styles example of views_examples_with_content_exe, on clicking underline, the derived font does not have underline due to 1 and is bold because of 2, even though we didn't specify the bold font trait. This CL modifies PlatformFontMac::DeriveFont to use the NSFontManager to create a new derived NSfont. Since the new PlatformFontMac instance created has the passed font style, 1 is solved. Also, since we no longer use the font name to create the derived font, 2 is also solved. Also, added two tests which fail on the current master and demonstrate the problem. BUG=605404 TEST=Build and run views_examples_with_content_exe. Select the "Text Styles" example. Check "Underline". Verify the text gets underlined. Verify the font is not bold. Play around with different combinations and verify that they work as expected. Committed: https://crrev.com/f7e5e8283b6a43f3371381fedd81beea941cef48 Cr-Commit-Position: refs/heads/master@{#410525}

Patch Set 1 : Add comment. #

Patch Set 2 : Tests. #

Patch Set 3 : Retain passed font names etc. #

Patch Set 4 #

Patch Set 5 : Comments. #

Total comments: 3

Patch Set 6 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+105 lines, -39 lines) Patch
M ui/gfx/font_unittest.cc View 1 2 3 1 chunk +13 lines, -0 lines 0 comments Download
M ui/gfx/platform_font_mac.h View 1 2 3 2 chunks +11 lines, -4 lines 0 comments Download
M ui/gfx/platform_font_mac.mm View 1 2 3 4 5 4 chunks +57 lines, -35 lines 0 comments Download
M ui/gfx/platform_font_mac_unittest.mm View 1 2 3 4 5 1 chunk +24 lines, -0 lines 0 comments Download

Messages

Total messages: 26 (21 generated)
karandeepb
PTAL avi@. Please disregard https://codereview.chromium.org/2189353002/. I have since found a better way to structure the ...
4 years, 4 months ago (2016-08-08 12:07:24 UTC) #17
Avi (use Gerrit)
lgtm https://codereview.chromium.org/2222483002/diff/120001/ui/gfx/platform_font_mac.mm File ui/gfx/platform_font_mac.mm (right): https://codereview.chromium.org/2222483002/diff/120001/ui/gfx/platform_font_mac.mm#newcode119 ui/gfx/platform_font_mac.mm:119: return Font(new PlatformFontMac(derived_font, font_name_, On 2016/08/08 12:07:24, karandeepb ...
4 years, 4 months ago (2016-08-08 15:50:58 UTC) #20
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2222483002/140001
4 years, 4 months ago (2016-08-09 01:03:08 UTC) #22
commit-bot: I haz the power
Committed patchset #6 (id:140001)
4 years, 4 months ago (2016-08-09 02:18:30 UTC) #24
commit-bot: I haz the power
4 years, 4 months ago (2016-08-09 02:20:35 UTC) #26
Message was sent while issue was closed.
Patchset 6 (id:??) landed as
https://crrev.com/f7e5e8283b6a43f3371381fedd81beea941cef48
Cr-Commit-Position: refs/heads/master@{#410525}

Powered by Google App Engine
This is Rietveld 408576698