OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> |
3 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. | 3 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 return renderer->isText() ? renderer->parent() : renderer; | 63 return renderer->isText() ? renderer->parent() : renderer; |
64 } | 64 } |
65 | 65 |
66 static inline RenderObject* renderObjectFromRun(const TextRun& run) | 66 static inline RenderObject* renderObjectFromRun(const TextRun& run) |
67 { | 67 { |
68 if (TextRun::RenderingContext* renderingContext = run.renderingContext()) | 68 if (TextRun::RenderingContext* renderingContext = run.renderingContext()) |
69 return static_cast<SVGTextRunRenderingContext*>(renderingContext)->rende
rer(); | 69 return static_cast<SVGTextRunRenderingContext*>(renderingContext)->rende
rer(); |
70 return 0; | 70 return 0; |
71 } | 71 } |
72 | 72 |
73 float SVGTextRunRenderingContext::floatWidthUsingSVGFont(const Font& font, const
TextRun& run, unsigned& charsConsumed, Glyph& glyphId) const | 73 float SVGTextRunRenderingContext::floatWidthUsingSVGFont(const Font& font, const
TextRun& run, int& charsConsumed, Glyph& glyphId) const |
74 { | 74 { |
75 SimpleShaper it(&font, run); | 75 SimpleShaper it(&font, run); |
76 GlyphBuffer glyphBuffer; | 76 GlyphBuffer glyphBuffer; |
77 charsConsumed += it.advance(run.length(), &glyphBuffer); | 77 charsConsumed += it.advance(run.length(), &glyphBuffer); |
78 glyphId = !glyphBuffer.isEmpty() ? glyphBuffer.glyphAt(0) : 0; | 78 glyphId = !glyphBuffer.isEmpty() ? glyphBuffer.glyphAt(0) : 0; |
79 return it.runWidthSoFar(); | 79 return it.runWidthSoFar(); |
80 } | 80 } |
81 | 81 |
82 void SVGTextRunRenderingContext::drawSVGGlyphs(GraphicsContext* context, const T
extRun& run, const SimpleFontData* fontData, const GlyphBuffer& glyphBuffer, int
from, int numGlyphs, const FloatPoint& point) const | 82 void SVGTextRunRenderingContext::drawSVGGlyphs(GraphicsContext* context, const T
extRun& run, const SimpleFontData* fontData, const GlyphBuffer& glyphBuffer, int
from, int numGlyphs, const FloatPoint& point) const |
83 { | 83 { |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 // Restore original state of the SVG Font glyph table and the current font f
allback list, | 220 // Restore original state of the SVG Font glyph table and the current font f
allback list, |
221 // to assure the next lookup of the same glyph won't immediately return the
fallback glyph. | 221 // to assure the next lookup of the same glyph won't immediately return the
fallback glyph. |
222 page->setGlyphDataForCharacter(character, glyphData.glyph, originalFontData)
; | 222 page->setGlyphDataForCharacter(character, glyphData.glyph, originalFontData)
; |
223 ASSERT(fallbackGlyphData.fontData); | 223 ASSERT(fallbackGlyphData.fontData); |
224 return fallbackGlyphData; | 224 return fallbackGlyphData; |
225 } | 225 } |
226 | 226 |
227 } | 227 } |
228 | 228 |
229 #endif | 229 #endif |
OLD | NEW |