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

Side by Side Diff: Source/platform/fonts/harfbuzz/FontPlatformDataHarfBuzz.h

Issue 205343010: Use FontPlatformDataHarfBuzz.h on Windows (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2006, 2007, 2008, Google Inc. All rights reserved. 2 * Copyright (c) 2006, 2007, 2008, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 #include "wtf/text/StringImpl.h" 44 #include "wtf/text/StringImpl.h"
45 45
46 class SkTypeface; 46 class SkTypeface;
47 typedef uint32_t SkFontID; 47 typedef uint32_t SkFontID;
48 48
49 namespace WebCore { 49 namespace WebCore {
50 50
51 class GraphicsContext; 51 class GraphicsContext;
52 class HarfBuzzFace; 52 class HarfBuzzFace;
53 53
54 // -----------------------------------------------------------------------------
55 // FontPlatformData is the handle which WebKit has on a specific face. A face
56 // is the tuple of (font, size, ...etc). Here we are just wrapping a Skia
57 // SkTypeface pointer and dealing with the reference counting etc.
58 // -----------------------------------------------------------------------------
59 class PLATFORM_EXPORT FontPlatformData { 54 class PLATFORM_EXPORT FontPlatformData {
60 public: 55 public:
61 // Used for deleted values in the font cache's hash tables. The hash table 56 // Used for deleted values in the font cache's hash tables. The hash table
62 // will create us with this structure, and it will compare other values 57 // will create us with this structure, and it will compare other values
63 // to this "Deleted" one. It expects the Deleted one to be differentiable 58 // to this "Deleted" one. It expects the Deleted one to be differentiable
64 // from the 0 one (created with the empty constructor), so we can't just 59 // from the 0 one (created with the empty constructor), so we can't just
65 // set everything to 0. 60 // set everything to 0.
66 FontPlatformData(WTF::HashTableDeletedValueType); 61 FontPlatformData(WTF::HashTableDeletedValueType);
67 FontPlatformData(); 62 FontPlatformData();
68 FontPlatformData(float textSize, bool syntheticBold, bool syntheticItalic); 63 FontPlatformData(float textSize, bool syntheticBold, bool syntheticItalic);
69 FontPlatformData(const FontPlatformData&); 64 FontPlatformData(const FontPlatformData&);
70 FontPlatformData(PassRefPtr<SkTypeface>, const char* name, float textSize, b ool syntheticBold, bool syntheticItalic, FontOrientation = Horizontal, bool subp ixelTextPosition = FontDescription::subpixelPositioning()); 65 FontPlatformData(PassRefPtr<SkTypeface>, const char* name, float textSize, b ool syntheticBold, bool syntheticItalic, FontOrientation = Horizontal, bool subp ixelTextPosition = defaultUseSubpixelPositioning());
71 FontPlatformData(const FontPlatformData& src, float textSize); 66 FontPlatformData(const FontPlatformData& src, float textSize);
72 ~FontPlatformData(); 67 ~FontPlatformData();
73 68
74 String fontFamilyName() const; 69 String fontFamilyName() const;
75 70 float size() const { return m_textSize; }
76 // -------------------------------------------------------------------------
77 // Return true iff this font is monospaced (i.e. every glyph has an equal x
78 // advance)
79 // -------------------------------------------------------------------------
80 bool isFixedPitch() const; 71 bool isFixedPitch() const;
81 72
82 // ------------------------------------------------------------------------- 73 SkTypeface* typeface() const { return m_typeface.get(); }
83 // Setup a Skia painting context to use this font. 74 HarfBuzzFace* harfBuzzFace() const;
84 // -------------------------------------------------------------------------
85 void setupPaint(SkPaint*, GraphicsContext* = 0) const;
86
87 // -------------------------------------------------------------------------
88 // Return Skia's unique id for this font. This encodes both the style and
89 // the font's file name so refers to a single face.
90 // -------------------------------------------------------------------------
91 SkFontID uniqueID() const; 75 SkFontID uniqueID() const;
92 SkTypeface* typeface() const { return m_typeface.get(); }
93
94 unsigned hash() const; 76 unsigned hash() const;
95 float size() const { return m_textSize; }
96 77
97 FontOrientation orientation() const { return m_orientation; } 78 FontOrientation orientation() const { return m_orientation; }
98 void setOrientation(FontOrientation orientation) { m_orientation = orientati on; } 79 void setOrientation(FontOrientation orientation) { m_orientation = orientati on; }
99 void setSyntheticBold(bool syntheticBold) { m_syntheticBold = syntheticBold; } 80 void setSyntheticBold(bool syntheticBold) { m_syntheticBold = syntheticBold; }
100 void setSyntheticItalic(bool syntheticItalic) { m_syntheticItalic = syntheti cItalic; } 81 void setSyntheticItalic(bool syntheticItalic) { m_syntheticItalic = syntheti cItalic; }
101 bool operator==(const FontPlatformData&) const; 82 bool operator==(const FontPlatformData&) const;
102 FontPlatformData& operator=(const FontPlatformData&); 83 FontPlatformData& operator=(const FontPlatformData&);
103 bool isHashTableDeletedValue() const { return m_isHashTableDeletedValue; } 84 bool isHashTableDeletedValue() const { return m_isHashTableDeletedValue; }
104 85
105 #if ENABLE(OPENTYPE_VERTICAL) 86 #if ENABLE(OPENTYPE_VERTICAL)
106 PassRefPtr<OpenTypeVerticalData> verticalData() const; 87 PassRefPtr<OpenTypeVerticalData> verticalData() const;
107 PassRefPtr<SharedBuffer> openTypeTable(uint32_t table) const; 88 PassRefPtr<SharedBuffer> openTypeTable(uint32_t table) const;
108 #endif 89 #endif
109 90
110 #ifndef NDEBUG 91 #ifndef NDEBUG
111 String description() const; 92 String description() const;
112 #endif 93 #endif
113 94
114 HarfBuzzFace* harfBuzzFace() const;
115
116 // The returned styles are all actual styles without FontRenderStyle::NoPref erence. 95 // The returned styles are all actual styles without FontRenderStyle::NoPref erence.
117 const FontRenderStyle& fontRenderStyle() const { return m_style; } 96 const FontRenderStyle& fontRenderStyle() const { return m_style; }
97 void setupPaint(SkPaint*, GraphicsContext* = 0) const;
118 98
119 // ------------------------------------------------------------------------- 99 #if OS(WIN)
120 // Global font preferences... 100 int paintTextFlags() const { return m_paintTextFlags; }
121 101 #else
122 static void setHinting(SkPaint::Hinting); 102 static void setHinting(SkPaint::Hinting);
123 static void setAutoHint(bool); 103 static void setAutoHint(bool);
124 static void setUseBitmaps(bool); 104 static void setUseBitmaps(bool);
125 static void setAntiAlias(bool); 105 static void setAntiAlias(bool);
126 static void setSubpixelRendering(bool); 106 static void setSubpixelRendering(bool);
107 #endif
127 108
128 private: 109 private:
110 bool static defaultUseSubpixelPositioning();
111 #if !OS(WIN)
129 void getRenderStyleForStrike(const char*, int); 112 void getRenderStyleForStrike(const char*, int);
130 void querySystemForRenderStyle(bool useSkiaSubpixelPositioning); 113 void querySystemForRenderStyle(bool useSkiaSubpixelPositioning);
114 #endif
131 115
132 RefPtr<SkTypeface> m_typeface; 116 RefPtr<SkTypeface> m_typeface;
117 #if !OS(WIN)
133 CString m_family; 118 CString m_family;
119 #endif
134 float m_textSize; 120 float m_textSize;
135 bool m_syntheticBold; 121 bool m_syntheticBold;
136 bool m_syntheticItalic; 122 bool m_syntheticItalic;
137 FontOrientation m_orientation; 123 FontOrientation m_orientation;
138 FontRenderStyle m_style; 124 FontRenderStyle m_style;
139 mutable RefPtr<HarfBuzzFace> m_harfBuzzFace; 125 mutable RefPtr<HarfBuzzFace> m_harfBuzzFace;
140 bool m_isHashTableDeletedValue; 126 bool m_isHashTableDeletedValue;
127 #if OS(WIN)
128 int m_paintTextFlags;
129 bool m_useSubpixelPositioning;
130 #endif
141 }; 131 };
142 132
143 } // namespace WebCore 133 } // namespace WebCore
144 134
145 #endif // ifdef FontPlatformDataHarfBuzz_h 135 #endif // ifdef FontPlatformDataHarfBuzz_h
OLDNEW
« no previous file with comments | « Source/platform/fonts/FontPlatformData.h ('k') | Source/platform/fonts/harfbuzz/FontPlatformDataHarfBuzz.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698