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

Side by Side Diff: Source/platform/fonts/SimpleFontData.cpp

Issue 1060113003: Blink use old style character string notation for Unicode (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase patch Created 5 years, 7 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/layout/line/BreakingContextInlineHeaders.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) 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 22 matching lines...) Expand all
33 #include "SkPaint.h" 33 #include "SkPaint.h"
34 #include "SkPath.h" 34 #include "SkPath.h"
35 #include "SkTypeface.h" 35 #include "SkTypeface.h"
36 #include "SkTypes.h" 36 #include "SkTypes.h"
37 #include "SkUtils.h" 37 #include "SkUtils.h"
38 #include "platform/fonts/FontDescription.h" 38 #include "platform/fonts/FontDescription.h"
39 #include "platform/fonts/GlyphPage.h" 39 #include "platform/fonts/GlyphPage.h"
40 #include "platform/fonts/VDMXParser.h" 40 #include "platform/fonts/VDMXParser.h"
41 #include "platform/geometry/FloatRect.h" 41 #include "platform/geometry/FloatRect.h"
42 #include "wtf/MathExtras.h" 42 #include "wtf/MathExtras.h"
43 #include "wtf/unicode/CharacterNames.h"
43 #include "wtf/unicode/Unicode.h" 44 #include "wtf/unicode/Unicode.h"
44 #include <unicode/normlzr.h> 45 #include <unicode/normlzr.h>
45 46
46 namespace blink { 47 namespace blink {
47 48
48 const float smallCapsFontSizeMultiplier = 0.7f; 49 const float smallCapsFontSizeMultiplier = 0.7f;
49 const float emphasisMarkFontSizeMultiplier = 0.5f; 50 const float emphasisMarkFontSizeMultiplier = 0.5f;
50 51
51 #if OS(LINUX) || OS(ANDROID) 52 #if OS(LINUX) || OS(ANDROID)
52 // This is the largest VDMX table which we'll try to load and parse. 53 // This is the largest VDMX table which we'll try to load and parse.
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 if (!glyphPageZero) { 269 if (!glyphPageZero) {
269 m_spaceGlyph = 0; 270 m_spaceGlyph = 0;
270 m_spaceWidth = 0; 271 m_spaceWidth = 0;
271 m_zeroGlyph = 0; 272 m_zeroGlyph = 0;
272 m_zeroWidthSpaceGlyph = 0; 273 m_zeroWidthSpaceGlyph = 0;
273 m_missingGlyphData.fontData = this; 274 m_missingGlyphData.fontData = this;
274 m_missingGlyphData.glyph = 0; 275 m_missingGlyphData.glyph = 0;
275 return; 276 return;
276 } 277 }
277 278
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.
278 m_zeroWidthSpaceGlyph = glyphPageZero->glyphForCharacter(0); 281 m_zeroWidthSpaceGlyph = glyphPageZero->glyphForCharacter(0);
279 282
280 // 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.
281 // 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
282 // 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.
283 m_spaceGlyph = glyphPageZero->glyphForCharacter(' '); 286 m_spaceGlyph = glyphPageZero->glyphForCharacter(space);
284 float width = widthForGlyph(m_spaceGlyph); 287 float width = widthForGlyph(m_spaceGlyph);
285 m_spaceWidth = width; 288 m_spaceWidth = width;
286 m_zeroGlyph = glyphPageZero->glyphForCharacter('0'); 289 m_zeroGlyph = glyphPageZero->glyphForCharacter('0');
287 m_fontMetrics.setZeroWidth(widthForGlyph(m_zeroGlyph)); 290 m_fontMetrics.setZeroWidth(widthForGlyph(m_zeroGlyph));
288 291
289 // 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.
290 // 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.
291 // See <http://bugs.webkit.org/show_bug.cgi?id=13178> 294 // See <http://bugs.webkit.org/show_bug.cgi?id=13178>
292 // Ask for the glyph for 0 to avoid paging in ZERO WIDTH SPACE. Control char acters, including 0,
293 // are mapped to the ZERO WIDTH SPACE glyph.
294 if (m_zeroWidthSpaceGlyph == m_spaceGlyph) { 295 if (m_zeroWidthSpaceGlyph == m_spaceGlyph) {
295 m_zeroWidthSpaceGlyph = 0; 296 m_zeroWidthSpaceGlyph = 0;
296 WTF_LOG_ERROR("Font maps SPACE and ZERO WIDTH SPACE to the same glyph. G lyph width will not be overridden."); 297 WTF_LOG_ERROR("Font maps SPACE and ZERO WIDTH SPACE to the same glyph. G lyph width will not be overridden.");
297 } 298 }
298 299
299 m_missingGlyphData.fontData = this; 300 m_missingGlyphData.fontData = this;
300 m_missingGlyphData.glyph = 0; 301 m_missingGlyphData.glyph = 0;
301 } 302 }
302 303
303 SimpleFontData::~SimpleFontData() 304 SimpleFontData::~SimpleFontData()
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 if (glyphs[i]) { 508 if (glyphs[i]) {
508 pageToFill->setGlyphDataForIndex(offset + i, glyphs[i], this); 509 pageToFill->setGlyphDataForIndex(offset + i, glyphs[i], this);
509 haveGlyphs = true; 510 haveGlyphs = true;
510 } 511 }
511 } 512 }
512 513
513 return haveGlyphs; 514 return haveGlyphs;
514 } 515 }
515 516
516 } // namespace blink 517 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/line/BreakingContextInlineHeaders.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698