| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 2 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
| 3 * | 3 * |
| 4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
| 5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
| 6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
| 7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
| 8 * | 8 * |
| 9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 #include "platform/fonts/Font.h" | 26 #include "platform/fonts/Font.h" |
| 27 | 27 |
| 28 #if ENABLE(SVG_FONTS) | 28 #if ENABLE(SVG_FONTS) |
| 29 #include "core/svg/SVGFontData.h" | 29 #include "core/svg/SVGFontData.h" |
| 30 #include "core/svg/SVGFontElement.h" | 30 #include "core/svg/SVGFontElement.h" |
| 31 #include "core/svg/SVGFontFaceElement.h" | 31 #include "core/svg/SVGFontFaceElement.h" |
| 32 #endif | 32 #endif |
| 33 | 33 |
| 34 namespace WebCore { | 34 namespace WebCore { |
| 35 | 35 |
| 36 SVGTextLayoutEngineSpacing::SVGTextLayoutEngineSpacing(const Font& font) | 36 SVGTextLayoutEngineSpacing::SVGTextLayoutEngineSpacing(const Font& font, float e
ffectiveZoom) |
| 37 : m_font(font) | 37 : m_font(font) |
| 38 , m_lastCharacter(0) | 38 , m_lastCharacter(0) |
| 39 , m_effectiveZoom(effectiveZoom) |
| 39 #if ENABLE(SVG_FONTS) | 40 #if ENABLE(SVG_FONTS) |
| 40 , m_lastGlyph(0) | 41 , m_lastGlyph(0) |
| 41 #endif | 42 #endif |
| 42 { | 43 { |
| 44 ASSERT(m_effectiveZoom); |
| 43 } | 45 } |
| 44 | 46 |
| 45 float SVGTextLayoutEngineSpacing::calculateSVGKerning(bool isVerticalText, Glyph
currentGlyph) | 47 float SVGTextLayoutEngineSpacing::calculateSVGKerning(bool isVerticalText, Glyph
currentGlyph) |
| 46 { | 48 { |
| 47 #if ENABLE(SVG_FONTS) | 49 #if ENABLE(SVG_FONTS) |
| 48 const SimpleFontData* fontData = m_font.primaryFont(); | 50 const SimpleFontData* fontData = m_font.primaryFont(); |
| 49 if (!fontData->isSVGFont()) { | 51 if (!fontData->isSVGFont()) { |
| 50 m_lastGlyph = 0; | 52 m_lastGlyph = 0; |
| 51 return 0; | 53 return 0; |
| 52 } | 54 } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 | 91 |
| 90 if (!m_font.fontDescription().letterSpacing() && !m_font.fontDescription().w
ordSpacing()) | 92 if (!m_font.fontDescription().letterSpacing() && !m_font.fontDescription().w
ordSpacing()) |
| 91 return 0; | 93 return 0; |
| 92 | 94 |
| 93 float spacing = m_font.fontDescription().letterSpacing(); | 95 float spacing = m_font.fontDescription().letterSpacing(); |
| 94 if (currentCharacter && lastCharacter && m_font.fontDescription().wordSpacin
g()) { | 96 if (currentCharacter && lastCharacter && m_font.fontDescription().wordSpacin
g()) { |
| 95 if (Character::treatAsSpace(currentCharacter) && !Character::treatAsSpac
e(lastCharacter)) | 97 if (Character::treatAsSpace(currentCharacter) && !Character::treatAsSpac
e(lastCharacter)) |
| 96 spacing += m_font.fontDescription().wordSpacing(); | 98 spacing += m_font.fontDescription().wordSpacing(); |
| 97 } | 99 } |
| 98 | 100 |
| 101 if (m_effectiveZoom != 1) |
| 102 spacing = spacing / m_effectiveZoom; |
| 103 |
| 99 return spacing; | 104 return spacing; |
| 100 } | 105 } |
| 101 | 106 |
| 102 } | 107 } |
| OLD | NEW |