Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
2e5da5f4
Commit
2e5da5f4
authored
Dec 07, 2005
by
Vincent Béron
Committed by
Alexandre Julliard
Dec 07, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add an error() function to fnt2fon and sfnt2fnt.
parent
a056a9a8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
22 deletions
+45
-22
fnt2fon.c
tools/fnt2fon.c
+18
-2
sfnt2fnt.c
tools/sfnt2fnt.c
+27
-20
No files found.
tools/fnt2fon.c
View file @
2e5da5f4
...
...
@@ -61,6 +61,23 @@ static void usage(char **argv)
return
;
}
#ifndef __GNUC__
#define __attribute__(X)
#endif
static
void
error
(
const
char
*
s
,
...)
__attribute__
((
format
(
printf
,
1
,
2
)));
static
void
error
(
const
char
*
s
,
...)
{
va_list
ap
;
va_start
(
ap
,
s
);
fprintf
(
stderr
,
"Error: "
);
vfprintf
(
stderr
,
s
,
ap
);
fprintf
(
stderr
,
"
\n
"
);
va_end
(
ap
);
exit
(
1
);
}
int
main
(
int
argc
,
char
**
argv
)
{
int
i
,
j
;
...
...
@@ -99,8 +116,7 @@ int main(int argc, char **argv)
}
fread
(
&
ver
,
sizeof
(
short
),
1
,
fp
);
if
(
ver
!=
0x200
&&
ver
!=
0x300
)
{
fprintf
(
stderr
,
"invalid fnt file %s ver %d
\n
"
,
argv
[
i
+
1
],
ver
);
exit
(
1
);
error
(
"invalid fnt file %s ver %d"
,
argv
[
i
+
1
],
ver
);
}
fread
(
file_lens
+
i
,
sizeof
(
int
),
1
,
fp
);
fseek
(
fp
,
0x44
,
SEEK_SET
);
...
...
tools/sfnt2fnt.c
View file @
2e5da5f4
...
...
@@ -61,6 +61,23 @@ static void usage(char **argv)
return
;
}
#ifndef __GNUC__
#define __attribute__(X)
#endif
static
void
error
(
const
char
*
s
,
...)
__attribute__
((
format
(
printf
,
1
,
2
)));
static
void
error
(
const
char
*
s
,
...)
{
va_list
ap
;
va_start
(
ap
,
s
);
fprintf
(
stderr
,
"Error: "
);
vfprintf
(
stderr
,
s
,
ap
);
fprintf
(
stderr
,
"
\n
"
);
va_end
(
ap
);
exit
(
1
);
}
static
int
lookup_charset
(
int
enc
)
{
/* FIXME: make winelib app and use TranslateCharsetInfo */
...
...
@@ -130,33 +147,25 @@ static void fill_fontinfo(FT_Face face, int enc, FILE *fp, int dpi, unsigned cha
FT_SfntName
sfntname
;
TT_OS2
*
os2
;
cptable
=
wine_cp_get_table
(
enc
);
if
(
!
cptable
)
{
fprintf
(
stderr
,
"Can't find codepage %d
\n
"
,
enc
);
exit
(
1
);
}
if
(
!
cptable
)
error
(
"Can't find codepage %d
\n
"
,
enc
);
if
(
cptable
->
info
.
char_size
!=
1
)
{
/* for double byte charsets we actually want to use cp1252 */
cptable
=
wine_cp_get_table
(
1252
);
if
(
!
cptable
)
{
fprintf
(
stderr
,
"Can't find codepage 1252
\n
"
);
exit
(
1
);
}
if
(
!
cptable
)
error
(
"Can't find codepage 1252
\n
"
);
}
ppem
=
face
->
size
->
metrics
.
y_ppem
;
start
=
sizeof
(
FNT_HEADER
)
+
sizeof
(
FONTINFO16
);
if
(
FT_Load_Char
(
face
,
0xc5
,
FT_LOAD_DEFAULT
))
{
fprintf
(
stderr
,
"Can't find Aring
\n
"
);
exit
(
1
);
}
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
))
{
fprintf
(
stderr
,
"Can't find M
\n
"
);
exit
(
1
);
}
if
(
FT_Load_Char
(
face
,
'M'
,
FT_LOAD_DEFAULT
))
error
(
"Can't find M
\n
"
);
il
=
ascent
-
(
face
->
glyph
->
metrics
.
height
>>
6
);
/* Hack: Courier has no internal leading, nor do any Chinese fonts */
...
...
@@ -344,10 +353,8 @@ int main(int argc, char **argv)
def_char
=
atoi
(
argv
[
5
]);
avg_width
=
atoi
(
argv
[
6
]);
if
(
FT_Init_FreeType
(
&
lib
))
{
fprintf
(
stderr
,
"ft init failure
\n
"
);
exit
(
1
);
}
if
(
FT_Init_FreeType
(
&
lib
))
error
(
"ft init failure
\n
"
);
if
(
FT_New_Face
(
lib
,
argv
[
1
],
0
,
&
face
))
{
fprintf
(
stderr
,
"Can't open face
\n
"
);
...
...
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