New issue
Advanced search Search tips

Issue 658646 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Oct 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 3
Type: Bug


Sign in to add a comment

First available font for the default font settings (IDS_SANS_SERIF_FONT_FAMILY_* etc)

Project Member Reported by kojii@chromium.org, Oct 24 2016

Issue description

Currently we can specify only one font for a script/generic font family as the default font.

In order to support more modern fonts, esp. for CJK, we need a first-available-font since such fonts may not be available on older platforms or English version of the platform.

This has been discussed in requests to change the default font, such as  http://crbug.com/568030#c4 . This bug splits the work to support font list in IDS_* from changing the default.

Another use case is issue 506837, where we change default from Meiryo to Yu Gothic because Meiryo is not available on English version of Win10, but ideally, since Japanese version of Win10 has Meiryo, we would like to switch only if the font isn't available.
 

Comment 1 by kojii@chromium.org, Oct 24 2016

Blocking: 587072 648256 592199
Talked with falken@. Checking the first-available-font in pref_tab_helper isn't a good idea since it's called everytime a new tab is created, and the tab may not use all fonts.

We'd want to store the list in the preference, and resolve to the first available font only when it's used. There are two surfaces we need to resolve:

1. GenericFontFamilySettings in Blink.

2. chrome.fontSettings.getFont API implemented in FontSettingsGetFontFunction.
https://developer.chrome.com/extensions/fontSettings#method-getFont

Comment 2 by kojii@chromium.org, Oct 25 2016

Blocking: 579842
Project Member

Comment 3 by bugdroid1@chromium.org, Oct 29 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/6c0885e2699ef3aac4f3d8186d0520e6386094b9

commit 6c0885e2699ef3aac4f3d8186d0520e6386094b9
Author: kojii <kojii@chromium.org>
Date: Sat Oct 29 02:25:53 2016

Allow the default generic font family settings to find the first available font

This patch allows the default generic font family settings to have a
list of fonts that resolves to the first available font on the system.

Since only small part of the settings are lists, this patch introduces
a convention that the font name is a list only when it starts with ",".
This avoids scanning the name and checking the font availability when
it's not necessary.

MaybeGetLocalizedFontName is moved to FontSettingsUtilities to
eliminate the duplication in options and extensions.

The extension API chrome.fontSettings.getFont[1] is unchanged. It
resolves to the first available font on getting the value.

Resource changes in grd/xtb files will be in following patches (e.g.,
crrev.com/2454583002)

[1] https://developer.chrome.com/extensions/fontSettings#method-getFont

BUG= 658646 

Review-Url: https://codereview.chromium.org/2441343003
Cr-Commit-Position: refs/heads/master@{#428590}

[modify] https://crrev.com/6c0885e2699ef3aac4f3d8186d0520e6386094b9/chrome/browser/extensions/api/font_settings/font_settings_api.cc
[modify] https://crrev.com/6c0885e2699ef3aac4f3d8186d0520e6386094b9/chrome/browser/ui/BUILD.gn
[modify] https://crrev.com/6c0885e2699ef3aac4f3d8186d0520e6386094b9/chrome/browser/ui/webui/options/font_settings_handler.cc
[add] https://crrev.com/6c0885e2699ef3aac4f3d8186d0520e6386094b9/chrome/browser/ui/webui/options/font_settings_utils.cc
[modify] https://crrev.com/6c0885e2699ef3aac4f3d8186d0520e6386094b9/chrome/browser/ui/webui/options/font_settings_utils.h
[add] https://crrev.com/6c0885e2699ef3aac4f3d8186d0520e6386094b9/chrome/browser/ui/webui/options/font_settings_utils_unittest.cc
[modify] https://crrev.com/6c0885e2699ef3aac4f3d8186d0520e6386094b9/chrome/browser/ui/webui/options/font_settings_utils_win.cc
[modify] https://crrev.com/6c0885e2699ef3aac4f3d8186d0520e6386094b9/chrome/test/BUILD.gn
[modify] https://crrev.com/6c0885e2699ef3aac4f3d8186d0520e6386094b9/third_party/WebKit/Source/platform/BUILD.gn
[modify] https://crrev.com/6c0885e2699ef3aac4f3d8186d0520e6386094b9/third_party/WebKit/Source/platform/fonts/FontCache.cpp
[modify] https://crrev.com/6c0885e2699ef3aac4f3d8186d0520e6386094b9/third_party/WebKit/Source/platform/fonts/FontCache.h
[modify] https://crrev.com/6c0885e2699ef3aac4f3d8186d0520e6386094b9/third_party/WebKit/Source/platform/fonts/FontCacheTest.cpp
[modify] https://crrev.com/6c0885e2699ef3aac4f3d8186d0520e6386094b9/third_party/WebKit/Source/platform/fonts/GenericFontFamilySettings.cpp
[add] https://crrev.com/6c0885e2699ef3aac4f3d8186d0520e6386094b9/third_party/WebKit/Source/platform/fonts/GenericFontFamilySettingsTest.cpp
[modify] https://crrev.com/6c0885e2699ef3aac4f3d8186d0520e6386094b9/ui/gfx/font_list.cc
[modify] https://crrev.com/6c0885e2699ef3aac4f3d8186d0520e6386094b9/ui/gfx/font_list.h
[modify] https://crrev.com/6c0885e2699ef3aac4f3d8186d0520e6386094b9/ui/gfx/font_list_unittest.cc

Comment 4 by kojii@chromium.org, Oct 31 2016

Status: Fixed (was: Assigned)

Sign in to add a comment