Commit Graph

271 Commits

Author SHA1 Message Date
Khaled Hosny e0eb855462 Detect standalone CFF fonts for FC_FONT_WRAPPER
FreeType will return CFF for both SFNT fonts with CFF table as well as
standalone CFF fonts, but applications might want to support the former
and not the later, so now FC_FONT_WRAPPER makes the distinction more
clear.
2023-08-24 14:11:26 +03:00
Khaled Hosny f614ec4d60 Add FC_FONT_WRAPPER
Currently detects only SFNT wrappers:
- WOFF: if it is FreeType says it is an SFNT font the file starts with wOFF tag
- WOFF2: the same but tag is wOF2
- SFNT: for any other SFNT font (which helps distinguishing standalone
  CFF fonts from CFF in SFNT aka OTF)

Fixes #375
2023-08-08 18:17:10 +03:00
Akira TAGOH e4987ef114 Remove the problematic language from code and doc 2023-05-29 22:13:23 +09:00
Akira TAGOH f0612537cb Add namedinstance property
This change allows applications to detect if a font
is a variable font and a named-instance.
If they are, namedinstance property is set to true,
otherwise false.

Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/-/issues/362
2023-05-25 20:12:31 +09:00
msizanoen1 a6a1695722 Reload MM/VF metadata for each font face in font collection
This ensures that the MM/VF metadata is the correct metadata for each
font face instead of whatever happens to be in the first one in the
collection.
2023-02-22 21:57:44 +07:00
Vitaly Lysenkov 89af138176 In fcfreetype.c, `GetScriptTags`: fix `use_of_uninitialized_value` and return the correct number of parsed tags in case the font file contains less tags than indicated. 2023-02-21 20:13:23 +00:00
Akira TAGOH 4238402f1c Initialize variable 2021-12-09 20:29:06 +09:00
Akira TAGOH 3196e1815e Apply the change made by 23e46d1 again
Regression by d62d984e2b
2021-12-09 20:28:16 +09:00
Akira TAGOH 92fbf14b0d Fix the issue fail to obtain the style name
The number of a couple of 'family' and 'familylang' and 'style' and 'stylelang'
is different. need to reset the counter to get the property regarding to regarding to the lang.

Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/-/issues/303
2021-12-09 20:26:10 +09:00
Ben Wagner ce00010b1f Actually skip leading spaces in style name
Because the loop body is just 'break' the loop never loops and at most
one leading space is skipped. Remove the body to allow the loop to
continue. Found with ClangTidy.
2021-12-06 16:55:12 -05:00
Akira TAGOH 5841bd012d Fix some testcase fails for 14c265a1
Add an extra code to ignore an error of FT_Get_MM_Var()
only when FT_MM_Var variable isn't used in any case.
2021-11-09 20:42:52 +09:00
Behdad Esfahbod 14c265a10a If a varfont has 'opsz' axis, set FC_SIZE on default instant pattern
Otherwise default-instance pattern would match as an "all sizes",
which would be wrong. See:

https://gitlab.gnome.org/GNOME/pango/-/issues/621#note_1305844
2021-11-09 20:04:52 +09:00
Ben Wagner a204489885 Fix warning about os2->achVendID cannot be NULL
FreeType's TT_OS2::achVendID is a FT_Char[4] array and not a pointer,
so it does not need to be checked for NULL.
2021-10-28 16:17:48 -04:00
Akira TAGOH d62d984e2b Revert constructing fullname property from family and style properties
This seems making a regression in Java. we will revisit this issue later.

Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/-/issues/277
2021-06-28 17:37:23 +09:00
Akira TAGOH 93c93689f5 Add back fullname property at scan matching phase
There seems to be a lot of config files using fullname property in the world.
To keep the backward compatibility, fullname property is back to a cache at
the scan matching phase but will be rebuilt once it is done according to family
and style property in the pattern no matter what changes one made in fullname
property during that.

Ref. https://bugzilla.redhat.com/show_bug.cgi?id=1902881
2020-12-04 18:18:03 +09:00
Akira TAGOH dc1443ac83 Split up a code again coming from different copyright notice
to show up easier in COPYING.
it was originally merged from separate file by 2e2121f9 though.
2020-09-29 15:37:14 +09:00
Akira TAGOH dbef9d10de Make sure a combination of family and familylang is available 2020-09-21 14:55:21 +09:00
Akira TAGOH 5a291467a7 Add Regular style when no meta data available to guess a style
This makes sure that fullname can be constructed at least even if a style is missing
and "Regular" is omitted for fullname so this change won't affect in that case.

Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/-/issues/259
2020-09-21 14:55:18 +09:00
Akira TAGOH c78e7fd6de Add fullname later once FcConfigSubstitute() is done
So user's changes in family and style will be reflected into fullname.
2020-09-16 13:40:48 +09:00
Akira TAGOH 0f9040406c Construct fullname from family and style
OpenType spec says that the Regular descriptor would generally be
omitted from fullname. but some fonts doesn't follow on it.

So decided to construct a fullname from family and style instead of
relying on the meta data in a font.

Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/issues/208
2020-09-16 13:40:48 +09:00
Alan Coopersmith 9bc88933b2 Fix some typos/spelling errors
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2020-07-21 18:42:40 -07:00
Akira TAGOH 68d021b634 Add FC_ORDER property into cache
"fontversion" used to be modified to sort out fonts as a technique.
But that lost the original purpose to do the version control between
releases.

This change adds the dedicated property into the cache.

Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/-/issues/226
2020-05-25 18:22:55 +09:00
Jonathan Kew 6edaaa4d18 Set name_mapping to NULL after freeing
To avoid risk of double-free.
    
Fixes #237.
2020-04-28 16:50:49 +00:00
Akira TAGOH d3bfbea7dc Set exact boolean value to color property
This is a regression since 48e9e5f4
2020-02-27 14:25:10 +09:00
Akira TAGOH 61573ad5f7 Fix memory leaks 2020-02-19 17:05:20 +09:00
Akira TAGOH 452be8125f Add proper fullname for named-instances
Try to build a fullname from a family and a style name for a named-instance.

Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/issues/185
2019-12-09 20:13:38 +09:00
Akira TAGOH 8249f871b3 Don't add a value for FC_FULLNAME in meta face
FC_FULLNAME is affected by variables and could be different
against it. FC_FULLNAME should be dropped from meta face.

Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/issues/185
2019-11-28 18:08:07 +09:00
Akira TAGOH 505c7c46a5 Improve the performance a bit
This change reduces the call cost of strcmp 1.5 % less.
2019-08-07 12:39:14 +00:00
Akira TAGOH 8c44becd45 Fix failing the check of prep table in some fonts 2019-07-30 11:06:19 +00:00
Akira TAGOH 80047ed8e8 Add FC_FONT_HAS_HINT property to see if font has hinting or not.
This may helps to enable autohint only when font doesn't have any hinting
2019-07-29 10:19:26 +00:00
Akira TAGOH e2f9f28aed Fix a memory leak in FcFreeTypeQuery*()
Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/issues/170
2019-07-26 04:59:54 +00:00
Akira TAGOH 2960391699 Add English name first into a cache
In some cases, non-English languages might appears first in current order.
and when having English name with non-English language ID like Google Noto CJK TC,
English name with English language ID will be dropped due to duplicate.

This fixes that issue.
2019-07-09 06:40:29 +00:00
Akira TAGOH a57f22bf6d Fix a typo 2019-07-09 05:54:32 +00:00
Akira TAGOH cb3e6ff4d7 Improve the performance a bit 2019-07-08 13:26:49 +00:00
Akira TAGOH 322131f433 Fix a crash when running with FC_DEBUG=256
Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/issues/167
2019-07-02 04:59:52 +00:00
Akira TAGOH c0dc76268b Fix a typo on masking face id
Most of functionality should be moved to FcFreeTypeQueryAll()
for varfonts now though, if doing the same to FcFreeTypeQuery()
returns Null pattern because of inappropriate masking.

This might be not that big deal for varfonts support. but

Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/issues/162

Reported by Kevin Scott
2019-06-18 05:58:17 +00:00
Behdad Esfahbod f7036d589b Fix name-table language code mapping for Mongolian 2018-10-25 07:31:44 +00:00
Akira TAGOH 8e97d745cc Fix a typo 2018-07-19 08:21:33 +00:00
Behdad Esfahbod 48e9e5f4f0 Use FT_HAS_COLOR 2018-07-16 17:59:54 +02:00
Tom Anderson c60ed9ef66 Fix undefined-shift UBSAN errors
The expression "1 << 31" will cause UBSAN to complain with this error message:
runtime error: left shift of 1 by 31 places cannot be represented in type 'int'

The same operation on unsigned types is fine, however.  This CL replaces the
strings "1 <<" with "1U <<".
2018-04-16 15:23:20 +02:00
Behdad Esfahbod a8a6efa805 Share name-mapping across instances
Continuation of previous commit.

Makes scanning Voto Serif GX fast again.
2018-03-31 19:19:36 +02:00
Behdad Esfahbod fa13f8835c Fix name scanning
In 161c738 I switched from linear name scanning to binary searching.
That, however, ignored the fact that there might be more than one
name table entry for each pair we want to query.

To fix that and retain bsearch, I now get all name entries first,
sort them, and use for bsearching.

This fixes https://bugs.freedesktop.org/show_bug.cgi?id=105756

This makes scaning Voto Serif GX twice slower though, since we are
creating and sorting the list for each instance. In the next commit,
I'll share this list across different instances to fix this.
2018-03-31 18:36:20 +02:00
Akira TAGOH 8c96285d21 Initialize an array explicitly
Patch from Kurt Kartaltepe
2018-03-02 13:30:00 +09:00
Behdad Esfahbod fd2ad1147a Fix undefined-behavior signed shifts 2018-01-09 11:03:31 +01:00
Behdad Esfahbod 94683a1255 Use FT_Done_MM_Var if available 2018-01-08 09:55:41 +00:00
Behdad Esfahbod 030e2e4e94 Fix leak 2018-01-05 14:33:41 +00:00
Behdad Esfahbod 37fb4a989e Support FC_WIDTH as double as well 2018-01-04 15:22:06 +00:00
Behdad Esfahbod 1fa9cb78c1 Remove hack for OS/2 weights 1..9 2018-01-04 15:22:06 +00:00
Akira TAGOH 767e3aa7c5 Fix compiler warnings 2018-01-04 20:37:26 +09:00
Behdad Esfahbod 706535e107 Add FcWeightTo/FromOpenTypeDouble()
No idea why I didn't add these as double to begin with.
2018-01-03 15:59:56 +00:00