OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2006, 2007, 2008, Google Inc. All rights reserved. | 2 * Copyright (c) 2006, 2007, 2008, Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 useSkiaAntiAlias = useAntiAlias; | 72 useSkiaAntiAlias = useAntiAlias; |
73 } | 73 } |
74 | 74 |
75 void FontPlatformData::setSubpixelRendering(bool useSubpixelRendering) | 75 void FontPlatformData::setSubpixelRendering(bool useSubpixelRendering) |
76 { | 76 { |
77 useSkiaSubpixelRendering = useSubpixelRendering; | 77 useSkiaSubpixelRendering = useSubpixelRendering; |
78 } | 78 } |
79 | 79 |
80 FontPlatformData::FontPlatformData(WTF::HashTableDeletedValueType) | 80 FontPlatformData::FontPlatformData(WTF::HashTableDeletedValueType) |
81 : m_textSize(0) | 81 : m_textSize(0) |
82 , m_emSizeInFontUnits(0) | |
83 , m_syntheticBold(false) | 82 , m_syntheticBold(false) |
84 , m_syntheticItalic(false) | 83 , m_syntheticItalic(false) |
85 , m_orientation(Horizontal) | 84 , m_orientation(Horizontal) |
86 , m_isHashTableDeletedValue(true) | 85 , m_isHashTableDeletedValue(true) |
87 { | 86 { |
88 } | 87 } |
89 | 88 |
90 FontPlatformData::FontPlatformData() | 89 FontPlatformData::FontPlatformData() |
91 : m_textSize(0) | 90 : m_textSize(0) |
92 , m_emSizeInFontUnits(0) | |
93 , m_syntheticBold(false) | 91 , m_syntheticBold(false) |
94 , m_syntheticItalic(false) | 92 , m_syntheticItalic(false) |
95 , m_orientation(Horizontal) | 93 , m_orientation(Horizontal) |
96 , m_isHashTableDeletedValue(false) | 94 , m_isHashTableDeletedValue(false) |
97 { | 95 { |
98 } | 96 } |
99 | 97 |
100 FontPlatformData::FontPlatformData(float textSize, bool syntheticBold, bool synt
heticItalic) | 98 FontPlatformData::FontPlatformData(float textSize, bool syntheticBold, bool synt
heticItalic) |
101 : m_textSize(textSize) | 99 : m_textSize(textSize) |
102 , m_emSizeInFontUnits(0) | |
103 , m_syntheticBold(syntheticBold) | 100 , m_syntheticBold(syntheticBold) |
104 , m_syntheticItalic(syntheticItalic) | 101 , m_syntheticItalic(syntheticItalic) |
105 , m_orientation(Horizontal) | 102 , m_orientation(Horizontal) |
106 , m_isHashTableDeletedValue(false) | 103 , m_isHashTableDeletedValue(false) |
107 { | 104 { |
108 } | 105 } |
109 | 106 |
110 FontPlatformData::FontPlatformData(const FontPlatformData& src) | 107 FontPlatformData::FontPlatformData(const FontPlatformData& src) |
111 : m_typeface(src.m_typeface) | 108 : m_typeface(src.m_typeface) |
112 , m_family(src.m_family) | 109 , m_family(src.m_family) |
113 , m_textSize(src.m_textSize) | 110 , m_textSize(src.m_textSize) |
114 , m_emSizeInFontUnits(src.m_emSizeInFontUnits) | |
115 , m_syntheticBold(src.m_syntheticBold) | 111 , m_syntheticBold(src.m_syntheticBold) |
116 , m_syntheticItalic(src.m_syntheticItalic) | 112 , m_syntheticItalic(src.m_syntheticItalic) |
117 , m_orientation(src.m_orientation) | 113 , m_orientation(src.m_orientation) |
118 , m_style(src.m_style) | 114 , m_style(src.m_style) |
119 , m_harfBuzzFace(nullptr) | 115 , m_harfBuzzFace(nullptr) |
120 , m_isHashTableDeletedValue(false) | 116 , m_isHashTableDeletedValue(false) |
121 { | 117 { |
122 } | 118 } |
123 | 119 |
124 FontPlatformData::FontPlatformData(PassRefPtr<SkTypeface> tf, const char* family
, float textSize, bool syntheticBold, bool syntheticItalic, FontOrientation orie
ntation, bool subpixelTextPosition) | 120 FontPlatformData::FontPlatformData(PassRefPtr<SkTypeface> tf, const char* family
, float textSize, bool syntheticBold, bool syntheticItalic, FontOrientation orie
ntation, bool subpixelTextPosition) |
125 : m_typeface(tf) | 121 : m_typeface(tf) |
126 , m_family(family) | 122 , m_family(family) |
127 , m_textSize(textSize) | 123 , m_textSize(textSize) |
128 , m_emSizeInFontUnits(0) | |
129 , m_syntheticBold(syntheticBold) | 124 , m_syntheticBold(syntheticBold) |
130 , m_syntheticItalic(syntheticItalic) | 125 , m_syntheticItalic(syntheticItalic) |
131 , m_orientation(orientation) | 126 , m_orientation(orientation) |
132 , m_isHashTableDeletedValue(false) | 127 , m_isHashTableDeletedValue(false) |
133 { | 128 { |
134 querySystemForRenderStyle(subpixelTextPosition); | 129 querySystemForRenderStyle(subpixelTextPosition); |
135 } | 130 } |
136 | 131 |
137 FontPlatformData::FontPlatformData(const FontPlatformData& src, float textSize) | 132 FontPlatformData::FontPlatformData(const FontPlatformData& src, float textSize) |
138 : m_typeface(src.m_typeface) | 133 : m_typeface(src.m_typeface) |
139 , m_family(src.m_family) | 134 , m_family(src.m_family) |
140 , m_textSize(textSize) | 135 , m_textSize(textSize) |
141 , m_emSizeInFontUnits(src.m_emSizeInFontUnits) | |
142 , m_syntheticBold(src.m_syntheticBold) | 136 , m_syntheticBold(src.m_syntheticBold) |
143 , m_syntheticItalic(src.m_syntheticItalic) | 137 , m_syntheticItalic(src.m_syntheticItalic) |
144 , m_orientation(src.m_orientation) | 138 , m_orientation(src.m_orientation) |
145 , m_harfBuzzFace(nullptr) | 139 , m_harfBuzzFace(nullptr) |
146 , m_isHashTableDeletedValue(false) | 140 , m_isHashTableDeletedValue(false) |
147 { | 141 { |
148 querySystemForRenderStyle(FontDescription::subpixelPositioning()); | 142 querySystemForRenderStyle(FontDescription::subpixelPositioning()); |
149 } | 143 } |
150 | 144 |
151 FontPlatformData::~FontPlatformData() | 145 FontPlatformData::~FontPlatformData() |
152 { | 146 { |
153 } | 147 } |
154 | 148 |
155 int FontPlatformData::emSizeInFontUnits() const | |
156 { | |
157 if (m_emSizeInFontUnits) | |
158 return m_emSizeInFontUnits; | |
159 | |
160 m_emSizeInFontUnits = m_typeface->getUnitsPerEm(); | |
161 return m_emSizeInFontUnits; | |
162 } | |
163 | |
164 FontPlatformData& FontPlatformData::operator=(const FontPlatformData& src) | 149 FontPlatformData& FontPlatformData::operator=(const FontPlatformData& src) |
165 { | 150 { |
166 m_typeface = src.m_typeface; | 151 m_typeface = src.m_typeface; |
167 m_family = src.m_family; | 152 m_family = src.m_family; |
168 m_textSize = src.m_textSize; | 153 m_textSize = src.m_textSize; |
169 m_syntheticBold = src.m_syntheticBold; | 154 m_syntheticBold = src.m_syntheticBold; |
170 m_syntheticItalic = src.m_syntheticItalic; | 155 m_syntheticItalic = src.m_syntheticItalic; |
171 m_harfBuzzFace = nullptr; | 156 m_harfBuzzFace = nullptr; |
172 m_orientation = src.m_orientation; | 157 m_orientation = src.m_orientation; |
173 m_style = src.m_style; | 158 m_style = src.m_style; |
174 m_emSizeInFontUnits = src.m_emSizeInFontUnits; | |
175 | 159 |
176 return *this; | 160 return *this; |
177 } | 161 } |
178 | 162 |
179 #ifndef NDEBUG | 163 #ifndef NDEBUG |
180 String FontPlatformData::description() const | 164 String FontPlatformData::description() const |
181 { | 165 { |
182 return String(); | 166 return String(); |
183 } | 167 } |
184 #endif | 168 #endif |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 if (m_style.useSubpixelRendering == FontRenderStyle::NoPreference) | 279 if (m_style.useSubpixelRendering == FontRenderStyle::NoPreference) |
296 m_style.useSubpixelRendering = useSkiaSubpixelRendering; | 280 m_style.useSubpixelRendering = useSkiaSubpixelRendering; |
297 | 281 |
298 // TestRunner specifically toggles the subpixel positioning flag. | 282 // TestRunner specifically toggles the subpixel positioning flag. |
299 if (m_style.useSubpixelPositioning == FontRenderStyle::NoPreference | 283 if (m_style.useSubpixelPositioning == FontRenderStyle::NoPreference |
300 || isRunningLayoutTest()) | 284 || isRunningLayoutTest()) |
301 m_style.useSubpixelPositioning = useSkiaSubpixelPositioning; | 285 m_style.useSubpixelPositioning = useSkiaSubpixelPositioning; |
302 } | 286 } |
303 | 287 |
304 } // namespace WebCore | 288 } // namespace WebCore |
OLD | NEW |