On macs, some fonts can be in sub-folders of the font folder, and may
not properly be found. This fixes that to detect directories and make
the lookup recursive.
(Note: This commit also modified text-freetype2)
Prevents issues from being able to update files that may not be using
the current system encoding on windows.
(Note: This commit also modified text-freetype2)
The implementation of get_modified_timestamp() did not check the return
value of stat(), so in case the check fails the values in the stats
structure can be any garbage on the stack and the value of
stats.st_mtime can change on every call. This can trigger a reload of
the image every second, even if the file was not actually modified.
Closesjp9000/obs-studio#520
(Note: This commit also modifies obs-filters and text-freetype2)
This simplifies writing of effects. DrawMatrix is no longer necessary
because there are no sources that require drawing with a color matrix
other than async sources, and async sources are automatically processed
and don't defer their initial render stage to filters.
When using a text file with the source and the font face is changed, it
would cause it to fail to update the glyphs and text accordingly. It
would trigger an error jump at line 392 of text-freetype2.c, ultimately
resulting in the text to render garbled after that.
How to reproduce:
Set the source to get text from a file, then just change the font face
(but not the size or anything else).
When updating text from file periodically, newer glyphs that weren't
already cached would not end up being rendered. This fixes the issue by
calling cache_glyphs after the file has been updated.
How to reproduce the original issue:
Set a text-freetype2 source to load an english-only text file. Then
overwrite the text in the file with non-english characters. The
non-english characters will then fail to render.
Reported at https://obsproject.com/mantis/view.php?id=336Closesjp9000/obs-studio#481
This caches the font list data to a file to minimize load times. Font
data will be refreshed when any font files are added/removed, based upon
a checksum of the font file names and dates (if available).
API changed from:
obs_source_info::get_name(void)
obs_output_info::get_name(void)
obs_encoder_info::get_name(void)
obs_service_info::get_name(void)
API changed to:
obs_source_info::get_name(void *type_data)
obs_output_info::get_name(void *type_data)
obs_encoder_info::get_name(void *type_data)
obs_service_info::get_name(void *type_data)
This allows the type data to be used when getting the name of the
object (useful for plugin wrappers primarily).
NOTE: Though a parameter was added, this is backward-compatible with
older plugins due to calling convention. The new parameter will simply
be ignored by older plugins, and the stack (if used) will be cleaned up
by the caller.
Found via UBSan, actual (sample) error:
"plugins/text-freetype2/text-functionality.c:284:26: runtime error: left
shift of 194 by 24 places cannot be represented in type 'int'"
Fix bug 0000151: File loading not properly handled.
Link to bug: https://obsproject.com/mantis/view.php?id=151
A newly selected font is not loaded properly if "read from file" is
active without a valid file. Old error handling lead to random memory
being displayed.
Closes Pull Request #390
(message edited by Jim)
On windows, carriage return characters are used along with line feed
characters. When the carriage return is used, it's rendered as a space.
This removes carriage returns from strings before rendering them via
freetype.
Doing this in the expression will cause it to execute the function every
time the expression is evaluated, which is needless cycles wasted.
Instead, call wcslen before the loops begin.