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

Unified Diff: ui/views/style/typography_provider.h

Issue 2801583002: Use views::style for buttons, bootstrap ash_typography to do so. (Closed)
Patch Set: More self review Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/views/style/typography_provider.h
diff --git a/ui/views/style/typography_provider.h b/ui/views/style/typography_provider.h
index aab1c0e997d7a325fd33671e07f3756dcea28cfd..684f751f9c43ba5225a5153d7fc0c8da6e9f5bbf 100644
--- a/ui/views/style/typography_provider.h
+++ b/ui/views/style/typography_provider.h
@@ -31,6 +31,11 @@ class VIEWS_EXPORT TypographyProvider {
// Gets the line spacing, or 0 if it should be provided by gfx::FontList.
virtual int GetLineHeight(int context, int style) const = 0;
+ // A user's gfx::Weight::NORMAL font may already "bold enough" and requesting
+ // a MEDIUM font can result in a font that is less bold. So this method
+ // returns NORMAL, if the NORMAL font is at least as bold as |weight|.
Peter Kasting 2017/04/08 01:38:54 I'm confused. There are fonts where asking for a
tapted 2017/04/10 12:27:33 Yup. The windows font settings have a "Bold font"
Peter Kasting 2017/04/10 22:56:02 OK, so effectively, the "bold font" checkbox reall
tapted 2017/04/11 01:56:50 It's not quite that bad :). The logic for this is
Peter Kasting 2017/04/11 02:24:20 OK, so the default metrics say e.g. "use weight 60
tapted 2017/04/12 07:31:48 Yup
Peter Kasting 2017/04/13 03:53:17 Yeah, I agree this is too low-level -- the issue i
tapted 2017/05/05 03:08:49 I've implemented this in PatchSet 13. But -- witho
+ static gfx::Font::Weight WeightNotLighterThanNormal(gfx::Font::Weight weight);
+
protected:
TypographyProvider() = default;
@@ -52,10 +57,10 @@ class VIEWS_EXPORT DefaultTypographyProvider : public TypographyProvider {
// Sets the |size_delta| and |font_weight| that the the default GetFont()
// implementation uses. Always sets values, even for styles it doesn't know
// about.
- void GetDefaultFont(int context,
- int style,
- int* size_delta,
- gfx::Font::Weight* font_weight) const;
+ static void GetDefaultFont(int context,
+ int style,
+ int* size_delta,
+ gfx::Font::Weight* font_weight);
private:
DISALLOW_COPY_AND_ASSIGN(DefaultTypographyProvider);

Powered by Google App Engine
This is Rietveld 408576698