OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2005, 2008, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2005, 2008, 2010 Apple Inc. All rights reserved. |
3 * Copyright (C) 2006 Alexey Proskuryakov | 3 * Copyright (C) 2006 Alexey Proskuryakov |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 return; | 276 return; |
277 } | 277 } |
278 | 278 |
279 // Ask for the glyph for 0 to avoid paging in ZERO WIDTH SPACE. Control char
acters, including 0, | 279 // Ask for the glyph for 0 to avoid paging in ZERO WIDTH SPACE. Control char
acters, including 0, |
280 // are mapped to the ZERO WIDTH SPACE glyph. | 280 // are mapped to the ZERO WIDTH SPACE glyph. |
281 m_zeroWidthSpaceGlyph = glyphPageZero->glyphForCharacter(0); | 281 m_zeroWidthSpaceGlyph = glyphPageZero->glyphForCharacter(0); |
282 | 282 |
283 // Nasty hack to determine if we should round or ceil space widths. | 283 // Nasty hack to determine if we should round or ceil space widths. |
284 // If the font is monospace or fake monospace we ceil to ensure that | 284 // If the font is monospace or fake monospace we ceil to ensure that |
285 // every character and the space are the same width. Otherwise we round. | 285 // every character and the space are the same width. Otherwise we round. |
286 m_spaceGlyph = glyphPageZero->glyphForCharacter(space); | 286 m_spaceGlyph = glyphPageZero->glyphForCharacter(spaceCharacter); |
287 float width = widthForGlyph(m_spaceGlyph); | 287 float width = widthForGlyph(m_spaceGlyph); |
288 m_spaceWidth = width; | 288 m_spaceWidth = width; |
289 m_zeroGlyph = glyphPageZero->glyphForCharacter('0'); | 289 m_zeroGlyph = glyphPageZero->glyphForCharacter('0'); |
290 m_fontMetrics.setZeroWidth(widthForGlyph(m_zeroGlyph)); | 290 m_fontMetrics.setZeroWidth(widthForGlyph(m_zeroGlyph)); |
291 | 291 |
292 // Force the glyph for ZERO WIDTH SPACE to have zero width, unless it is sha
red with SPACE. | 292 // Force the glyph for ZERO WIDTH SPACE to have zero width, unless it is sha
red with SPACE. |
293 // Helvetica is an example of a non-zero width ZERO WIDTH SPACE glyph. | 293 // Helvetica is an example of a non-zero width ZERO WIDTH SPACE glyph. |
294 // See <http://bugs.webkit.org/show_bug.cgi?id=13178> | 294 // See <http://bugs.webkit.org/show_bug.cgi?id=13178> |
295 if (m_zeroWidthSpaceGlyph == m_spaceGlyph) { | 295 if (m_zeroWidthSpaceGlyph == m_spaceGlyph) { |
296 m_zeroWidthSpaceGlyph = 0; | 296 m_zeroWidthSpaceGlyph = 0; |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 if (glyphs[i]) { | 508 if (glyphs[i]) { |
509 pageToFill->setGlyphDataForIndex(offset + i, glyphs[i], this); | 509 pageToFill->setGlyphDataForIndex(offset + i, glyphs[i], this); |
510 haveGlyphs = true; | 510 haveGlyphs = true; |
511 } | 511 } |
512 } | 512 } |
513 | 513 |
514 return haveGlyphs; | 514 return haveGlyphs; |
515 } | 515 } |
516 | 516 |
517 } // namespace blink | 517 } // namespace blink |
OLD | NEW |