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

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

Issue 1020833002: Remove duplicate Enum Font Pitch (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebasing patch Created 5 years, 9 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/platform/fonts/SimpleFontData.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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 50
51 #if OS(LINUX) || OS(ANDROID) 51 #if OS(LINUX) || OS(ANDROID)
52 // This is the largest VDMX table which we'll try to load and parse. 52 // This is the largest VDMX table which we'll try to load and parse.
53 static const size_t maxVDMXTableSize = 1024 * 1024; // 1 MB 53 static const size_t maxVDMXTableSize = 1024 * 1024; // 1 MB
54 #endif 54 #endif
55 55
56 SimpleFontData::SimpleFontData(const FontPlatformData& platformData, PassRefPtr< CustomFontData> customData, bool isTextOrientationFallback) 56 SimpleFontData::SimpleFontData(const FontPlatformData& platformData, PassRefPtr< CustomFontData> customData, bool isTextOrientationFallback)
57 : m_maxCharWidth(-1) 57 : m_maxCharWidth(-1)
58 , m_avgCharWidth(-1) 58 , m_avgCharWidth(-1)
59 , m_platformData(platformData) 59 , m_platformData(platformData)
60 , m_treatAsFixedPitch(false) 60 , m_pitch(UnknownPitchFont)
61 , m_isTextOrientationFallback(isTextOrientationFallback) 61 , m_isTextOrientationFallback(isTextOrientationFallback)
62 , m_isBrokenIdeographFallback(false) 62 , m_isBrokenIdeographFallback(false)
63 , m_verticalData(nullptr) 63 , m_verticalData(nullptr)
64 , m_hasVerticalGlyphs(false) 64 , m_hasVerticalGlyphs(false)
65 , m_customFontData(customData) 65 , m_customFontData(customData)
66 { 66 {
67 platformInit(); 67 platformInit();
68 platformGlyphInit(); 68 platformGlyphInit();
69 if (platformData.orientation() == Vertical && !isTextOrientationFallback) { 69 if (platformData.orientation() == Vertical && !isTextOrientationFallback) {
70 m_verticalData = platformData.verticalData(); 70 m_verticalData = platformData.verticalData();
71 m_hasVerticalGlyphs = m_verticalData.get() && m_verticalData->hasVertica lMetrics(); 71 m_hasVerticalGlyphs = m_verticalData.get() && m_verticalData->hasVertica lMetrics();
72 } 72 }
73 } 73 }
74 74
75 SimpleFontData::SimpleFontData(PassRefPtr<CustomFontData> customData, float font Size, bool syntheticBold, bool syntheticItalic) 75 SimpleFontData::SimpleFontData(PassRefPtr<CustomFontData> customData, float font Size, bool syntheticBold, bool syntheticItalic)
76 : m_platformData(FontPlatformData(fontSize, syntheticBold, syntheticItalic)) 76 : m_platformData(FontPlatformData(fontSize, syntheticBold, syntheticItalic))
77 , m_treatAsFixedPitch(false) 77 , m_pitch(UnknownPitchFont)
78 , m_isTextOrientationFallback(false) 78 , m_isTextOrientationFallback(false)
79 , m_isBrokenIdeographFallback(false) 79 , m_isBrokenIdeographFallback(false)
80 , m_verticalData(nullptr) 80 , m_verticalData(nullptr)
81 , m_hasVerticalGlyphs(false) 81 , m_hasVerticalGlyphs(false)
82 , m_customFontData(customData) 82 , m_customFontData(customData)
83 { 83 {
84 if (m_customFontData) 84 if (m_customFontData)
85 m_customFontData->initializeFontData(this, fontSize); 85 m_customFontData->initializeFontData(this, fontSize);
86 } 86 }
87 87
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 } 392 }
393 393
394 PassRefPtr<SimpleFontData> SimpleFontData::platformCreateScaledFontData(const Fo ntDescription& fontDescription, float scaleFactor) const 394 PassRefPtr<SimpleFontData> SimpleFontData::platformCreateScaledFontData(const Fo ntDescription& fontDescription, float scaleFactor) const
395 { 395 {
396 const float scaledSize = lroundf(fontDescription.computedSize() * scaleFacto r); 396 const float scaledSize = lroundf(fontDescription.computedSize() * scaleFacto r);
397 return SimpleFontData::create(FontPlatformData(m_platformData, scaledSize), isCustomFont() ? CustomFontData::create() : nullptr); 397 return SimpleFontData::create(FontPlatformData(m_platformData, scaledSize), isCustomFont() ? CustomFontData::create() : nullptr);
398 } 398 }
399 399
400 void SimpleFontData::determinePitch() 400 void SimpleFontData::determinePitch()
401 { 401 {
402 m_treatAsFixedPitch = platformData().isFixedPitch(); 402 m_pitch = platformData().isFixedPitch() ? FixedPitchFont : VariablePitchFont ;
403 } 403 }
404 404
405 static inline void getSkiaBoundsForGlyph(SkPaint& paint, Glyph glyph, SkRect& bo unds) 405 static inline void getSkiaBoundsForGlyph(SkPaint& paint, Glyph glyph, SkRect& bo unds)
406 { 406 {
407 paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding); 407 paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
408 408
409 SkPath path; 409 SkPath path;
410 paint.getTextPath(&glyph, sizeof(glyph), 0, 0, &path); 410 paint.getTextPath(&glyph, sizeof(glyph), 0, 0, &path);
411 bounds = path.getBounds(); 411 bounds = path.getBounds();
412 412
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 if (glyphs[i]) { 498 if (glyphs[i]) {
499 pageToFill->setGlyphDataForIndex(offset + i, glyphs[i], this); 499 pageToFill->setGlyphDataForIndex(offset + i, glyphs[i], this);
500 haveGlyphs = true; 500 haveGlyphs = true;
501 } 501 }
502 } 502 }
503 503
504 return haveGlyphs; 504 return haveGlyphs;
505 } 505 }
506 506
507 } // namespace blink 507 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/fonts/SimpleFontData.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698