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

Side by Side Diff: src/ports/SkFontHost_FreeType_common.h

Issue 12593013: remove SkFontHost::CreateScalerContext (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 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
« no previous file with comments | « src/ports/SkFontHost_FreeType.cpp ('k') | src/ports/SkFontHost_android.cpp » ('j') | 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 2006-2012 The Android Open Source Project 2 * Copyright 2006-2012 The Android Open Source Project
3 * Copyright 2012 Mozilla Foundation 3 * Copyright 2012 Mozilla Foundation
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #ifndef SKFONTHOST_FREETYPE_COMMON_H_ 9 #ifndef SKFONTHOST_FREETYPE_COMMON_H_
10 #define SKFONTHOST_FREETYPE_COMMON_H_ 10 #define SKFONTHOST_FREETYPE_COMMON_H_
11 11
12 #include "SkGlyph.h" 12 #include "SkGlyph.h"
13 #include "SkScalerContext.h" 13 #include "SkScalerContext.h"
14 #include "SkTypeface.h"
15
14 #include <ft2build.h> 16 #include <ft2build.h>
15 #include FT_FREETYPE_H 17 #include FT_FREETYPE_H
16 18
17 #ifdef SK_DEBUG 19 #ifdef SK_DEBUG
18 #define SkASSERT_CONTINUE(pred) \ 20 #define SkASSERT_CONTINUE(pred) \
19 do { \ 21 do { \
20 if (!(pred)) \ 22 if (!(pred)) \
21 SkDebugf("file %s:%d: assert failed '" #pred "'\n", __FILE__, __ LINE__); \ 23 SkDebugf("file %s:%d: assert failed '" #pred "'\n", __FILE__, __ LINE__); \
22 } while (false) 24 } while (false)
23 #else 25 #else
24 #define SkASSERT_CONTINUE(pred) 26 #define SkASSERT_CONTINUE(pred)
25 #endif 27 #endif
26 28
27 29
28 class SkScalerContext_FreeType_Base : public SkScalerContext { 30 class SkScalerContext_FreeType_Base : public SkScalerContext {
29 public: 31 protected:
30 // See http://freetype.sourceforge.net/freetype2/docs/reference/ft2-bitmap_h andling.html#FT_Bitmap_Embolden 32 // See http://freetype.sourceforge.net/freetype2/docs/reference/ft2-bitmap_h andling.html#FT_Bitmap_Embolden
31 // This value was chosen by eyeballing the result in Firefox and trying to m atch it. 33 // This value was chosen by eyeballing the result in Firefox and trying to m atch it.
32 static const FT_Pos kBitmapEmboldenStrength = 1 << 6; 34 static const FT_Pos kBitmapEmboldenStrength = 1 << 6;
33 35
34 SkScalerContext_FreeType_Base(const SkDescriptor *desc) 36 SkScalerContext_FreeType_Base(SkTypeface* typeface, const SkDescriptor *desc )
35 : SkScalerContext(desc) 37 : INHERITED(typeface, desc)
36 {} 38 {}
37 39
38 protected:
39 void generateGlyphImage(FT_Face face, const SkGlyph& glyph); 40 void generateGlyphImage(FT_Face face, const SkGlyph& glyph);
40 void generateGlyphPath(FT_Face face, SkPath* path); 41 void generateGlyphPath(FT_Face face, SkPath* path);
41 void emboldenOutline(FT_Face face, FT_Outline* outline); 42 void emboldenOutline(FT_Face face, FT_Outline* outline);
43
44 private:
45 typedef SkScalerContext INHERITED;
46 };
47
48 class SkTypeface_FreeType : public SkTypeface {
49 protected:
50 SkTypeface_FreeType(Style style, SkFontID uniqueID, bool isFixedWidth)
51 : INHERITED(style, uniqueID, isFixedWidth) {}
52
53 virtual SkScalerContext* onCreateScalerContext(
54 const SkDescriptor*) const SK_OVERRIDE;
55 virtual void onFilterRec(SkScalerContextRec*) const SK_OVERRIDE;
56
57 private:
58 typedef SkTypeface INHERITED;
42 }; 59 };
43 60
44 #endif // SKFONTHOST_FREETYPE_COMMON_H_ 61 #endif // SKFONTHOST_FREETYPE_COMMON_H_
OLDNEW
« no previous file with comments | « src/ports/SkFontHost_FreeType.cpp ('k') | src/ports/SkFontHost_android.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698