Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
fontconfig
fontconfig
Commits
01f781a9
Commit
01f781a9
authored
Sep 27, 2017
by
Behdad Esfahbod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[varfonts] Share lang across named-instances
Makes VotoSerifGX scanning another 40% faster... Down to 36ms now.
parent
161c7385
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
10 deletions
+34
-10
src/fcfreetype.c
src/fcfreetype.c
+25
-10
src/fclang.c
src/fclang.c
+6
-0
src/fcpat.c
src/fcpat.c
+3
-0
No files found.
src/fcfreetype.c
View file @
01f781a9
...
@@ -1189,7 +1189,8 @@ static FcPattern *
...
@@ -1189,7 +1189,8 @@ static FcPattern *
FcFreeTypeQueryFaceInternal
(
const
FT_Face
face
,
FcFreeTypeQueryFaceInternal
(
const
FT_Face
face
,
const
FcChar8
*
file
,
const
FcChar8
*
file
,
unsigned
int
id
,
unsigned
int
id
,
FcCharSet
*
cs
)
FcCharSet
**
cs_share
,
FcLangSet
**
ls_share
)
{
{
FcPattern
*
pat
;
FcPattern
*
pat
;
int
slant
=
-
1
;
int
slant
=
-
1
;
...
@@ -1200,6 +1201,7 @@ FcFreeTypeQueryFaceInternal (const FT_Face face,
...
@@ -1200,6 +1201,7 @@ FcFreeTypeQueryFaceInternal (const FT_Face face,
FcBool
variable_weight
=
FcFalse
;
FcBool
variable_weight
=
FcFalse
;
FcBool
variable_width
=
FcFalse
;
FcBool
variable_width
=
FcFalse
;
FcBool
variable_size
=
FcFalse
;
FcBool
variable_size
=
FcFalse
;
FcCharSet
*
cs
;
FcLangSet
*
ls
;
FcLangSet
*
ls
;
#if 0
#if 0
FcChar8 *family = 0;
FcChar8 *family = 0;
...
@@ -1938,10 +1940,14 @@ FcFreeTypeQueryFaceInternal (const FT_Face face,
...
@@ -1938,10 +1940,14 @@ FcFreeTypeQueryFaceInternal (const FT_Face face,
/*
/*
* Compute the unicode coverage for the font
* Compute the unicode coverage for the font
*/
*/
if
(
cs
)
if
(
cs
_share
&&
*
cs_share
)
cs
=
FcCharSetCopy
(
cs
);
cs
=
FcCharSetCopy
(
*
cs
_share
);
else
else
{
cs
=
FcFreeTypeCharSet
(
face
,
NULL
);
cs
=
FcFreeTypeCharSet
(
face
,
NULL
);
if
(
cs_share
)
*
cs_share
=
FcCharSetCopy
(
cs
);
}
if
(
!
cs
)
if
(
!
cs
)
goto
bail1
;
goto
bail1
;
...
@@ -1984,8 +1990,15 @@ FcFreeTypeQueryFaceInternal (const FT_Face face,
...
@@ -1984,8 +1990,15 @@ FcFreeTypeQueryFaceInternal (const FT_Face face,
goto
bail2
;
goto
bail2
;
if
(
!
symbol
)
if
(
!
symbol
)
{
if
(
ls_share
&&
*
ls_share
)
ls
=
FcLangSetCopy
(
*
ls_share
);
else
{
{
ls
=
FcFreeTypeLangSet
(
cs
,
exclusiveLang
);
ls
=
FcFreeTypeLangSet
(
cs
,
exclusiveLang
);
if
(
ls_share
)
*
ls_share
=
FcLangSetCopy
(
ls
);
}
if
(
!
ls
)
if
(
!
ls
)
goto
bail2
;
goto
bail2
;
}
}
...
@@ -2061,7 +2074,7 @@ FcFreeTypeQueryFace (const FT_Face face,
...
@@ -2061,7 +2074,7 @@ FcFreeTypeQueryFace (const FT_Face face,
unsigned
int
id
,
unsigned
int
id
,
FcBlanks
*
blanks
FC_UNUSED
)
FcBlanks
*
blanks
FC_UNUSED
)
{
{
return
FcFreeTypeQueryFaceInternal
(
face
,
file
,
id
,
NULL
);
return
FcFreeTypeQueryFaceInternal
(
face
,
file
,
id
,
NULL
,
NULL
);
}
}
FcPattern
*
FcPattern
*
...
@@ -2083,7 +2096,7 @@ FcFreeTypeQuery(const FcChar8 *file,
...
@@ -2083,7 +2096,7 @@ FcFreeTypeQuery(const FcChar8 *file,
if
(
count
)
if
(
count
)
*
count
=
face
->
num_faces
;
*
count
=
face
->
num_faces
;
pat
=
FcFreeTypeQueryFaceInternal
(
face
,
file
,
id
,
NULL
);
pat
=
FcFreeTypeQueryFaceInternal
(
face
,
file
,
id
,
NULL
,
NULL
);
FT_Done_Face
(
face
);
FT_Done_Face
(
face
);
bail:
bail:
...
@@ -2101,6 +2114,7 @@ FcFreeTypeQueryAll(const FcChar8 *file,
...
@@ -2101,6 +2114,7 @@ FcFreeTypeQueryAll(const FcChar8 *file,
FT_Face
face
=
NULL
;
FT_Face
face
=
NULL
;
FT_Library
ftLibrary
=
NULL
;
FT_Library
ftLibrary
=
NULL
;
FcCharSet
*
cs
=
NULL
;
FcCharSet
*
cs
=
NULL
;
FcLangSet
*
ls
=
NULL
;
FT_MM_Var
*
mm_var
=
NULL
;
FT_MM_Var
*
mm_var
=
NULL
;
FcBool
index_set
=
id
!=
(
unsigned
int
)
-
1
;
FcBool
index_set
=
id
!=
(
unsigned
int
)
-
1
;
unsigned
int
set_face_num
=
index_set
?
id
&
0xFFFF
:
0
;
unsigned
int
set_face_num
=
index_set
?
id
&
0xFFFF
:
0
;
...
@@ -2120,7 +2134,6 @@ FcFreeTypeQueryAll(const FcChar8 *file,
...
@@ -2120,7 +2134,6 @@ FcFreeTypeQueryAll(const FcChar8 *file,
if
(
FT_New_Face
(
ftLibrary
,
(
const
char
*
)
file
,
face_num
,
&
face
))
if
(
FT_New_Face
(
ftLibrary
,
(
const
char
*
)
file
,
face_num
,
&
face
))
goto
bail
;
goto
bail
;
cs
=
FcFreeTypeCharSet
(
face
,
blanks
);
num_faces
=
face
->
num_faces
;
num_faces
=
face
->
num_faces
;
num_instances
=
face
->
style_flags
>>
16
;
num_instances
=
face
->
style_flags
>>
16
;
...
@@ -2160,7 +2173,7 @@ FcFreeTypeQueryAll(const FcChar8 *file,
...
@@ -2160,7 +2173,7 @@ FcFreeTypeQueryAll(const FcChar8 *file,
}
}
id
=
((
instance_num
<<
16
)
+
face_num
);
id
=
((
instance_num
<<
16
)
+
face_num
);
pat
=
FcFreeTypeQueryFaceInternal
(
face
,
(
const
FcChar8
*
)
file
,
id
,
c
s
);
pat
=
FcFreeTypeQueryFaceInternal
(
face
,
(
const
FcChar8
*
)
file
,
id
,
&
cs
,
&
l
s
);
if
(
pat
)
if
(
pat
)
{
{
...
@@ -2179,6 +2192,8 @@ skip:
...
@@ -2179,6 +2192,8 @@ skip:
instance_num
=
0x8000
;
/* variable font */
instance_num
=
0x8000
;
/* variable font */
else
else
{
{
FcLangSetDestroy
(
ls
);
ls
=
NULL
;
FcCharSetDestroy
(
cs
);
FcCharSetDestroy
(
cs
);
cs
=
NULL
;
cs
=
NULL
;
FT_Done_Face
(
face
);
FT_Done_Face
(
face
);
...
@@ -2189,11 +2204,11 @@ skip:
...
@@ -2189,11 +2204,11 @@ skip:
if
(
FT_New_Face
(
ftLibrary
,
(
const
char
*
)
file
,
face_num
,
&
face
))
if
(
FT_New_Face
(
ftLibrary
,
(
const
char
*
)
file
,
face_num
,
&
face
))
break
;
break
;
cs
=
FcFreeTypeCharSet
(
face
,
blanks
);
}
}
}
while
(
!
err
&&
(
!
index_set
||
face_num
==
set_face_num
)
&&
face_num
<
num_faces
);
}
while
(
!
err
&&
(
!
index_set
||
face_num
==
set_face_num
)
&&
face_num
<
num_faces
);
bail:
bail:
FcLangSetDestroy
(
ls
);
FcCharSetDestroy
(
cs
);
FcCharSetDestroy
(
cs
);
if
(
face
)
if
(
face
)
FT_Done_Face
(
face
);
FT_Done_Face
(
face
);
...
...
src/fclang.c
View file @
01f781a9
...
@@ -485,6 +485,9 @@ FcLangSetCreate (void)
...
@@ -485,6 +485,9 @@ FcLangSetCreate (void)
void
void
FcLangSetDestroy
(
FcLangSet
*
ls
)
FcLangSetDestroy
(
FcLangSet
*
ls
)
{
{
if
(
!
ls
)
return
;
if
(
ls
->
extra
)
if
(
ls
->
extra
)
FcStrSetDestroy
(
ls
->
extra
);
FcStrSetDestroy
(
ls
->
extra
);
free
(
ls
);
free
(
ls
);
...
@@ -495,6 +498,9 @@ FcLangSetCopy (const FcLangSet *ls)
...
@@ -495,6 +498,9 @@ FcLangSetCopy (const FcLangSet *ls)
{
{
FcLangSet
*
new
;
FcLangSet
*
new
;
if
(
!
ls
)
return
NULL
;
new
=
FcLangSetCreate
();
new
=
FcLangSetCreate
();
if
(
!
new
)
if
(
!
new
)
goto
bail0
;
goto
bail0
;
...
...
src/fcpat.c
View file @
01f781a9
...
@@ -1113,6 +1113,9 @@ FcPatternDuplicate (const FcPattern *orig)
...
@@ -1113,6 +1113,9 @@ FcPatternDuplicate (const FcPattern *orig)
int
i
;
int
i
;
FcValueListPtr
l
;
FcValueListPtr
l
;
if
(
!
orig
)
return
NULL
;
new
=
FcPatternCreate
();
new
=
FcPatternCreate
();
if
(
!
new
)
if
(
!
new
)
goto
bail0
;
goto
bail0
;
...
...
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