Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1634394

Summary: font size jumps in large steps
Product: Red Hat Enterprise Linux 7 Reporter: Alois Treindl <alois>
Component: cairoAssignee: Benjamin Otte <otte>
Status: CLOSED WONTFIX QA Contact: Desktop QE <desktop-qa-list>
Severity: high Docs Contact:
Priority: unspecified    
Version: 7.5   
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-02-15 07:43:13 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
sample code ctest3.c none

Description Alois Treindl 2018-09-30 13:57:31 UTC
Created attachment 1488576 [details]
sample code ctest3.c

Description of problem:
font size cannot be increased in small steps, like 0.1 points. It jumps in large steps. The problem does not exist in RHEL6 with earlier cairo release, and it can be fixed by updating cairo to cair-1.14.12


Version-Release number of selected component (if applicable):
cairo-1.14.8-2.el7.x86_64


How reproducible:
via simple test program:


Steps to Reproduce:
1. compile test program ctest3.c
// sample code to demonstrate bug in cairo
#include <cairo.h>
#include <stdio.h>

static void measure(cairo_t *cr, char *s)
{
        cairo_text_extents_t exts;
        cairo_text_extents(cr, "Some text", &exts);

        printf("%s Size: %gx%g", s, exts.width, exts.height);
}

int main()
{
  int i;
  char t[80];
  double pt;

  // create PDF surfece
  cairo_surface_t *s = cairo_pdf_surface_create("test.pdf", 1000, 1000);
  cairo_t *cr = cairo_create(s);

  // set option CAIRO_HINT_METRICS_OFF
  // this steps is irrlevant for PDF surface, but to show same effect in
  // bitmap surface, it has to be included.
  cairo_font_options_t *opt = cairo_font_options_create();
  cairo_get_font_options(cr, opt);
  cairo_font_options_set_hint_metrics(opt, CAIRO_HINT_METRICS_OFF);
  cairo_set_font_options(cr, opt);

  // loop font size from 9.0 to 10.o pt in stepsof 0.1 pt
  for (i = 90; i <= 100; i++) {
    pt = i * 0.1;
    cairo_set_font_size(cr, pt);
    sprintf(t, "%.1lf pt\t", pt);
    measure(cr, t);
    printf("\n");
  }
  
  // cleanup
  cairo_font_options_destroy(opt);
  cairo_destroy(cr);
  cairo_surface_destroy(s);
  return 0;
}

2. run it
3. output
on RHEL7.5 with cairo-1.14.8 - font size varies only in large steps
9.0 pt	 Size: 45.4951x6.8125
9.1 pt	 Size: 45.4951x6.8125
9.2 pt	 Size: 45.4951x6.8125
9.3 pt	 Size: 45.4951x6.8125
9.4 pt	 Size: 45.4951x6.8125
9.5 pt	 Size: 50.5605x7.5625
9.6 pt	 Size: 50.5605x7.5625
9.7 pt	 Size: 50.5605x7.5625
9.8 pt	 Size: 50.5605x7.5625
9.9 pt	 Size: 50.5605x7.5625
10.0 pt	 Size: 50.5605x7.5625

on RHEL6.10 with cairo-1.10.2-1.el6.x86_64: fontsize varies correctly
9.0 pt	 Size: 45.4951x6.8125
9.1 pt	 Size: 45.9407x6.8125
9.2 pt	 Size: 46.4606x6.8125
9.3 pt	 Size: 46.9062x6.8125
9.4 pt	 Size: 47.426x6.8125
9.5 pt	 Size: 48.1841x7.5625
9.6 pt	 Size: 48.6297x7.5625
9.7 pt	 Size: 49.1496x7.5625
9.8 pt	 Size: 49.5951x7.5625
9.9 pt	 Size: 50.115x7.5625
10.0 pt	 Size: 50.5605x7.5625


Additional info:
When one downloads the latest stable release of cairo, cairo-1.14.12 from cairographics.org and compiles it, one can put the library into
/usr/lib64/libcairo.so.2.11400.12
and run ldconfig.

Then the bug is fixed, font size varies in small steps as it should:
9.0 pt	 Size: 45.4966x6.80713
9.1 pt	 Size: 46.0021x6.88276
9.2 pt	 Size: 46.5076x6.9584
9.3 pt	 Size: 47.0131x7.03403
9.4 pt	 Size: 47.5187x7.10967
9.5 pt	 Size: 48.0242x7.1853
9.6 pt	 Size: 48.5297x7.26094
9.7 pt	 Size: 49.0352x7.33657
9.8 pt	 Size: 49.5407x7.41221
9.9 pt	 Size: 50.0462x7.48784
10.0 pt	 Size: 50.5518x7.56348

My sample uses a PDF surface. The problem is the same for Postscript, bitmap or SVG surfaces. Bitmap surfaces need option CAIRO_HINT_METRICS_OFF, to demonstrate 
the problem. If metrics are ON, font size varies only by integer pixel steps

Comment 2 Alois Treindl 2018-09-30 14:00:18 UTC
Using different font backends like Freetype or Pango does not change the nature of the problem, even when the exact rendering glyph extents may change.

Comment 3 Alois Treindl 2018-10-05 09:08:27 UTC
Sadly, the workaround with library replacement by /usr/lib64/libcairo.so.2.11400.12  has other negative consequences.
Printing with pango fucks up in pango_shape() for strings which contain a combination of chinese characters an latin characters, like 
"的董事。程序使用PRolog和C"

This problem does no occur with cairo-1.14.8

Comment 6 RHEL Program Management 2021-02-15 07:43:13 UTC
After evaluating this issue, there are no plans to address it further or fix it in an upcoming release.  Therefore, it is being closed.  If plans change such that this issue will be fixed in an upcoming release, then the bug can be reopened.