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

Ensures the minimum font size on Windows

PlatformFontWin is enforcing a minimal font size.
see: https://cs.chromium.org/chromium/src/ui/gfx/platform_font_win.cc?l=292

The PlatformFontSkiaOnWindows experiment is using the PlatformFontSkia
on Windows. But this implementation doesn't enfore the minimal font size.
This CL is adding the call to win::AdjustFontSize(...) which is responsible
to ensure the minimal size is respected.


This CL is fixing the unittest |FontTest.DeriveResizesIfSizeTooSmall| when
running with the PlatformFontSkiaOnWindows experiment.

  [ RUN      ] FontTest.DeriveResizesIfSizeTooSmall
  ../../ui/gfx/font_unittest.cc(152): error: Expected equality of these values:
    5
    derived_font.GetFontSize()
      Which is: 4


R=robliao@chromium.org, asvitkine@chromium.org

Bug: 944227
Change-Id: I99ad1ce651183cd488719b48791f9f056e6471e2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1710013Reviewed-by: default avatarDana Fried <dfried@chromium.org>
Reviewed-by: default avatarRobert Liao <robliao@chromium.org>
Reviewed-by: default avatarAlexei Svitkine <asvitkine@chromium.org>
Commit-Queue: Etienne Bergeron <etienneb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#681829}
parent 6118a351
......@@ -25,6 +25,10 @@
#include "ui/gfx/skia_font_delegate.h"
#include "ui/gfx/text_utils.h"
#if defined(OS_WIN)
#include "ui/gfx/system_fonts_win.h"
#endif
namespace gfx {
namespace {
......@@ -170,7 +174,12 @@ void PlatformFontSkia::SetDefaultFontDescription(
Font PlatformFontSkia::DeriveFont(int size_delta,
int style,
Font::Weight weight) const {
#if defined(OS_WIN)
const int new_size = win::AdjustFontSize(font_size_pixels_, size_delta);
#else
const int new_size = font_size_pixels_ + size_delta;
#endif
DCHECK_GT(new_size, 0);
// If the style changed, we may need to load a new face.
......
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