The new font loading functions introduced in
544e62ac41 assume that popen() returns
NULL when fc-match is unavailable or fails. This is incorrect, since
popen() will always start a shell to run the passed command and return a
stream to that shell's stdin and stdout.
This results in an non-null but empty font name being passed to
FT_New_Face(), which fails.
This commit fixes this by also using the fallback font when the font
path read from the popen() stream is empty.
Fixes#239
Fixes regression caused by 544e62ac41
The freetype plugin correctly doubles the DPI on hidpi displays,
but fails to account for the doubled pixels in display's pixel buffer.
This commit adds a factor of 2 to the size and positioncomputations,
to hopefully fix a row stride and a positioning bug.
There's currently this function, set_font_with_fallback, that
almost always gets called with a NULL first argument in the
initramfs, forcing the _with_fallback part of the function to
run.
It's a little strange to have a function with a chunk of code that
hardly ever runs. Furthermore there's a bug where the error variable
is left uninitialized in this case leading to the freetype plugin
sporadically failing to load the fallback font.
This commit reworks things to drop set_font_with_fallback, and just
call FT_New_Face directly in the caller. Fallbacks are handled
at the point where the font path is determined
(previously called query_fc_match, now called find_default_font_path.
There are a few issues with the remove_hexboxes_from_pango_layout
function, where it's getting offsets wrong and things like that.
This commit changes the approach entirely. Rather than modifying
the text to remove characters without font converage, it just
changes out the glyphs for those characters to be white boxes.
We don't need to flush the terminal input buffer on key events from
the renderers, because the terminal does that itself.
Also, we should disable the terminal input when a /dev/input
device is added instead of relying on it happening the next flush
period.
Finally, we should make sure the terminal gets reenabled on close,
just so we clean up after ourselves.
If code calls ply_label_get_width without ply_label_show or some other
call that forces the dimensions to be computed first, then the returned
width will be wrong.
This commit makes the freetype plugin look more like the pango plugin
where the size will computed on demand when querying the width, if
necessary.
pango will give a height that's several orders of magnitude too
big sometimes when the width is -1.
This commit checks for -1, explicitly measures the width first, and
remeasures with that width passed in to compute the height.
There are still a number of places in the code where a console
viewer is expected, when it's totally possible that there won't
be one.
This commit runs through them, and does a few other style
cleanups on the way.
There are still a number of places in the code where a console
viewer is expected, when it's totally possible that there won't
be one.
This commit runs through them, and does a few other style
cleanups on the way.
There are still a number of places in the code where a console
viewer is expected, when it's totally possible that there won't
be one.
This commit runs through them, and does a few other style
cleanups on the way.
The freetype plugin was calling printf instead of ply-trace when
a font failed to load. Also, it didnt list the failure reason.
This commit fixes things up a bit.
The splash plugins don't create a console viewer if
`plymouth.prefer-fbcon` is on the kernel command line, but expect it
to be not NULL regardless.
This commit corrects that misconception.
Recent changes to the freetype plugin made it quite buggy. There
was an infinite loop bug, and also a failure in metrics handling.
There's also a number of outstanding issues:
1. Kerning is not properly applied
2. hidpi displays don't render correctly
Rather than try to tackle all of these problems in a peicemeal way,
this commit substantially reworks the code.
It introduces a ply_freetype_unit_t type for more clearly managing
the fixed point math freetype requires. This type relies on less
than well defined compiler behavior, however, so it may cause issues
down the road.
It consolidates measuring and drawing code to one function, since in
both cases, the same computation needs to happen, and they had
slightly divergent implementations before.
It consolidates font loading code, so we don't end up with two
different font face loading routines, with different dpi values.
It also changes the names of some variables to be clearer in my
mind (like changing the loaded glyph to the name "glyph" instead
of the name "slot")
At the moment injecting data into a console viewer involves calling
ply_console_viewer_parse_lines.
This name isn't optimal, since the data getting injected might not
be a full line at all.
This commit renames it to ply_console_viewer_write, and also adds
a ply_console_viewer_print that adds a printf like function for
convenience.
There are a few files missing #include <config.h>.
That is bad since it means those files don't get debug tracing.
This commit eliminates the pitfall by making sure the file is
included implicitly
Now that the ply-label interface supports rich text, we need to
implement it in the plugins.
This commit changes the freetype plugin to process
rich text in a rudimentary way that picks up colors, but not other
style attributes.
Based on initial work from nerdopolis
The plugin currently assumes all characters are 7 byte ascii.
This commit just adds a mbrtowc call around the text to
handle UTF-8 text somewhat better.