better handling of some fonts
fonts with very large overlapping edges copuld clip in `text`, see https://stackoverflow.com/a/49169747/894763
This commit is contained in:
parent
29e05dabaf
commit
878c77a035
|
@ -1,3 +1,6 @@
|
|||
12/3/18 started 8.6.4
|
||||
- better fitting of fonts with overhanging edges, thanks Adrià
|
||||
|
||||
12/2/18 started 8.6.3
|
||||
- use pkg-config to find libjpeg, if we can
|
||||
- better clean of output image in vips_image_write() fixes a crash
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
# also update the version number in the m4 macros below
|
||||
|
||||
AC_INIT([vips], [8.6.3], [vipsip@jiscmail.ac.uk])
|
||||
AC_INIT([vips], [8.6.4], [vipsip@jiscmail.ac.uk])
|
||||
# required for gobject-introspection
|
||||
AC_PREREQ(2.62)
|
||||
|
||||
|
@ -18,7 +18,7 @@ AC_CONFIG_MACRO_DIR([m4])
|
|||
# user-visible library versioning
|
||||
m4_define([vips_major_version], [8])
|
||||
m4_define([vips_minor_version], [6])
|
||||
m4_define([vips_micro_version], [3])
|
||||
m4_define([vips_micro_version], [4])
|
||||
m4_define([vips_version],
|
||||
[vips_major_version.vips_minor_version.vips_micro_version])
|
||||
|
||||
|
@ -38,7 +38,7 @@ VIPS_VERSION_STRING=$VIPS_VERSION-`date -u -r ChangeLog`
|
|||
# binary interface changes not backwards compatible?: reset age to 0
|
||||
|
||||
LIBRARY_CURRENT=50
|
||||
LIBRARY_REVISION=2
|
||||
LIBRARY_REVISION=3
|
||||
LIBRARY_AGE=8
|
||||
|
||||
# patched into include/vips/version.h
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
* - don't set "font" if unset, it breaks caching
|
||||
* 16/7/17 gargsms
|
||||
* - implement auto fitting of text inside bounds
|
||||
* 12/3/18
|
||||
* - better fitting of fonts with overhanging edges, thanks Adrià
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -160,6 +162,7 @@ text_layout_new( PangoContext *context,
|
|||
static int
|
||||
vips_text_get_extents( VipsText *text, VipsRect *extents )
|
||||
{
|
||||
PangoRectangle ink_rect;
|
||||
PangoRectangle logical_rect;
|
||||
|
||||
pango_ft2_font_map_set_resolution(
|
||||
|
@ -172,11 +175,13 @@ vips_text_get_extents( VipsText *text, VipsRect *extents )
|
|||
text->width, text->spacing, text->align )) )
|
||||
return( -1 );
|
||||
|
||||
pango_layout_get_extents( text->layout, NULL, &logical_rect );
|
||||
extents->left = PANGO_PIXELS( logical_rect.x );
|
||||
extents->top = PANGO_PIXELS( logical_rect.y );
|
||||
extents->width = PANGO_PIXELS( logical_rect.width );
|
||||
extents->height = PANGO_PIXELS( logical_rect.height );
|
||||
pango_layout_get_pixel_extents( text->layout,
|
||||
&ink_rect, &logical_rect );
|
||||
|
||||
extents->left = ink_rect.x;
|
||||
extents->top = ink_rect.y;
|
||||
extents->width = ink_rect.width;
|
||||
extents->height = ink_rect.height;
|
||||
|
||||
#ifdef DEBUG
|
||||
printf( "vips_text_get_extents: dpi = %d, "
|
||||
|
@ -367,11 +372,8 @@ vips_text_build( VipsObject *object )
|
|||
memset( text->bitmap.buffer, 0x00,
|
||||
text->bitmap.pitch * text->bitmap.rows );
|
||||
|
||||
if( pango_layout_get_width( text->layout ) != -1 )
|
||||
pango_ft2_render_layout( &text->bitmap, text->layout,
|
||||
-extents.left, -extents.top );
|
||||
else
|
||||
pango_ft2_render_layout( &text->bitmap, text->layout, 0, 0 );
|
||||
pango_ft2_render_layout( &text->bitmap, text->layout,
|
||||
-extents.left, -extents.top );
|
||||
|
||||
g_mutex_unlock( vips_text_lock );
|
||||
|
||||
|
|
Loading…
Reference in New Issue