Modify

Opened 19 months ago

Closed 18 months ago

Last modified 12 months ago

#21143 closed defect (fixed)

"Could not create font Sans"

Reported by: rickmastfan67 Owned by: team
Priority: minor Milestone: 21.07
Component: Core Version: latest
Keywords: svg font Cc: DevCharly, skyper, Klumbumbus

Description

Just happened to notice this error show up multiple times in the CL window when I updated my copy of JOSM (hadn't updated in a few days).

2021-07-20 02:28:31.077 INFO: Log level is at INFO (INFO, 800)
2021-07-20 02:28:34.120 INFO: Skipping plugin update after JOSM upgrade. Automatic update at startup is disabled.
2021-07-20 02:28:35.737 INFO: GET https://api.openstreetmap.org/api/0.6/user/details -> HTTP/1.1 200 (505 ms; 891 B)
2021-07-20 02:28:35.929 WARNING: Could not create font Sans
2021-07-20 02:28:35.937 WARNING: Could not create font Sans
2021-07-20 02:28:35.967 WARNING: Could not create font Sans
2021-07-20 02:28:35.985 WARNING: Could not create font Sans
2021-07-20 02:28:37.066 INFO: Obtained 82 Tag2Link rules from resource://META-INF/resources/webjars/tag2link/2021.3.21/index.json
2021-07-20 02:28:37.958 WARNING: Could not create font Sans
2021-07-20 02:28:37.959 WARNING: Could not create font Sans
2021-07-20 02:28:37.960 WARNING: Could not create font Sans
2021-07-20 02:28:37.961 WARNING: Could not create font Sans
2021-07-20 02:28:37.961 WARNING: Could not create font Sans
2021-07-20 02:28:37.962 WARNING: Could not create font Sans
2021-07-20 02:28:37.962 WARNING: Could not create font Sans
2021-07-20 02:28:37.963 WARNING: Could not create font Sans

So, I did some testing to find the possible regression window.

r18068 didn't have this error, but r18070 did have it. So, I'm guessing something in [18070] produced the error above.

URL:https://josm.openstreetmap.de/svn/trunk
Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b
Last:Changed Date: 2021-07-20 00:45:25 +0200 (Tue, 20 Jul 2021)
Build-Date:2021-07-20 01:31:02
Revision:18077
Relative:URL: ^/trunk

Identification: JOSM/1.5 (18077 en) Windows 7 64-Bit
OS Build number: Windows 7 Professional (7601)
Memory Usage: 511 MB / 1820 MB (388 MB allocated, but free)
Java version: 1.8.0_201-b09, Oracle Corporation, Java HotSpot(TM) 64-Bit Server VM
Look and Feel: com.sun.java.swing.plaf.windows.WindowsLookAndFeel
Screen: \Display0 1920×1080 (scaling 1.00×1.00)
Maximum Screen Size: 1920×1080
Best cursor sizes: 16×16→32×32, 32×32→32×32
System property file.encoding: Cp1252
System property sun.jnu.encoding: Cp1252
Locale info: en_US
Numbers with default locale: 1234567890 -> 1234567890

Plugins:
+ OpeningHoursEditor (35640)
+ buildings_tools (35756)
+ measurement (35640)
+ reverter (35732)
+ tageditor (35640)
+ turnlanes-tagging (288)
+ turnrestrictions (35640)
+ undelete (35640)
+ utilsplugin2 (35792)

Attachments (1)

kiosk.svg (20.6 KB) - added by stoecker 18 months ago.
Proposal to drop text from kiosk.svg icon (dropping useless text and converting NEWS to path)

Download all attachments as: .zip

Change History (45)

comment:1 Changed 19 months ago by Don-vip

Cc: DevCharly added
Keywords: svg font windows added

comment:2 Changed 19 months ago by Don-vip

Owner: changed from team to Don-vip
Status: newassigned

comment:3 Changed 19 months ago by Don-vip

Cc: skyper Klumbumbus added

svgSalamander font loading code in our old code base:
https://josm.openstreetmap.de/browser/josm/trunk/src/com/kitfox/svg/Text.java?rev=18069#L287

if (font == null)
{
    font = FontSystem.createFont("Serif", fontStyle, fontWeight, fontStyle);
}

svgSalamander font loading code in the new code base:
https://github.com/JFormDesigner/svgSalamander/blame/master/svg-core/src/main/java/com/kitfox/svg/Text.java#L297

if (font == null)
{
    Logger.getLogger(Text.class.getName()).log(Level.WARNING, "Could not create font " + fontFamily);
    font = FontSystem.createFont("Serif", fontStyle, fontWeight, fontSize);
}

I guess we need to check our SVG icons which use the font "Sans" and use another font.

comment:4 Changed 19 months ago by Don-vip

Milestone: 21.07
Owner: changed from Don-vip to team
Status: assignednew

comment:5 Changed 19 months ago by Don-vip

Component: CoreInternal preset

33 icons impacted:

$ find . -name "*.svg" | xargs grep "font-family:Sans" | cut -d':' -f1 | sort -u
./images/presets/health/clinic.svg
./images/presets/health/dentist.svg
./images/presets/health/doctors.svg
./images/presets/leisure/club.svg
./images/presets/misc/pipeline_marker.svg
./images/presets/office/accountant.svg
./images/presets/office/advertising_agency.svg
./images/presets/office/architect.svg
./images/presets/office/association.svg
./images/presets/office/diplomatic.svg
./images/presets/office/educational_institution.svg
./images/presets/office/employment_agency.svg
./images/presets/office/foundation.svg
./images/presets/office/government.svg
./images/presets/office/insurance.svg
./images/presets/office/it.svg
./images/presets/office/lawyer.svg
./images/presets/office/newspaper.svg
./images/presets/office/notary.svg
./images/presets/office/ong.svg
./images/presets/office/political_party.svg
./images/presets/office/private_company.svg
./images/presets/office/real_state.svg
./images/presets/office/religion.svg
./images/presets/office/research.svg
./images/presets/office/tax_advisor.svg
./images/presets/office/telecommunication.svg
./images/presets/social_facility/assisted_living.svg
./images/presets/social_facility/group_home.svg
./images/presets/social_facility/nursing_home.svg
./images/presets/social_facility/outreach.svg
./images/presets/social_facility/shelter.svg
./images/presets/transport/way/way_pedestrian.svg
Last edited 19 months ago by Don-vip (previous) (diff)

comment:6 Changed 19 months ago by Don-vip

Priority: normalminor

comment:7 Changed 19 months ago by skyper

It seems to depend on the operating system and/or the installed fonts. Actually, I prefer "Sans" over "Serif" as it is better readable, especially, if small.

Actually, I do not really understand why the font is involved here as many of these icons do not include letters.
Does removing font-family:Sans; from the style="" within the the svg file solve this?

comment:8 in reply to:  7 Changed 19 months ago by Don-vip

Replying to skyper:

Does removing font-family:Sans; from the style="" within the the svg file solve this?

Probably. We only have 80 icons out of 1212, with a "font-family" directive.

comment:9 Changed 19 months ago by skyper

By the way, inkscape changes the DPI from 90 to 96 which seems to be better for displaying on screens.

comment:10 Changed 19 months ago by Klumbumbus

Didn't we have that one font which is shipped with JOSM "Droid Sans"? So that's different from "Sans" I guess?

Does removing font-family:Sans; from the style="" within the the svg file solve this?

Yes we should start with that and see how much icons will be left.

comment:11 Changed 19 months ago by skyper

Oh, now I get the warnings, too. But not only "Sans" but also "Calibri" and "Bookman Old Style".

comment:12 Changed 19 months ago by skyper

Keywords: windows removed

comment:13 Changed 18 months ago by Klumbumbus

Owner: changed from team to Klumbumbus

comment:14 Changed 18 months ago by Klumbumbus

In 18083/josm:

see #21143 - Remove unneeded font properties in icons

comment:15 Changed 18 months ago by Klumbumbus

as first step r18083 addresses comment:5 except ./images/presets/misc/pipeline_marker.svg

comment:16 Changed 18 months ago by Klumbumbus

In 18084/josm:

see #21143 - Remove unneeded font properties in icons

comment:17 Changed 18 months ago by Klumbumbus

In 18085/josm:

see #21143 - Remove unneeded font properties in icons (addition to r18083)

comment:18 Changed 18 months ago by Klumbumbus

In 18086/josm:

see #17177, see #21143 - unify icon with the other 3

comment:19 Changed 18 months ago by Klumbumbus

In 18087/josm:

see #21143 - Remove unneeded font properties in icons

comment:20 Changed 18 months ago by Klumbumbus

In 18088/josm:

see #21143 - Remove unneeded font properties in icons

comment:21 Changed 18 months ago by Klumbumbus

These 12 icon with a font-family are left:

images\offline_osm_api.svg
images\data\imagery\osmbasedmap.svg
images\data\projection\Departements_Lambert4Zones.svg
images\data\projection\LambertCC9Zones.svg
images\presets\leisure\billboard.svg
images\presets\misc\angles.svg
images\presets\misc\pipeline_marker.svg
images\presets\service\internet_cafe.svg
images\presets\shop\kiosk.svg
images\presets\shop\lottery.svg
images\presets\sport\billiards.svg
images\presets\sport\volleyball.svg

How to proceed? I guess the only save to use fonts are DroidSans and DroidSans-Bold? What would be the font-family attribute for them? "DroidSans" ?

comment:22 Changed 18 months ago by rickmastfan67

Should the "text-*" & "letter-*" tags also be removed too since the there's no words in the files? I really only noticed those tags in the files edited in [18083] to be honest.

comment:23 Changed 18 months ago by Klumbumbus

For the files in r18083 I removed them in r18085. At least those where I was pretty sure that they are text attributes. Maybe some are left, but thats not such a big deal as they should be removed by the svgcleaner automatically during the build process.

comment:24 Changed 18 months ago by rickmastfan67

I missed that, my bad.

Changed 18 months ago by stoecker

Attachment: kiosk.svg added

Proposal to drop text from kiosk.svg icon (dropping useless text and converting NEWS to path)

comment:25 Changed 18 months ago by stoecker

In volleyball.svg the text probably can simply be dropped as well.

Last edited 18 months ago by stoecker (previous) (diff)

comment:26 Changed 18 months ago by Klumbumbus

(currently WIP by me)

Last edited 18 months ago by Klumbumbus (previous) (diff)

comment:27 Changed 18 months ago by Klumbumbus

In 18095/josm:

see #21143 - Convert text in images to paths or use font-family:'Droid Sans', small fixes in display of Departements_Lambert4Zones.svg

comment:28 Changed 18 months ago by Klumbumbus

Owner: changed from Klumbumbus to team

There are 4 icons with text elements left which use all Droid Sans as font now, so I guess this ticket is fixed for now.

images\data\projection\Departements_Lambert4Zones.svg
images\data\projection\LambertCC9Zones.svg
images\presets\misc\angles.svg
images\presets\misc\pipeline_marker.svg

The question is how to handle new icons? Only allow text if the font is Droid Sans in normal or bold?

comment:29 Changed 18 months ago by stoecker

If decided I can adapt the geticons.pl script to warn about unwanted things. Please tell me what I should detect then :-)

comment:30 Changed 18 months ago by Klumbumbus

btw, the osm icon (images\data\imagery\osmbasedmap.svg and images\offline_osm_api.svg) is not correctly displayed in JOSM, the shadow of the magnifier is a hard line. This can't be seen at 24px or smaller but is already visible at 48px.

comment:31 in reply to:  29 Changed 18 months ago by Don-vip

Replying to stoecker:

If decided I can adapt the geticons.pl script to warn about unwanted things. Please tell me what I should detect then :-)

  • If the script is able to parse SVG, any occurrence of a style= attribute with a value containing font- not set on a text tag is suspicious
  • otherwise, if the file contains font- but not <text, it should be enough to detect unneeded font properties

comment:32 Changed 18 months ago by Don-vip

Resolution: fixed
Status: newclosed

comment:33 Changed 18 months ago by stoecker

In 18115/josm:

add font-checks to geticons.pl, see #21143

comment:34 Changed 18 months ago by stoecker

One error remains:

> scripts/geticons.pl 
logo_macOS.png: Unused image.

comment:35 in reply to:  34 Changed 18 months ago by Don-vip

Replying to stoecker:

One error remains:

> scripts/geticons.pl 
logo_macOS.png: Unused image.

False positive? https://josm.openstreetmap.de/browser/josm/trunk/src/org/openstreetmap/josm/tools/PlatformHookOsx.java#L86

comment:36 Changed 18 months ago by Klumbumbus

Can we run geticons.pl automatically on Jenkins?

comment:37 Changed 18 months ago by stoecker

In 18117/josm:

fix icon detection, see #21143

comment:38 in reply to:  36 Changed 18 months ago by stoecker

Replying to Klumbumbus:

Can we run geticons.pl automatically on Jenkins?

It's already part of JOSM-Integration and creates a file icons.txt.

I have no idea were you get results of this. Vincent?

comment:39 Changed 18 months ago by Don-vip

Something must be broken, I thought to have integrated it but the logo_macOS error should have been reported for months. Looking into it.

comment:40 Changed 18 months ago by Don-vip

Yep, the check is run but the results are no longer reported, probably when related Jenkins plugins have been deprecated in favour of new ones, I forgot to scan this one:
https://josm.openstreetmap.de/jenkins/job/JOSM-Integration/ws/jdk/JDK8/icons.txt

comment:41 Changed 18 months ago by Don-vip

It should work now. The build should become unstable in case of issues reported by the script.

comment:42 Changed 18 months ago by Klumbumbus

Thx.

comment:43 Changed 18 months ago by Klumbumbus

Component: Internal presetCore

comment:44 Changed 12 months ago by anonymous

The change generates lots of console warnings in combination with the style Traffic Signs_DE (version 5.2020-10-09 tested), because the contained svgs make use of font-family directives trying to load exotic fonts like

  • 'DIN 1451 Mittelschrift'
  • 'HelveticaNeue LT 45 Light'
  • 'HelveticaNeue LT 75 Bold'

that might not be installed on a system running JOSM.

Since the style is not hosted here, it may be a good idea if someone opens a bug on the projects website to raise awareness of this problem.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.