| 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 | 77 |
| 78 // We handle letter & word spacing ourselves. | 78 // We handle letter & word spacing ourselves. |
| 79 run.disableSpacing(); | 79 run.disableSpacing(); |
| 80 | 80 |
| 81 // Propagate the maximum length of the characters buffer to the TextRun, eve
n when we're only processing a substring. | 81 // Propagate the maximum length of the characters buffer to the TextRun, eve
n when we're only processing a substring. |
| 82 run.setCharactersLength(textLayoutItem.textLength() - position); | 82 run.setCharactersLength(textLayoutItem.textLength() - position); |
| 83 ASSERT(run.charactersLength() >= run.length()); | 83 ASSERT(run.charactersLength() >= run.length()); |
| 84 return run; | 84 return run; |
| 85 } | 85 } |
| 86 | 86 |
| 87 SVGTextMetrics SVGTextMetrics::measureCharacterRange(LineLayoutSVGInlineText tex
tLayoutItem, unsigned position, unsigned length, TextDirection textDirection) | |
| 88 { | |
| 89 ASSERT(textLayoutItem); | |
| 90 return SVGTextMetrics(textLayoutItem, constructTextRun(textLayoutItem, posit
ion, length, textDirection)); | |
| 91 } | |
| 92 | |
| 93 SVGTextMetrics::SVGTextMetrics(LineLayoutSVGInlineText textLayoutItem, unsigned
length, float width) | 87 SVGTextMetrics::SVGTextMetrics(LineLayoutSVGInlineText textLayoutItem, unsigned
length, float width) |
| 94 { | 88 { |
| 95 ASSERT(textLayoutItem); | 89 ASSERT(textLayoutItem); |
| 96 | 90 |
| 97 float scalingFactor = textLayoutItem.scalingFactor(); | 91 float scalingFactor = textLayoutItem.scalingFactor(); |
| 98 ASSERT(scalingFactor); | 92 ASSERT(scalingFactor); |
| 99 | 93 |
| 100 m_width = width / scalingFactor; | 94 m_width = width / scalingFactor; |
| 101 m_height = textLayoutItem.scaledFont().fontMetrics().floatHeight() / scaling
Factor; | 95 m_height = textLayoutItem.scaledFont().fontMetrics().floatHeight() / scaling
Factor; |
| 102 | 96 |
| 103 m_length = length; | 97 m_length = length; |
| 104 } | 98 } |
| 105 | 99 |
| 106 float SVGTextMetrics::advance(FontOrientation orientation) const | 100 float SVGTextMetrics::advance(FontOrientation orientation) const |
| 107 { | 101 { |
| 108 switch (orientation) { | 102 switch (orientation) { |
| 109 case FontOrientation::Horizontal: | 103 case FontOrientation::Horizontal: |
| 110 case FontOrientation::VerticalRotated: | 104 case FontOrientation::VerticalRotated: |
| 111 return width(); | 105 return width(); |
| 112 case FontOrientation::VerticalUpright: | 106 case FontOrientation::VerticalUpright: |
| 113 return height(); | 107 return height(); |
| 114 default: | 108 default: |
| 115 ASSERT_NOT_REACHED(); | 109 ASSERT_NOT_REACHED(); |
| 116 return width(); | 110 return width(); |
| 117 } | 111 } |
| 118 } | 112 } |
| 119 | 113 |
| 120 } // namespace blink | 114 } // namespace blink |
| OLD | NEW |