| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit forces construction of cache values using only data
available in its companion keys. That ensures logical correctness:
keys are guaranteed to have all the necessary data, and prevents
accidental collisions.
Most fixes of cache logic correspond to minor problem
when rendering is done with double parameter but cache key stores
its approximate fixed-point representation. The only serious problem
is missing scale of clip drawing. Also this commit removes unused
scale parameters from glyph metrics cache key.
Due to missing scale clip shapes that differed only in scale
treated by cache system as identical. That can lead to incorrect reuse
of cached bitmap of different scale instead of correct one.
The only hack left is in glyph metrics cache with its
unicode >= VERTICAL_LOWER_BOUND check.
|
|
|
|
|
| |
Leading newlines are now rendered, but still incorrectly:
at full height rather than at half-height as required.
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Advantages over the old algorithm consist of the following.
* There are no glitches due to full cache clearing.
Items are arranged into linked list ordered by time of last use.
Only the oldest items get deleted at the clearing event.
* Each item now keeps track of number of references.
Referenced cache values are immune to clearing.
* Reduced amount of total cache memory for the same performance.
* Reduced number of memory allocations per cache item.
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
As pointed out in #198. This is certainly just a typo.
Fixes #198.
|
|
|
|
|
|
|
|
|
| |
As before, this does not add any build system support:
a config.h file and a project must still be manually created
(or the compiler can be run manually instead of using a project).
Signed-off-by: Grigori Goronzy <greg@kinoho.net>
Signed-off-by: Oleg Oshmyan <chortos@inbox.lv>
|
|
|
|
|
|
|
|
|
|
| |
This is more robust and simpler. The bearing calculations initially
were bugged, but getting rid of them completely seems better. It is
consistent with other text renderers as well. To simplify things, also
move striking before the additional scale is applied and get rid of the
half-pixel overlapping thing; it is not needed with additive blending.
Fixes #193.
|
|
|
|
|
|
|
|
| |
OS or platform-specific locale independent functions are painful to
use and/or not available, so roll our own. Not great but the least
painful and least intrusive.
v2: fix indexing, use static inline
|
|
|
|
| |
Bad things can happen otherwise. Found by coverity scan.
|
|
|
|
|
| |
The name is always pulled from the font info, which is static, so
there is no need to strdup.
|
|
|
|
|
| |
Apparently, libfreetype calls close_stream_font through the
FT_Stream.close callback.
|
|
|
|
|
|
|
|
|
| |
An earlier commit added this code to avoid adding font faces multiple
times. In this form, it breaks the "Trying all charmaps" fallback case,
which can lead to text being rendered as boxes.
Return the font that is going to contain the missing glyph instead. The
calling code will check again, and run the fallback if necessary.
|
|
|
|
|
|
|
|
|
|
|
| |
Up until now fontselect used the face index to identify which font to load
from a font collection. While this pretty convenient when using something
freetype based like fontconfig, it seems to be somewhat freetype specific.
CoreText uses the PostScript name as the unique identifier of a font. This
commit allows to use that instead of the index to decide which face to open
with FT_New_Face. To use the PostScript name the provider must return a -1
index and the PostScript name.
|
|
|
|
|
| |
This is faster in many cases, and more suitable for Windows' GetFontData
function.
|
|
|
|
|
| |
This is a bit nicer because we can actually see which physical font
has been selected for a certain logical font.
|
|
|
|
|
| |
Allow memory fonts with the get_face_data callback. This feature is
used for embedded fonts, but can be used by any font provider.
|
|
|
|
|
|
|
|
|
|
| |
fontconfig uses an unusual scale from 0-215 for the font weight. It
looks like it is somewhat derived from the typographic scale some font
families use, but is still rather nonstandard. Nowadays the TrueType
scale from 100-900 seems to be standard. CSS uses it, for example.
However, most importantly, VSFilter also uses the TrueType scale. So
let's use it in libass, too.
|
|
|
|
|
|
| |
Introduce a simple glyph coverage map (created when the font is added)
and use it for checking glyph coverage in font selection. This uses a
simple linear search at the moment.
|
|
|
|
|
|
| |
Introduce a unique ID per font face and check it in add_face to make
sure we never add a font face twice. This is useful in case the glyph
coverage report is unreliable.
|
|
|
|
|
|
|
| |
Implement a simple font sorter (FontSelector) and an interface to deal
with multiple font sources (FontProvider). Unfinished business,
but works for the most part. Currently the only implemented FontProvider
uses fontconfig.
|
| |
|
|
|
|
|
| |
HarfBuzz faces reference the FreeType faces. Destroying FT faces first can cause crash in HB destruction code:
https://bugs.freedesktop.org/show_bug.cgi?id=86300
|
| |
|
| |
|
|
|
|
| |
These were missing in several places. Fixes #50.
|
|
|
|
| |
Fixes libass#8.
|
|
|
|
|
|
|
|
|
|
|
| |
For whatever reason FT_Vector points[4] = { ... }; needs to come at the
beginning of a scope. Since that block was duplicated, just extract it
to a function.
This does not include buildsystem support, so actually compiling with
VC++ requires creating a project and supplying a config.h file.
Signed-off-by: wm4 <wm4@nowhere>
|
| |
|
|
|
|
|
|
|
|
| |
Some fonts stuff a signed, negative value into this unsigned
field. This usually causes very small and wrongly positioned
rendering. Also handle usWinAscent similarly, just in case.
Fixes issue #106.
|
|
|
|
|
|
|
|
|
|
|
|
| |
The first point in a countour is not allowed to be a cubic control
point, which is sometimes violated by blindly reversing a countour,
producing the following errors:
[ass] FT_Stroker_ParseOutline failed, error: 20
[ass] Failed to rasterize glyph: 1
To avoid this, let the first point remain the first
and only reverse the order of the remaining points.
|
|
|
|
|
|
|
|
|
|
|
|
| |
It is a bit crazy, but for vertical layout the sTypoAscender and
sTypoDescender fields of the OS/2 table are supposed to be used for
determining the size of the ideographic EM box [1], so that glyphs
can be centered on the baseline more neatly.
With this change, vertical layout should be completely equal to
VSFilter.
[1] http://www.microsoft.com/typography/otspec150/os2.htm#sta
|
|
|
|
|
| |
Make sure to use vertical advance under the right conditions -
vertical font selected, requested glyph is non-latin.
|
|
|
|
|
| |
Temporary fix for a crash when a font face doesn't actually contain
the glyph that fontconfig reports. Needs a real solution.
|
|
|
|
|
|
| |
The new revision of the stroker in FreeType doesn't like the way
contours are zero-filled to disable them. It's not particularly clean
anyway, so rewrite the whole outline instead.
|
| |
|
|
|
|
|
| |
Make sure to set the font size for every run, as needed, to get metrics
(advance/offset) for the right size.
|
|
|
|
|
|
| |
Add a new opaque data structure to store shaper-specific font data in
an ASS_Font. At the moment, this is used for caching HarfBuzz fonts,
to reduce allocation and font initialization overhead.
|
|
|
|
|
|
|
|
|
| |
This was introduced with commit e051ab. After re-evaluation, it
seems to be rather wrong. Windows appears to use the same ascender
as horizontal rendering, except for the first line. We don't have this
special handling of the first line, but apart from that, everything is
similar to Windows now. Verified with a couple of popular CJK fonts,
such as MS Mincho, Meiryo, etc.
|
|
|
|
|
|
|
|
| |
Split up text into runs with the same direction, font face and font
size, shape these runs with HarfBuzz and reorder accordingly.
This noticeably improves Arabic shaping and should make shaping for many
other scripts work. HarfBuzz also does kerning for Latin text.
|
|
|
|
|
|
|
|
|
|
|
| |
Split up ass_font_get_glyph into two functions: one function matches
checks the fonts for support of the requested codepoint and returns
a face_index and glyph_index to later load the glyph, with a second
function.
This approach is very useful for shaping, which needs to be done
on runs with the same font face and font size and changes the
glyph_index.
|
| |
|
|
|
|
|
|
|
|
|
| |
This introduces functions to use and copy pointered outline objects
easily and uses these instead of glyphs everywhere.
Previously the glyph cache was abused for caching vector clipping masks,
but this isn't possible anymore (nor desirable), thus vector clipping
cache has been disabled for the moment.
|
| |
|
|
|
|
|
|
|
|
| |
- less code, cleaner
- decoupled from ASS_Library
- better data encapsulation
- simpler interface
- avoids a nasty hack
|
|
|
|
|
|
|
|
| |
After font reselection, loop through all charmaps if no glyph can't be
found until we hopefully find one that works. If we get here at all, the
font is seriously broken, so this is unlikely to harm anything.
This improves the last resort charmap fallback introduced in 96057d.
|
|
|
|
|
|
| |
In hope to make libass as useful as possible, relicense libass to ISC, a
simplified 2-clause BSD license. All contributors who provided
non-trivial changes have granted their permission for this.
|
|
|
|
|
| |
The useless "if (foo) free(foo)" idiom is all over the place, just
get rid of it finally...
|
|
|
|
|
| |
strcasecmp/strncasecmp needs strings.h according to POSIX, so add this
include where these occur.
|
|
|
|
|
|
| |
If we're already after the font reselection stage and a glyph cannot be
found in a font, try again with the first charmap as a last resort.
This is needed for old "symbol" fonts, for example.
|
|
|
|
|
|
|
|
| |
Reverse "outside" contours with wrong winding correction, require
that a contour is "inside" for considering its removal; Move this
hack into ass_font.c, where it belongs.
Initial patch by uau.
|
|
|
|
| |
Partially reverts 162a735b6b2dba13022f96db42a3f153cf28033e.
|
|
|
|
|
|
| |
Extend the charmap selection heuristics to select the first Windows
charmap if no Unicode charmap is found.
Fixes one particular font, FGP楷書体NT-M, and possibly others.
|
|
|
|
|
|
|
|
| |
Store the real font face id instead of using 0 all the time and use the
real font face id for font lookup as well. This makes font attachments
with multiple faces work correctly.
Thanks to ubitux and uau!
|
| |
|
| |
|
|
|
|
| |
Might save a few cycles.
|
|
|
|
|
|
| |
GDI does not use vertical writing for glyphs below a certain unicode
codepoint.
To make this work correctly, refactor glyph transformations a bit.
|
|
|
|
|
| |
Calculate ascender for rotated glyphs from the maximum advance width.
Works OK usually, but screws up with fonts that miss this information.
|
|
|
|
|
|
| |
Do not skip '@' at the start of a font name in styles; detect '@' at
font name start and set a new attribute in ASS_Font accordingly.
Rotate affected glyphs after loading and calculate a suitable advance.
|
|
|
|
|
|
|
|
|
|
| |
Some (arguably) broken CJK fonts claim to have a fixed advance width,
but they actually use two different widths for half-width and full-width
characters. Even worse, some use proportional width.
This can cause problems under certain circumstances. A big project
(Cairo) uses a FreeType load flag to ignore the global advance width
for such fonts, so I assume it can be used safely. Let's do it just
like them.
|
|
|
|
|
| |
Get rid of compatibility #ifdefs and some code to support very old
versions of freetype. libass now requires at least version 2.2.1.
|
|
|
|
|
|
| |
Many fonts don't have a non-breaking space (NBSP) character and this
can cause problems when these glyphs are substituted. Render them
like a regular space.
|
|
|
|
|
|
| |
Exit early if no striking is needed; make sure to strike in reverse
direction for non-truetype font and use the usual return value
convention (0 == no errors).
|
|
|
|
|
|
|
| |
Fallback to embolden manually with FreeType in case a bold face was
requested, but no bold variant is available. The glyphs are slightly
emboldened (much less than FT_GlyphSlot_Embolden would do) and the
metrics are not touched at all.
|
|
|
|
|
|
| |
Rename all typedefs from the convention foo_bar_t, which can possibly
conflict with POSIX types, to FooBar (and ASS_FooBar for public
API typedefs). Fix formatting and stray comments while at it.
|