-
Notifications
You must be signed in to change notification settings - Fork 219
/
Copy pathIFreeTypeFaceExtender.h
84 lines (56 loc) · 3.04 KB
/
IFreeTypeFaceExtender.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*
Source File : IFreeTypeFaceExtender.h
Copyright 2011 Gal Kahana PDFWriter
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#pragma once
#include "EFontStretch.h"
#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_TYPES_H
#include <utility>
#include <string>
typedef std::pair<bool,FT_Short> BoolAndFTShort;
class IFreeTypeFaceExtender
{
public:
virtual ~IFreeTypeFaceExtender(){}
// Italic Angle - if you don't know...just return 0
virtual double GetItalicAngle() = 0;
// CapHeight - bool should indicate whether the 2nd value is valid. this will indicate container to go look for the value by measuring the y value of H
virtual BoolAndFTShort GetCapHeight() = 0;
// XHeight - bool should indicae whether the 2nd value is valid. this will indicate container to go look for the value by measuring the y value of x
virtual BoolAndFTShort GetxHeight() = 0;
// Stem V, please do try and find a valid value...
virtual FT_UShort GetStemV() = 0;
// return eFontStretchUknown if you can't tell. will try to analyze from the font style name
virtual EFontStretch GetFontStretch() = 0;
// return 1000 if you can't tell. will try to analyze from font style name
virtual FT_UShort GetFontWeight() = 0;
// return a good answer or false if don't know. no fallback here
virtual bool HasSerifs() = 0;
// return a good answer or false if don't know. no fallback here
virtual bool IsScript() = 0;
// return a good answer or false if you don't know. no fallback here
virtual bool IsForceBold() = 0;
// return true if would like to use independent encoding method, or false if to use the generic freetype
virtual bool HasPrivateEncoding() = 0;
// if the answer for HasPrivateEncoding is true, this should provide the private encoding (namely what glyph index matches the char)
virtual unsigned int GetGlyphForUnicodeChar(unsigned long inChar) = 0;
// if the answer for HasPrivateEncoding is true, this should return the glyph name in the private encoding
virtual std::string GetPrivateGlyphName(unsigned int inGlyphIndex) = 0;
// for queries to freetype, in the case of HasPrivateEncoding is true, get the freetype glyph index for a given font glyph index
// (this will be different in case the 0 glyph index is not .notdef)
virtual unsigned int GetFreeTypeGlyphIndexFromEncodingGlyphIndex(unsigned int inGlyphIndex) = 0;
// implement query of postscript font name which is not the standard free type method.
// return zero length for no name
virtual std::string GetPostscriptNameNonStandard()=0;
};