Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Side by Side Diff: Source/core/rendering/svg/SVGTextLayoutEngineSpacing.cpp

Issue 323053002: Unapply effectiveZoom during SVG layout (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add tests Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/rendering/svg/SVGTextLayoutEngineSpacing.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « Source/core/rendering/svg/SVGTextLayoutEngineSpacing.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698