Bug 1216604

Summary: [Build 20231025] graphicsMagick: config file references ghostscript fonts - but does not trigger installation
Product: [openSUSE] openSUSE Tumbleweed Reporter: Dominique Leuenberger <dimstar>
Component: OtherAssignee: Petr Gajdos <pgajdos>
Status: RESOLVED FIXED QA Contact: E-mail List <qa-bugs>
Severity: Normal    
Priority: P5 - None CC: ana.guerrero, stefan.bruens
Version: Current   
Target Milestone: ---   
Hardware: Other   
OS: Other   
URL: https://openqa.opensuse.org/tests/3676006/modules/graphicsMagick/steps/17
Whiteboard:
Found By: openQA Services Priority:
Business Priority: Blocker: Yes
Marketing QA Status: --- IT Deployment: ---

Description Dominique Leuenberger 2023-10-26 09:34:02 UTC
## Observation

The patterns-fonts has recently been changed to be leaner (https://build.opensuse.org/request/show/1119761), which in turn triggers a failure in openQA in the graphicsMagick test

openQA test in scenario opensuse-Tumbleweed-DVD-x86_64-gnome@64bit fails in
[graphicsMagick](https://openqa.opensuse.org/tests/3676006/modules/graphicsMagick/steps/17)

The test itself calls:

gm convert -fill red -draw 'text 0,20 "TEST"' black.png output.png

While analyzing the issue, I stumbled across the GraphicsMagick config file
  /usr/lib64/GraphicsMagick-1.3.42/config/type-ghostscript.mgk


This file contains blocks like
  <type
    name="Helvetica"
    fullname="Helvetica Regular"
    family="Helvetica"
    foundry="URW"
    weight="400"
    style="normal"
    stretch="normal"
    format="type1"
    metrics="/usr/share/ghostscript/fonts/n019003l.afm"
    glyphs="/usr/share/ghostscript/fonts/n019003l.pfb"
    />
  <type

But the package installing this config file does not require (or at least recommend) the package containing the font files - which leads to this error now.


## Test suite description
Revert schedule to working settings - dleuenberger, 20211117


## Reproducible

Fails since (at least) Build [20231024](https://openqa.opensuse.org/tests/3671624)


## Expected result

Last good: [20231023](https://openqa.opensuse.org/tests/3668929) (or more recent)


## Further details

Always latest result in this scenario: [latest](https://openqa.opensuse.org/tests/latest?arch=x86_64&distri=opensuse&flavor=DVD&machine=64bit&test=gnome&version=Tumbleweed)
Comment 1 OBSbugzilla Bot 2023-10-26 18:35:02 UTC
This is an autogenerated message for OBS integration:
This bug (1216604) was mentioned in
https://build.opensuse.org/request/show/1120618 Factory / GraphicsMagick
Comment 2 Stefan Brüns 2023-10-31 01:03:35 UTC
Isn't this going in circles if the default removes the dependency, and graphicsmagick then pulls the fonts in again?

Helvetica (the default font family for GM) is not actually required, neither for most compositing or conversion operations, nor for text annotations in general.

You can use any Truetype font with GM, as long as you specify the full path:

$> gm convert   -size 320x240 -fill red   -draw 'font "/usr/share/fonts/truetype/Hack-Regular.ttf";text 0,20 "TEST"'  xc:black  output.png

/or/

$> gm convert   -size 320x240 -fill red   -font /usr/share/fonts/truetype/Hack-Regular.ttf -draw 'text 0,20 "TEST"'  xc:black  output.png


If the OBS test case requires a specific font, the font should be installed by the test case.

A recommends for the font may be in order, but forcing it on everyone who installs e.g. inkscape is not a good idea.
Comment 3 Petr Gajdos 2024-01-26 13:21:41 UTC
Hello Stefan,

in case ghostscript-fonts-std is not installed:

$ gm convert -fill red -draw 'text 0,20 "TEST"' black.png output.png
gm convert: Unable to read font (/usr/share/ghostscript/fonts/n019003l.pfb).
$

It seems that, with current config, the font file above is required, even if not in all usages, yes.

Is there a way to do config such that we would get rid of ghostscript fonts entirely? Will try to figure out, in case anyone see that immediately.
Comment 4 Petr Gajdos 2024-01-26 14:34:24 UTC
Perhaps we could introduce type-dejavu.mgk for example?
Comment 5 Stefan Brüns 2024-01-26 23:54:00 UTC
(In reply to Petr Gajdos from comment #3)
> Hello Stefan,
> 
> in case ghostscript-fonts-std is not installed:
> 
> $ gm convert -fill red -draw 'text 0,20 "TEST"' black.png output.png
> gm convert: Unable to read font (/usr/share/ghostscript/fonts/n019003l.pfb).
> $
> 
> It seems that, with current config, the font file above is required, even if
> not in all usages, yes.

I think "not in all usages" is putting more weight after it than actually true. The ghostscript font is required if and only if you want to impose a text stamp. For *all other* usages, format conversion, scaling, composing, etc, the fonts are *not* necessary.

Thus my recommendation to just "recommend" the fonts, without a hard dependency.

> Is there a way to do config such that we would get rid of ghostscript fonts
> entirely? Will try to figure out, in case anyone see that immediately.

Maybe its sufficient to add a matching config, but not sure.
Comment 6 Petr Gajdos 2024-01-29 10:19:02 UTC
(In reply to Stefan Brüns from comment #5)
> Thus my recommendation to just "recommend" the fonts, without a hard
> dependency.

Ok, let's choose this way. In case of complaints we can consider the below as option B.

https://build.opensuse.org/request/show/1142213

> > Is there a way to do config such that we would get rid of ghostscript fonts
> > entirely? Will try to figure out, in case anyone see that immediately.
> 
> Maybe its sufficient to add a matching config, but not sure.