OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) Research In Motion Limited 2010-2012. All rights reserved. | 2 * Copyright (C) Research In Motion Limited 2010-2012. 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 // Calculate width/height using the scaled font, divide this result by the s
calingFactor afterwards. | 51 // Calculate width/height using the scaled font, divide this result by the s
calingFactor afterwards. |
52 m_width = scaledFont.width(run) / scalingFactor; | 52 m_width = scaledFont.width(run) / scalingFactor; |
53 m_height = scaledFont.fontMetrics().floatHeight() / scalingFactor; | 53 m_height = scaledFont.fontMetrics().floatHeight() / scalingFactor; |
54 | 54 |
55 ASSERT(run.length() >= 0); | 55 ASSERT(run.length() >= 0); |
56 m_length = static_cast<unsigned>(run.length()); | 56 m_length = static_cast<unsigned>(run.length()); |
57 } | 57 } |
58 | 58 |
59 TextRun SVGTextMetrics::constructTextRun(LayoutSVGInlineText* text, unsigned pos
ition, unsigned length, TextDirection textDirection) | 59 TextRun SVGTextMetrics::constructTextRun(LayoutSVGInlineText* text, unsigned pos
ition, unsigned length, TextDirection textDirection) |
60 { | 60 { |
61 const LayoutStyle& style = text->styleRef(); | 61 const ComputedStyle& style = text->styleRef(); |
62 | 62 |
63 TextRun run(static_cast<const LChar*>(0) // characters, will be set below if
non-zero. | 63 TextRun run(static_cast<const LChar*>(0) // characters, will be set below if
non-zero. |
64 , 0 // length, will be set below if non-zero. | 64 , 0 // length, will be set below if non-zero. |
65 , 0 // xPos, only relevant with allowTabs=true | 65 , 0 // xPos, only relevant with allowTabs=true |
66 , 0 // padding, only relevant for justified text, not relevant for SVG | 66 , 0 // padding, only relevant for justified text, not relevant for SVG |
67 , TextRun::AllowTrailingExpansion | 67 , TextRun::AllowTrailingExpansion |
68 , textDirection | 68 , textDirection |
69 , isOverride(style.unicodeBidi()) /* directionalOverride */); | 69 , isOverride(style.unicodeBidi()) /* directionalOverride */); |
70 | 70 |
71 if (length) { | 71 if (length) { |
(...skipping 25 matching lines...) Expand all Loading... |
97 float scalingFactor = text->scalingFactor(); | 97 float scalingFactor = text->scalingFactor(); |
98 ASSERT(scalingFactor); | 98 ASSERT(scalingFactor); |
99 | 99 |
100 m_width = width / scalingFactor; | 100 m_width = width / scalingFactor; |
101 m_height = text->scaledFont().fontMetrics().floatHeight() / scalingFactor; | 101 m_height = text->scaledFont().fontMetrics().floatHeight() / scalingFactor; |
102 | 102 |
103 m_length = length; | 103 m_length = length; |
104 } | 104 } |
105 | 105 |
106 } | 106 } |
OLD | NEW |