Home
About
Blog
Products
Forum
Support
Contact
Sunbelt Computer Software
PL/B Language Development and Support
Home
About
Blog
Products
Forum
Support
Contact
matplotlib/src/ft2font.h at v3.4.x · matplotlib/matplotlib · GitHub
Skip to content
Navigation Menu
Sign in
Appearance settings
Platform
AI CODE CREATION
GitHub Copilot
Write better code with AI
GitHub Copilot app
Direct agents from issue to merge
MCP Registry
Integrate external tools
DEVELOPER WORKFLOWS
Actions
Automate any workflow
Codespaces
Instant dev environments
Issues
Plan and track work
Code Review
Manage code changes
Code Quality
Enforce quality at merge
APPLICATION SECURITY
GitHub Advanced Security
Find and fix vulnerabilities
Code security
Secure your code as you build
Secret protection
Stop leaks before they start
EXPLORE
Why GitHub
Documentation
Blog
Changelog
Marketplace
View all features
Solutions
BY COMPANY SIZE
Enterprises
Small and medium teams
Startups
Nonprofits
BY USE CASE
App Modernization
DevSecOps
DevOps
CI/CD
View all use cases
BY INDUSTRY
Healthcare
Financial services
Manufacturing
Government
View all industries
View all solutions
Resources
EXPLORE BY TOPIC
AI
Software Development
DevOps
Security
View all topics
EXPLORE BY TYPE
Customer stories
Events & webinars
Ebooks & reports
Business insights
GitHub Skills
SUPPORT & SERVICES
Documentation
Customer support
Community forum
Trust center
Partners
View all resources
Open Source
COMMUNITY
GitHub Sponsors
Fund open source developers
PROGRAMS
Security Lab
Maintainer Community
GitHub Stars
Archive Program
REPOSITORIES
Topics
Trending
Collections
Enterprise
ENTERPRISE SOLUTIONS
Enterprise platform
AI-powered developer platform
AVAILABLE ADD-ONS
GitHub Advanced Security
Enterprise-grade security features
Copilot for Business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
Uh oh!
There was an error while loading.
Please reload this page
.
matplotlib
/
matplotlib
Public
Uh oh!
There was an error while loading.
Please reload this page
.
Notifications
You must be signed in to change notification settings
Fork
8.5k
Star
23.2k
Code
Issues
1.1k
Pull requests
423
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Files
Expand file tree
v3.4.x
Breadcrumbs
matplotlib
/
src
/
ft2font.h
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
136 lines (120 loc) · 3.38 KB
v3.4.x
Breadcrumbs
matplotlib
/
src
/
ft2font.h
Copy path
Top
File metadata and controls
Code
Blame
136 lines (120 loc) · 3.38 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
/*
-*- mode: c++; c-basic-offset: 4 -*-
*/
/*
A python interface to FreeType
*/
#
ifndef
MPL_FT2FONT_H
#
define
MPL_FT2FONT_H
#
include
<
vector
>
#
include
<
stdint.h
>
extern
"
C
"
{
#
include
<
ft2build.h
>
#
include
FT_FREETYPE_H
#
include
FT_GLYPH_H
#
include
FT_OUTLINE_H
#
include
FT_SFNT_NAMES_H
#
include
FT_TYPE1_TABLES_H
#
include
FT_TRUETYPE_TABLES_H
}
#
define
PY_SSIZE_T_CLEAN
#
include
<
Python.h
>
/*
By definition, FT_FIXED as 2 16bit values stored in a single long.
*/
#
define
FIXED_MAJOR
(
val
) (
signed
short
)((val &
0xffff0000
) >>
16
)
#
define
FIXED_MINOR
(
val
) (
unsigned
short
)(val &
0xffff
)
//
the FreeType string rendered into a width, height buffer
class
FT2Image
{
public:
FT2Image
();
FT2Image
(
unsigned
long
width,
unsigned
long
height);
virtual
~FT2Image
();
void
resize
(
long
width,
long
height);
void
draw_bitmap
(FT_Bitmap *bitmap, FT_Int x, FT_Int y);
void
write_bitmap
(
FILE
*fp)
const
;
void
draw_rect
(
unsigned
long
x0,
unsigned
long
y0,
unsigned
long
x1,
unsigned
long
y1);
void
draw_rect_filled
(
unsigned
long
x0,
unsigned
long
y0,
unsigned
long
x1,
unsigned
long
y1);
unsigned
char
*
get_buffer
()
{
return
m_buffer;
}
unsigned
long
get_width
()
{
return
m_width;
}
unsigned
long
get_height
()
{
return
m_height;
}
private:
bool
m_dirty;
unsigned
char
*m_buffer;
unsigned
long
m_width;
unsigned
long
m_height;
//
prevent copying
FT2Image
(
const
FT2Image &);
FT2Image &
operator
=(
const
FT2Image &);
};
extern
FT_Library _ft2Library;
class
FT2Font
{
public:
FT2Font
(FT_Open_Args &open_args,
long
hinting_factor);
virtual
~FT2Font
();
void
clear
();
void
set_size
(
double
ptsize,
double
dpi);
void
set_charmap
(
int
i);
void
select_charmap
(
unsigned
long
i);
void
set_text
(
size_t
N,
uint32_t
*codepoints,
double
angle, FT_Int32 flags, std::vector<
double
> &xys);
int
get_kerning
(FT_UInt left, FT_UInt right, FT_UInt mode);
void
set_kerning_factor
(
int
factor);
void
load_char
(
long
charcode, FT_Int32 flags);
void
load_glyph
(FT_UInt glyph_index, FT_Int32 flags);
void
get_width_height
(
long
*width,
long
*height);
void
get_bitmap_offset
(
long
*x,
long
*y);
long
get_descent
();
//
TODO: Since we know the size of the array upfront, we probably don't
//
need to dynamically allocate like this
void
get_xys
(
bool
antialiased, std::vector<
double
> &xys);
void
draw_glyphs_to_bitmap
(
bool
antialiased);
void
draw_glyph_to_bitmap
(FT2Image &im,
int
x,
int
y,
size_t
glyphInd,
bool
antialiased);
void
get_glyph_name
(
unsigned
int
glyph_number,
char
*buffer);
long
get_name_index
(
char
*name);
PyObject*
get_path
();
FT_Face &
get_face
()
{
return
face;
}
FT2Image &
get_image
()
{
return
image;
}
FT_Glyph &
get_last_glyph
()
{
return
glyphs.
back
();
}
size_t
get_last_glyph_index
()
{
return
glyphs.
size
() -
1
;
}
size_t
get_num_glyphs
()
{
return
glyphs.
size
();
}
long
get_hinting_factor
()
{
return
hinting_factor;
}
private:
FT2Image image;
FT_Face face;
FT_Vector pen;
/*
untransformed origin
*/
std::vector<FT_Glyph> glyphs;
FT_BBox bbox;
FT_Pos advance;
long
hinting_factor;
int
kerning_factor;
//
prevent copying
FT2Font
(
const
FT2Font &);
FT2Font &
operator
=(
const
FT2Font &);
};
#
endif
You can’t perform that action at this time.