Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
130a0e4f
Commit
130a0e4f
authored
Mar 21, 2006
by
Huw Davies
Committed by
Alexandre Julliard
Mar 21, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fonts: Use the EBLC table to retrieve the ascent of the bitmap font.
parent
09941267
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
82 additions
and
7 deletions
+82
-7
gdiobj.c
dlls/gdi/tests/gdiobj.c
+0
-2
sfnt2fnt.c
tools/sfnt2fnt.c
+82
-5
No files found.
dlls/gdi/tests/gdiobj.c
View file @
130a0e4f
...
...
@@ -235,9 +235,7 @@ static void test_bitmap_font_metrics(void)
{
"MS Serif"
,
FW_NORMAL
,
21
,
16
,
5
,
3
,
0
,
9
,
23
},
{
"MS Serif"
,
FW_NORMAL
,
27
,
21
,
6
,
3
,
0
,
12
,
27
},
{
"MS Serif"
,
FW_NORMAL
,
35
,
27
,
8
,
3
,
0
,
16
,
34
},
#if 0 /* FIXME: enable once the bug in sfnt2fnt is fixed */
{
"Courier"
,
FW_NORMAL
,
13
,
11
,
2
,
0
,
0
,
8
,
8
},
#endif
{
"Courier"
,
FW_NORMAL
,
16
,
13
,
3
,
0
,
0
,
9
,
9
},
{
"Courier"
,
FW_NORMAL
,
20
,
16
,
4
,
0
,
0
,
12
,
12
},
{
"System"
,
FW_BOLD
,
16
,
13
,
3
,
3
,
0
,
7
,
15
}
...
...
tools/sfnt2fnt.c
View file @
130a0e4f
...
...
@@ -34,6 +34,7 @@
#include FT_FREETYPE_H
#include FT_SFNT_NAMES_H
#include FT_TRUETYPE_TABLES_H
#include FT_TRUETYPE_TAGS_H
#include "wine/unicode.h"
#include "wine/wingdi16.h"
...
...
@@ -53,6 +54,45 @@ typedef struct {
DWORD
offset
;
}
CHAR_TABLE_ENTRY
;
typedef
struct
{
DWORD
version
;
ULONG
numSizes
;
}
eblcHeader_t
;
typedef
struct
{
CHAR
ascender
;
CHAR
descender
;
BYTE
widthMax
;
CHAR
caretSlopeNumerator
;
CHAR
caretSlopeDenominator
;
CHAR
caretOffset
;
CHAR
minOriginSB
;
CHAR
minAdvanceSB
;
CHAR
maxBeforeBL
;
CHAR
maxAfterBL
;
CHAR
pad1
;
CHAR
pad2
;
}
sbitLineMetrics_t
;
typedef
struct
{
ULONG
indexSubTableArrayOffset
;
ULONG
indexTableSize
;
ULONG
numberOfIndexSubTables
;
ULONG
colorRef
;
sbitLineMetrics_t
hori
;
sbitLineMetrics_t
vert
;
USHORT
startGlyphIndex
;
USHORT
endGlyphIndex
;
BYTE
ppemX
;
BYTE
ppemY
;
BYTE
bitDepth
;
CHAR
flags
;
}
bitmapSizeTable_t
;
#define GET_BE_WORD(ptr) MAKEWORD( ((BYTE *)(ptr))[1], ((BYTE *)(ptr))[0] )
#define GET_BE_DWORD(ptr) ((DWORD)MAKELONG( GET_BE_WORD(&((WORD *)(ptr))[1]), \
GET_BE_WORD(&((WORD *)(ptr))[0]) ))
#include "poppack.h"
static
const
char
*
output_name
;
...
...
@@ -141,7 +181,7 @@ static int lookup_charset(int enc)
static
void
fill_fontinfo
(
FT_Face
face
,
int
enc
,
FILE
*
fp
,
int
dpi
,
unsigned
char
def_char
,
int
avg_width
)
{
int
ascent
,
il
,
ppem
,
descent
,
width_bytes
=
0
,
space_size
,
max_width
=
0
;
int
ascent
=
0
,
il
,
ppem
,
descent
=
0
,
width_bytes
=
0
,
space_size
,
max_width
=
0
;
FNT_HEADER
hdr
;
FONTINFO16
fi
;
BYTE
left_byte
,
right_byte
,
byte
;
...
...
@@ -153,6 +193,11 @@ static void fill_fontinfo(FT_Face face, int enc, FILE *fp, int dpi, unsigned cha
const
union
cptable
*
cptable
;
FT_SfntName
sfntname
;
TT_OS2
*
os2
;
FT_ULong
needed
;
eblcHeader_t
*
eblc
;
bitmapSizeTable_t
*
size_table
;
int
num_sizes
;
cptable
=
wine_cp_get_table
(
enc
);
if
(
!
cptable
)
error
(
"Can't find codepage %d
\n
"
,
enc
);
...
...
@@ -165,12 +210,44 @@ static void fill_fontinfo(FT_Face face, int enc, FILE *fp, int dpi, unsigned cha
}
ppem
=
face
->
size
->
metrics
.
y_ppem
;
needed
=
0
;
if
(
FT_Load_Sfnt_Table
(
face
,
TTAG_EBLC
,
0
,
NULL
,
&
needed
))
error
(
"Can't find EBLC table
\n
"
);
eblc
=
malloc
(
needed
);
FT_Load_Sfnt_Table
(
face
,
TTAG_EBLC
,
0
,
(
FT_Byte
*
)
eblc
,
&
needed
);
num_sizes
=
GET_BE_DWORD
(
&
eblc
->
numSizes
);
size_table
=
(
bitmapSizeTable_t
*
)(
eblc
+
1
);
for
(
i
=
0
;
i
<
num_sizes
;
i
++
)
{
if
(
size_table
->
hori
.
ascender
-
size_table
->
hori
.
descender
==
ppem
)
{
ascent
=
size_table
->
hori
.
ascender
;
descent
=
-
size_table
->
hori
.
descender
;
break
;
}
size_table
++
;
}
/* Versions of fontforge prior to early 2006 have incorrect
ascender values in the eblc table, so we won't find the
correct bitmapSizeTable. In this case use the height of
the Aring glyph instead. */
if
(
ascent
==
0
)
{
if
(
FT_Load_Char
(
face
,
0xc5
,
FT_LOAD_DEFAULT
))
error
(
"Can't find Aring
\n
"
);
ascent
=
face
->
glyph
->
metrics
.
horiBearingY
>>
6
;
descent
=
ppem
-
ascent
;
}
free
(
eblc
);
start
=
sizeof
(
FNT_HEADER
)
+
sizeof
(
FONTINFO16
);
if
(
FT_Load_Char
(
face
,
0xc5
,
FT_LOAD_DEFAULT
))
error
(
"Can't find Aring
\n
"
);
ascent
=
face
->
glyph
->
metrics
.
height
>>
6
;
descent
=
ppem
-
ascent
;
if
(
FT_Load_Char
(
face
,
'M'
,
FT_LOAD_DEFAULT
))
error
(
"Can't find M
\n
"
);
il
=
ascent
-
(
face
->
glyph
->
metrics
.
height
>>
6
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment