pangocairo:: rendered text is top-clipped under cairo scaling (version 1.48.4)
Environment:
- Windows 10 Pro (OS Build 19041.928) (64bit OS, x64 based CPU)
- Visual Studio 2015 Update 3
- pango-cairo (version 1.48.4)
- built with meson build
When text is drawn together with cairo scaling, the rendered text will be top-clipped, under certain font size, like the following screenshot:
Following cases are tested to have problem:
- Font size 12, Scaling 0.5
- Font size 15, Scaling 0.5
- Font size 17, Scaling 0.5
- Font size 21, Scaling 0.5 ...
We reproduce the issue using pango-view
Steps to reproduce:
- download pango source codes (version 1.48.4)
- modify
<pango source codes directory>/subprojects/glib.wrap
, changerevision=master
torevision=2.66.8
, to avoidroapi
building issue - meson build with command
meson _build64 --buildtype=debug --backend=vs --wrap-mode=forcefallback --prefix="<pango source codes directory>\..\pango_build_debug\x64"
- open the visual studio solution file in
<pango source codes directory>/_build64
- go to project
pango-view
, modify codes inviewer-pangocairo.c
(path /utils/viewer-pangocairo.c), line 319, inside the following function, replace the line 319 like following
static void
render_callback (PangoLayout *layout,
int x,
int y,
gpointer context,
gpointer state)
{
...
cairo_save(cr);
cairo_scale(cr, 0.5, 0.5);
pango_cairo_update_layout(cr, layout);
pango_cairo_show_layout (cr, layout); // line 319 origin code
cairo_restore(cr);
...
}
- build solution
- build project
RUN_INSTALL
- go to
pango-view.exe
folder, which is under<pango source codes directory>\..\pango_build_debug\x64
, create testing filetest.txt
with contentWpJKTgZ
- run
pango-view
with param--backend=cairo --font="Segoe UI 21" --hinting=full --output=result.png --no-display test.txt
- check the rendering in file
result.png