Commit b5385fa9 authored by Etienne Bergeron's avatar Etienne Bergeron Committed by Commit Bot

Fix default font used in VR text element

The VR code is using the default font "sans-serif".
The Font (and FontList) on that platform is the PlatformFontSkia
When creating the font with the literal "sans-serif", there is
not matched typeface.

The function creating the typeface has a fallback path that try
"sans" which is the resulting typeface used.

see: https://cs.chromium.org/chromium/src/ui/gfx/platform_font_skia.cc?l=53

This CL avoid to use that fallback logic. Instead, we rely on
the FontList behavior to use the default system font with the default
constructor.


R=alcooper@chromium.org

Change-Id: I612502f32d77787b8f0346c0fc23cd65b68e3013
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1847902Reviewed-by: default avatarKlaus Weidner <klausw@chromium.org>
Commit-Queue: Etienne Bergeron <etienneb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#704279}
parent b58c2b80
...@@ -24,7 +24,6 @@ namespace { ...@@ -24,7 +24,6 @@ namespace {
constexpr float kCursorWidthRatio = 0.07f; constexpr float kCursorWidthRatio = 0.07f;
constexpr int kTextPixelPerDmm = 1100; constexpr int kTextPixelPerDmm = 1100;
constexpr float kTextShadowScaleFactor = 1000.0f; constexpr float kTextShadowScaleFactor = 1000.0f;
constexpr char kDefaultFontFamily[] = "sans-serif";
int DmmToPixel(float dmm) { int DmmToPixel(float dmm) {
return static_cast<int>(dmm * kTextPixelPerDmm); return static_cast<int>(dmm * kTextPixelPerDmm);
...@@ -389,8 +388,9 @@ gfx::Size TextTexture::LayOutText() { ...@@ -389,8 +388,9 @@ gfx::Size TextTexture::LayOutText() {
text_bounds.set_width(DmmToPixel(text_width_)); text_bounds.set_width(DmmToPixel(text_width_));
} }
gfx::FontList fonts = gfx::FontList fonts;
gfx::FontList(gfx::Font(kDefaultFontFamily, pixel_font_height)); if (fonts.GetFontSize() != pixel_font_height)
fonts = fonts.DeriveWithSizeDelta(pixel_font_height - fonts.GetFontSize());
TextRenderParameters parameters; TextRenderParameters parameters;
parameters.color = color_; parameters.color = color_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment