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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 computeNewScaledFontForStyle(this, style(), m_scalingFactor, m_scaledFont); | 228 computeNewScaledFontForStyle(this, style(), m_scalingFactor, m_scaledFont); |
229 } | 229 } |
230 | 230 |
231 void RenderSVGInlineText::computeNewScaledFontForStyle(RenderObject* renderer, c
onst RenderStyle* style, float& scalingFactor, Font& scaledFont) | 231 void RenderSVGInlineText::computeNewScaledFontForStyle(RenderObject* renderer, c
onst RenderStyle* style, float& scalingFactor, Font& scaledFont) |
232 { | 232 { |
233 ASSERT(style); | 233 ASSERT(style); |
234 ASSERT(renderer); | 234 ASSERT(renderer); |
235 | 235 |
236 Document* document = renderer->document(); | 236 Document* document = renderer->document(); |
237 ASSERT(document); | 237 ASSERT(document); |
238 | 238 |
239 CSSStyleSelector* styleSelector = document->styleSelector(); | 239 CSSStyleSelector* styleSelector = document->styleSelector(); |
240 ASSERT(styleSelector); | 240 ASSERT(styleSelector); |
241 | 241 |
242 // Alter font-size to the right on-screen value, to avoid scaling the glyphs
themselves. | 242 // Alter font-size to the right on-screen value to avoid scaling the glyphs
themselves, except when GeometricPrecision is specified |
243 AffineTransform ctm; | 243 AffineTransform ctm; |
244 SVGImageBufferTools::calculateTransformationToOutermostSVGCoordinateSystem(r
enderer, ctm); | 244 SVGImageBufferTools::calculateTransformationToOutermostSVGCoordinateSystem(r
enderer, ctm); |
245 scalingFactor = narrowPrecisionToFloat(sqrt((pow(ctm.xScale(), 2) + pow(ctm.
yScale(), 2)) / 2)); | 245 scalingFactor = narrowPrecisionToFloat(sqrt((pow(ctm.xScale(), 2) + pow(ctm.
yScale(), 2)) / 2)); |
246 if (scalingFactor == 1 || !scalingFactor) { | 246 if (scalingFactor == 1 || !scalingFactor || style->fontDescription().textRen
deringMode() == GeometricPrecision) { |
247 scalingFactor = 1; | 247 scalingFactor = 1; |
248 scaledFont = style->font(); | 248 scaledFont = style->font(); |
249 return; | 249 return; |
250 } | 250 } |
251 | 251 |
252 FontDescription fontDescription(style->fontDescription()); | 252 FontDescription fontDescription(style->fontDescription()); |
253 fontDescription.setComputedSize(fontDescription.computedSize() * scalingFact
or); | 253 fontDescription.setComputedSize(fontDescription.computedSize() * scalingFact
or); |
254 | 254 |
255 scaledFont = Font(fontDescription, 0, 0); | 255 scaledFont = Font(fontDescription, 0, 0); |
256 scaledFont.update(styleSelector->fontSelector()); | 256 scaledFont.update(styleSelector->fontSelector()); |
257 } | 257 } |
258 | 258 |
259 } | 259 } |
260 | 260 |
261 #endif // ENABLE(SVG) | 261 #endif // ENABLE(SVG) |
OLD | NEW |