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

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

Issue 1590223003: Expose API for gx font variation axes. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix FontConfig and Android. Created 4 years, 11 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 | « src/ports/SkFontHost_FreeType.cpp ('k') | src/ports/SkFontHost_mac.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 "SkMutex.h" 13 #include "SkMutex.h"
14 #include "SkScalerContext.h" 14 #include "SkScalerContext.h"
15 #include "SkTypeface.h" 15 #include "SkTypeface.h"
16 #include "SkTypes.h" 16 #include "SkTypes.h"
17 17
18 #include "SkFontMgr.h"
19
18 #include <ft2build.h> 20 #include <ft2build.h>
19 #include FT_FREETYPE_H 21 #include FT_FREETYPE_H
20 22
21 class SkScalerContext_FreeType_Base : public SkScalerContext { 23 class SkScalerContext_FreeType_Base : public SkScalerContext {
22 protected: 24 protected:
23 // See http://freetype.sourceforge.net/freetype2/docs/reference/ft2-bitmap_h andling.html#FT_Bitmap_Embolden 25 // See http://freetype.sourceforge.net/freetype2/docs/reference/ft2-bitmap_h andling.html#FT_Bitmap_Embolden
24 // This value was chosen by eyeballing the result in Firefox and trying to m atch it. 26 // This value was chosen by eyeballing the result in Firefox and trying to m atch it.
25 static const FT_Pos kBitmapEmboldenStrength = 1 << 6; 27 static const FT_Pos kBitmapEmboldenStrength = 1 << 6;
26 28
27 SkScalerContext_FreeType_Base(SkTypeface* typeface, const SkDescriptor *desc ) 29 SkScalerContext_FreeType_Base(SkTypeface* typeface, const SkDescriptor *desc )
(...skipping 20 matching lines...) Expand all
48 SkFourByteTag fTag; 50 SkFourByteTag fTag;
49 SkFixed fMinimum; 51 SkFixed fMinimum;
50 SkFixed fDefault; 52 SkFixed fDefault;
51 SkFixed fMaximum; 53 SkFixed fMaximum;
52 }; 54 };
53 using AxisDefinitions = SkSTArray<4, AxisDefinition, true>; 55 using AxisDefinitions = SkSTArray<4, AxisDefinition, true>;
54 bool recognizedFont(SkStream* stream, int* numFonts) const; 56 bool recognizedFont(SkStream* stream, int* numFonts) const;
55 bool scanFont(SkStream* stream, int ttcIndex, 57 bool scanFont(SkStream* stream, int ttcIndex,
56 SkString* name, SkFontStyle* style, bool* isFixedPitch, 58 SkString* name, SkFontStyle* style, bool* isFixedPitch,
57 AxisDefinitions* axes) const; 59 AxisDefinitions* axes) const;
60 static void computeAxisValues(
61 AxisDefinitions axisDefinitions,
62 const SkFontMgr::FontParameters::Axis* requestedAxis, int requestedA xisCount,
63 SkFixed* axisValues,
64 const SkString& name);
65
58 private: 66 private:
59 FT_Face openFace(SkStream* stream, int ttcIndex, FT_Stream ftStream) con st; 67 FT_Face openFace(SkStream* stream, int ttcIndex, FT_Stream ftStream) con st;
60 FT_Library fLibrary; 68 FT_Library fLibrary;
61 mutable SkMutex fLibraryMutex; 69 mutable SkMutex fLibraryMutex;
62 }; 70 };
63 71
64 protected: 72 protected:
65 SkTypeface_FreeType(const SkFontStyle& style, SkFontID uniqueID, bool isFixe dPitch) 73 SkTypeface_FreeType(const SkFontStyle& style, SkFontID uniqueID, bool isFixe dPitch)
66 : INHERITED(style, uniqueID, isFixedPitch) 74 : INHERITED(style, uniqueID, isFixedPitch)
67 , fGlyphCount(-1) 75 , fGlyphCount(-1)
(...skipping 17 matching lines...) Expand all
85 virtual size_t onGetTableData(SkFontTableTag, size_t offset, 93 virtual size_t onGetTableData(SkFontTableTag, size_t offset,
86 size_t length, void* data) const override; 94 size_t length, void* data) const override;
87 95
88 private: 96 private:
89 mutable int fGlyphCount; 97 mutable int fGlyphCount;
90 98
91 typedef SkTypeface INHERITED; 99 typedef SkTypeface INHERITED;
92 }; 100 };
93 101
94 #endif // SKFONTHOST_FREETYPE_COMMON_H_ 102 #endif // SKFONTHOST_FREETYPE_COMMON_H_
OLDNEW
« no previous file with comments | « src/ports/SkFontHost_FreeType.cpp ('k') | src/ports/SkFontHost_mac.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698