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

Side by Side Diff: third_party/WebKit/WebCore/platform/graphics/FontDescription.h

Issue 56198: Roll out dominantScript, getGenericFontForScript patches to unfork a bunch of... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
3 * (C) 2000 Antti Koivisto (koivisto@kde.org) 3 * (C) 2000 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserv ed. 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserv ed.
6 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> 6 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com>
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 10 matching lines...) Expand all
21 * Boston, MA 02110-1301, USm_ 21 * Boston, MA 02110-1301, USm_
22 * 22 *
23 */ 23 */
24 24
25 #ifndef FontDescription_h 25 #ifndef FontDescription_h
26 #define FontDescription_h 26 #define FontDescription_h
27 27
28 #include "FontFamily.h" 28 #include "FontFamily.h"
29 #include "FontRenderingMode.h" 29 #include "FontRenderingMode.h"
30 #include "FontTraitsMask.h" 30 #include "FontTraitsMask.h"
31 #include <unicode/uscript.h>
32 31
33 namespace WebCore { 32 namespace WebCore {
34 33
35 enum FontWeight { 34 enum FontWeight {
36 FontWeight100, 35 FontWeight100,
37 FontWeight200, 36 FontWeight200,
38 FontWeight300, 37 FontWeight300,
39 FontWeight400, 38 FontWeight400,
40 FontWeight500, 39 FontWeight500,
41 FontWeight600, 40 FontWeight600,
(...skipping 13 matching lines...) Expand all
55 : m_specifiedSize(0) 54 : m_specifiedSize(0)
56 , m_computedSize(0) 55 , m_computedSize(0)
57 , m_italic(false) 56 , m_italic(false)
58 , m_smallCaps(false) 57 , m_smallCaps(false)
59 , m_isAbsoluteSize(false) 58 , m_isAbsoluteSize(false)
60 , m_weight(FontWeightNormal) 59 , m_weight(FontWeightNormal)
61 , m_genericFamily(NoFamily) 60 , m_genericFamily(NoFamily)
62 , m_usePrinterFont(false) 61 , m_usePrinterFont(false)
63 , m_renderingMode(NormalRenderingMode) 62 , m_renderingMode(NormalRenderingMode)
64 , m_keywordSize(0) 63 , m_keywordSize(0)
65 , m_dominantScript(USCRIPT_INVALID_CODE)
66 { 64 {
67 } 65 }
68 66
69 bool operator==(const FontDescription&) const; 67 bool operator==(const FontDescription&) const;
70 bool operator!=(const FontDescription& other) const { return !(*this == othe r); } 68 bool operator!=(const FontDescription& other) const { return !(*this == othe r); }
71 69
72 const FontFamily& family() const { return m_familyList; } 70 const FontFamily& family() const { return m_familyList; }
73 FontFamily& firstFamily() { return m_familyList; } 71 FontFamily& firstFamily() { return m_familyList; }
74 float specifiedSize() const { return m_specifiedSize; } 72 float specifiedSize() const { return m_specifiedSize; }
75 float computedSize() const { return m_computedSize; } 73 float computedSize() const { return m_computedSize; }
76 bool italic() const { return m_italic; } 74 bool italic() const { return m_italic; }
77 int computedPixelSize() const { return int(m_computedSize + 0.5f); } 75 int computedPixelSize() const { return int(m_computedSize + 0.5f); }
78 bool smallCaps() const { return m_smallCaps; } 76 bool smallCaps() const { return m_smallCaps; }
79 bool isAbsoluteSize() const { return m_isAbsoluteSize; } 77 bool isAbsoluteSize() const { return m_isAbsoluteSize; }
80 FontWeight weight() const { return static_cast<FontWeight>(m_weight); } 78 FontWeight weight() const { return static_cast<FontWeight>(m_weight); }
81 FontWeight lighterWeight() const; 79 FontWeight lighterWeight() const;
82 FontWeight bolderWeight() const; 80 FontWeight bolderWeight() const;
83 GenericFamilyType genericFamily() const { return static_cast<GenericFamilyTy pe>(m_genericFamily); } 81 GenericFamilyType genericFamily() const { return static_cast<GenericFamilyTy pe>(m_genericFamily); }
84 bool usePrinterFont() const { return m_usePrinterFont; } 82 bool usePrinterFont() const { return m_usePrinterFont; }
85 FontRenderingMode renderingMode() const { return static_cast<FontRenderingMo de>(m_renderingMode); } 83 FontRenderingMode renderingMode() const { return static_cast<FontRenderingMo de>(m_renderingMode); }
86 int keywordSize() const { return m_keywordSize; } 84 int keywordSize() const { return m_keywordSize; }
87 UScriptCode dominantScript() const { return m_dominantScript; }
88 85
89 FontTraitsMask traitsMask() const; 86 FontTraitsMask traitsMask() const;
90 87
91 void setFamily(const FontFamily& family) { m_familyList = family; } 88 void setFamily(const FontFamily& family) { m_familyList = family; }
92 void setComputedSize(float s) { m_computedSize = s; } 89 void setComputedSize(float s) { m_computedSize = s; }
93 void setSpecifiedSize(float s) { m_specifiedSize = s; } 90 void setSpecifiedSize(float s) { m_specifiedSize = s; }
94 void setItalic(bool i) { m_italic = i; } 91 void setItalic(bool i) { m_italic = i; }
95 void setSmallCaps(bool c) { m_smallCaps = c; } 92 void setSmallCaps(bool c) { m_smallCaps = c; }
96 void setIsAbsoluteSize(bool s) { m_isAbsoluteSize = s; } 93 void setIsAbsoluteSize(bool s) { m_isAbsoluteSize = s; }
97 void setWeight(FontWeight w) { m_weight = w; } 94 void setWeight(FontWeight w) { m_weight = w; }
98 void setGenericFamily(GenericFamilyType genericFamily) { m_genericFamily = g enericFamily; } 95 void setGenericFamily(GenericFamilyType genericFamily) { m_genericFamily = g enericFamily; }
99 void setUsePrinterFont(bool p) { m_usePrinterFont = p; } 96 void setUsePrinterFont(bool p) { m_usePrinterFont = p; }
100 void setRenderingMode(FontRenderingMode mode) { m_renderingMode = mode; } 97 void setRenderingMode(FontRenderingMode mode) { m_renderingMode = mode; }
101 void setKeywordSize(int s) { m_keywordSize = s; } 98 void setKeywordSize(int s) { m_keywordSize = s; }
102 void setDominantScript(UScriptCode s) { m_dominantScript = s; }
103 99
104 private: 100 private:
105 FontFamily m_familyList; // The list of font families to be used. 101 FontFamily m_familyList; // The list of font families to be used.
106 102
107 float m_specifiedSize; // Specified CSS value. Independent of rendering is sues such as integer 103 float m_specifiedSize; // Specified CSS value. Independent of rendering is sues such as integer
108 // rounding, minimum font sizes, and zooming. 104 // rounding, minimum font sizes, and zooming.
109 float m_computedSize; // Computed size adjusted for the minimum font size and the zoom factor. 105 float m_computedSize; // Computed size adjusted for the minimum font size and the zoom factor.
110 106
111 bool m_italic : 1; 107 bool m_italic : 1;
112 bool m_smallCaps : 1; 108 bool m_smallCaps : 1;
113 bool m_isAbsoluteSize : 1; // Whether or not CSS specified an explicit siz e 109 bool m_isAbsoluteSize : 1; // Whether or not CSS specified an explicit siz e
114 // (logical sizes like "medium" don't count). 110 // (logical sizes like "medium" don't count).
115 unsigned m_weight : 8; // FontWeight 111 unsigned m_weight : 8; // FontWeight
116 unsigned m_genericFamily : 3; // GenericFamilyType 112 unsigned m_genericFamily : 3; // GenericFamilyType
117 bool m_usePrinterFont : 1; 113 bool m_usePrinterFont : 1;
118 114
119 unsigned m_renderingMode : 1; // Used to switch between CG and GDI text on Windows. 115 unsigned m_renderingMode : 1; // Used to switch between CG and GDI text on Windows.
120 116
121 int m_keywordSize : 4; // We cache whether or not a font is currently repres ented by a CSS keyword (e.g., medium). If so, 117 int m_keywordSize : 4; // We cache whether or not a font is currently repres ented by a CSS keyword (e.g., medium). If so,
122 // then we can accurately translate across different generic families to adjust for different preference settings 118 // then we can accurately translate across different generic families to adjust for different preference settings
123 // (e.g., 13px monospace vs. 16px everything else). Sizes are 1-8 (like the HTML size values for <font>). 119 // (e.g., 13px monospace vs. 16px everything else). Sizes are 1-8 (like the HTML size values for <font>).
124 UScriptCode m_dominantScript; // See the comment in Document.h
125
126 }; 120 };
127 121
128 inline bool FontDescription::operator==(const FontDescription& other) const 122 inline bool FontDescription::operator==(const FontDescription& other) const
129 { 123 {
130 return m_familyList == other.m_familyList 124 return m_familyList == other.m_familyList
131 && m_specifiedSize == other.m_specifiedSize 125 && m_specifiedSize == other.m_specifiedSize
132 && m_computedSize == other.m_computedSize 126 && m_computedSize == other.m_computedSize
133 && m_italic == other.m_italic 127 && m_italic == other.m_italic
134 && m_smallCaps == other.m_smallCaps 128 && m_smallCaps == other.m_smallCaps
135 && m_isAbsoluteSize == other.m_isAbsoluteSize 129 && m_isAbsoluteSize == other.m_isAbsoluteSize
136 && m_weight == other.m_weight 130 && m_weight == other.m_weight
137 && m_genericFamily == other.m_genericFamily 131 && m_genericFamily == other.m_genericFamily
138 && m_usePrinterFont == other.m_usePrinterFont 132 && m_usePrinterFont == other.m_usePrinterFont
139 && m_renderingMode == other.m_renderingMode 133 && m_renderingMode == other.m_renderingMode
140 && m_keywordSize == other.m_keywordSize; 134 && m_keywordSize == other.m_keywordSize;
141 } 135 }
142 136
143 } 137 }
144 138
145 #endif 139 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698