OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz> | 2 * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz> |
3 * Copyright (C) 2006 Apple Computer Inc. | 3 * Copyright (C) 2006 Apple Computer Inc. |
4 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> | 4 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> |
5 * Copyright (C) 2008 Rob Buis <buis@kde.org> | 5 * Copyright (C) 2008 Rob Buis <buis@kde.org> |
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 { | 219 { |
220 computeNewScaledFontForStyle(this, m_scalingFactor, m_scaledFont); | 220 computeNewScaledFontForStyle(this, m_scalingFactor, m_scaledFont); |
221 } | 221 } |
222 | 222 |
223 void LayoutSVGInlineText::computeNewScaledFontForStyle(LayoutObject* layoutObjec
t, float& scalingFactor, Font& scaledFont) | 223 void LayoutSVGInlineText::computeNewScaledFontForStyle(LayoutObject* layoutObjec
t, float& scalingFactor, Font& scaledFont) |
224 { | 224 { |
225 const ComputedStyle* style = layoutObject->style(); | 225 const ComputedStyle* style = layoutObject->style(); |
226 ASSERT(style); | 226 ASSERT(style); |
227 ASSERT(layoutObject); | 227 ASSERT(layoutObject); |
228 | 228 |
229 // layoutTextOnLineOrPath() expects fonts to do nothing for vertical flow so | |
230 // that it can position each glyph precisely. Make sure the selected font is | |
231 // the one for horizontal flow to not to break the assumption. | |
232 // TODO(kojii): This might be done better by obsoleting the | |
233 // 'glyph-orientation-vertical' property as recommended in: | |
234 // https://drafts.csswg.org/css-writing-modes/#glyph-orientation | |
235 if (style->font().fontDescription().orientation() != FontOrientation::Horizo
ntal) { | |
236 FontDescription description = style->font().fontDescription(); | |
237 FontSelector* fontSelector = style->font().fontSelector(); | |
238 description.setOrientation(FontOrientation::Horizontal); | |
239 layoutObject->mutableStyleRef().setFontDescription(description); | |
240 style->font().update(fontSelector); | |
241 } | |
242 | |
243 // Alter font-size to the right on-screen value to avoid scaling the glyphs
themselves, except when GeometricPrecision is specified. | 229 // Alter font-size to the right on-screen value to avoid scaling the glyphs
themselves, except when GeometricPrecision is specified. |
244 scalingFactor = SVGLayoutSupport::calculateScreenFontSizeScalingFactor(layou
tObject); | 230 scalingFactor = SVGLayoutSupport::calculateScreenFontSizeScalingFactor(layou
tObject); |
245 if (style->effectiveZoom() == 1 && (scalingFactor == 1 || !scalingFactor)) { | 231 if (style->effectiveZoom() == 1 && (scalingFactor == 1 || !scalingFactor)) { |
246 scalingFactor = 1; | 232 scalingFactor = 1; |
247 scaledFont = style->font(); | 233 scaledFont = style->font(); |
248 return; | 234 return; |
249 } | 235 } |
250 | 236 |
251 if (style->fontDescription().textRendering() == GeometricPrecision) | 237 if (style->fontDescription().textRendering() == GeometricPrecision) |
252 scalingFactor = 1; | 238 scalingFactor = 1; |
(...skipping 18 matching lines...) Expand all Loading... |
271 | 257 |
272 PassRefPtr<StringImpl> LayoutSVGInlineText::originalText() const | 258 PassRefPtr<StringImpl> LayoutSVGInlineText::originalText() const |
273 { | 259 { |
274 RefPtr<StringImpl> result = LayoutText::originalText(); | 260 RefPtr<StringImpl> result = LayoutText::originalText(); |
275 if (!result) | 261 if (!result) |
276 return nullptr; | 262 return nullptr; |
277 return applySVGWhitespaceRules(result, style() && style()->whiteSpace() == P
RE); | 263 return applySVGWhitespaceRules(result, style() && style()->whiteSpace() == P
RE); |
278 } | 264 } |
279 | 265 |
280 } | 266 } |
OLD | NEW |