a closer look at fonts and font rendering system on opensuse

28
2014-10-17 A Closer Look at Fonts and Font Rendering System on openSUSE 1/30 A Closer Look at Fonts and Font Rendering System on openSUSE Fuminobu TAKEYAMA

Upload: fuminobu-takeyama

Post on 11-Jul-2015

1.199 views

Category:

Internet


1 download

TRANSCRIPT

Page 1: A Closer Look at Fonts and Font Rendering System on openSUSE

2014-10-17 A Closer Look at Fonts and Font Rendering System on openSUSE 1/30

A Closer Look atFonts and Font Rendering System

on openSUSE

Fuminobu TAKEYAMA

Page 2: A Closer Look at Fonts and Font Rendering System on openSUSE

2014-10-17 A Closer Look at Fonts and Font Rendering System on openSUSE 2/30

About Me

● TAKEYAMA, Fuminobu (武山 文信)– @ftake, Facebook: takeyamaf, G+: +FuminobuTakeyama– openSUSE M17N project maintainer

● Multilinguarization– One of admins of http://ja.opensuse.org/

● Talk about community activitiesin Japan tomorrow

Page 3: A Closer Look at Fonts and Font Rendering System on openSUSE

2014-10-17 A Closer Look at Fonts and Font Rendering System on openSUSE 3/30

Do you use a Linux desktop environment?

Page 4: A Closer Look at Fonts and Font Rendering System on openSUSE

2014-10-17 A Closer Look at Fonts and Font Rendering System on openSUSE 4/30

Font and font rendering are

● Important for Desktop environments● Sometimes troublesome for Chinese and Japanese users

– Because of the letters with complex structures

Page 5: A Closer Look at Fonts and Font Rendering System on openSUSE

2014-10-17 A Closer Look at Fonts and Font Rendering System on openSUSE 5/30

What is a font?

● Defines actual shapes of letters

Page 6: A Closer Look at Fonts and Font Rendering System on openSUSE

2014-10-17 A Closer Look at Fonts and Font Rendering System on openSUSE 6/30

Rendering letters with a font

● Draw letters on pixels

Page 7: A Closer Look at Fonts and Font Rendering System on openSUSE

2014-10-17 A Closer Look at Fonts and Font Rendering System on openSUSE 7/30

New CJK fonts by Adobe and Google

● Noto Sans Chinese/Japanese/Korean (Google)Source Han Sans (Adobe)

● 7 weight variations● Support new rendering engine provided by Adobe

Page 8: A Closer Look at Fonts and Font Rendering System on openSUSE

2014-10-17 A Closer Look at Fonts and Font Rendering System on openSUSE 8/30

New CJK fonts by Adobe and Google

to be available on openSUSE 13.2!though still problematic for GUI

Page 9: A Closer Look at Fonts and Font Rendering System on openSUSE

2014-10-17 A Closer Look at Fonts and Font Rendering System on openSUSE 9/30

Software for font rendering

● FreeType2– A library for rendering letters

● fontconfig– System for

● Searching fonts from your system● Specifying rendering parameters for FreeType2

Page 10: A Closer Look at Fonts and Font Rendering System on openSUSE

2014-10-17 A Closer Look at Fonts and Font Rendering System on openSUSE 10/30

Querying fonts with fontconfig 1/2

● command line interfaces: fc-match, fc-scan, ...● Query by a family name and attributes

$ fc-match "Noto Sans Japanese"NotoSansJP-Medium.otf: "Noto Sans Japanese" "Medium"

actual file name weight

$ fc-match "Noto Sans Japanese":weight=BoldNotoSansJP-Bold.otf: "Noto Sans Japanese" "Bold"

The actual file providing the bold font

Page 11: A Closer Look at Fonts and Font Rendering System on openSUSE

2014-10-17 A Closer Look at Fonts and Font Rendering System on openSUSE 11/30

Querying fonts with fontconfig 2/2

● Some fonts are just aliases– The actual font is determined by the locale, your settings, ...

$ fc-match "Monospace" migu-1m-regular.ttf: "Migu 1M" "Regular"

Monospace is an alias of Migu 1M (on my env.)

Page 12: A Closer Look at Fonts and Font Rendering System on openSUSE

2014-10-17 A Closer Look at Fonts and Font Rendering System on openSUSE 12/30

Another role of fontconfig

● Specifies rendering parameters for each font– Anti-aliasing– Hinting– Sub-pixel rendering

● Defined by files– /etc/fonts/*– ~/.config/fontconfig/*

Page 13: A Closer Look at Fonts and Font Rendering System on openSUSE

2014-10-17 A Closer Look at Fonts and Font Rendering System on openSUSE 13/30

Hinting

● Moves lines to fit pixels– Makes letters look clear

With hinting Without hinting

Page 14: A Closer Look at Fonts and Font Rendering System on openSUSE

2014-10-17 A Closer Look at Fonts and Font Rendering System on openSUSE 14/30

Hinting parameters for FreeType2

● Hinting engines– FreeType's auto hinter– Byte code interpreter for fonts with hinting instructions– “Adobe” for CFF fonts (including Noto Sans C/J/K)

● Hintstyle– None: just disable hinting– Slight: render with the auto hinter (slight mode)– Medium, Full: BCI or Adobe if available

● otherwise auto hinter (normal mode)

Page 15: A Closer Look at Fonts and Font Rendering System on openSUSE

2014-10-17 A Closer Look at Fonts and Font Rendering System on openSUSE 15/30

Inappropriate hintstyle 1/2

● Hinting is sometimes problematic ● “_” is not printed

disappear

With hintmedium

With hintnone

Page 16: A Closer Look at Fonts and Font Rendering System on openSUSE

2014-10-17 A Closer Look at Fonts and Font Rendering System on openSUSE 16/30

Inappropriate hintstyle 2/2

● Breaks some monospaced fonts

Deskto”p”

Publi”c”

Page 17: A Closer Look at Fonts and Font Rendering System on openSUSE

2014-10-17 A Closer Look at Fonts and Font Rendering System on openSUSE 17/30

Which is the best hintstyle?

● Different for each font– openSUSE's font packages set appropriate values

for problematic fonts– See: /etc/fonts/conf.d/*

● [10-19]-*.conf: openSUSE default option● [20-29]-*.conf: rendering options for each font

You should use packaged fonts!

Page 18: A Closer Look at Fonts and Font Rendering System on openSUSE

2014-10-17 A Closer Look at Fonts and Font Rendering System on openSUSE 18/30

The Kcontrol bug 1/3

● Bug 105797 - Changing fonts from Kcontrol will enable hinting and make it default. All this information it writes to ~/.fonts.conf

● Reported on– 2005-05-17

Page 19: A Closer Look at Fonts and Font Rendering System on openSUSE

2014-10-17 A Closer Look at Fonts and Font Rendering System on openSUSE 19/30

The Kcontrol bug 2/3

Page 20: A Closer Look at Fonts and Font Rendering System on openSUSE

2014-10-17 A Closer Look at Fonts and Font Rendering System on openSUSE 20/30

The Kcontrol bug 3/3

● Automatically saves settings enforcing hintmediumfor all fonts– Please remove ~/.config/fontconfig/* generated by this

● Resolved in 13.2– By “System default”

<?xml version='1.0'?><!DOCTYPE fontconfig SYSTEM 'fonts.dtd'><fontconfig> … snip … <match target="font"> <edit mode="assign" name="hintstyle"> <const>hintmedium</const> </edit> </match> … snip … </fontconfig>

Breaks some fonts

Page 21: A Closer Look at Fonts and Font Rendering System on openSUSE

2014-10-17 A Closer Look at Fonts and Font Rendering System on openSUSE 21/30

Not only KDE

● Exists on XFCE– Also on GNOME

Page 22: A Closer Look at Fonts and Font Rendering System on openSUSE

2014-10-17 A Closer Look at Fonts and Font Rendering System on openSUSE 22/30

Trouble shooting

● Check your rendering configuration by fc-match -v– The actual font name, hinting settings

$ fc-match -v Sans Pattern has 36 elts (size 48) family: "IPA Pゴシック"(s) "IPAPGothic"(s) familylang: "ja"(s) "en"(s) ** snip ** antialias: True(w) hintstyle: 2(i)(w) hinting: True(w) verticallayout: False(s) ** snip **

Page 23: A Closer Look at Fonts and Font Rendering System on openSUSE

2014-10-17 A Closer Look at Fonts and Font Rendering System on openSUSE 23/30

Infinality patch

● Unofficial patch improving FreeType2● Has been merged into FreeType2

– fontconfig settings from infinality is to be included by openSUSE 13.2

Page 24: A Closer Look at Fonts and Font Rendering System on openSUSE

2014-10-17 A Closer Look at Fonts and Font Rendering System on openSUSE 24/30

Sub-pixel rendering on openSUSE

● Improve resolution by using RGB sub-pixel of LCD● Disabled

– Because color filter algorithm is still patented● Need discussion

– if FreeType's color filter is reallycovered by the patent or not

Sub-pixel rendering by Windows ClearType

Page 25: A Closer Look at Fonts and Font Rendering System on openSUSE

2014-10-17 A Closer Look at Fonts and Font Rendering System on openSUSE 25/30

Development of font packages

● M17N:fonts on Open Build Service– https://build.opensuse.org/project/show/M17N:fonts– ML: [email protected]

● Everyone can join the development● Easy to develop

1. Branch a package from M17N:fonts2. Just update zip/tar.gz and write change log3. Build and test4. Submit your change to M17N:fonts

Page 26: A Closer Look at Fonts and Font Rendering System on openSUSE

2014-10-17 A Closer Look at Fonts and Font Rendering System on openSUSE 26/30

A font catalog

● http://fontinfo.opensuse.org/ By Petr Gajdos

1 click install

Page 27: A Closer Look at Fonts and Font Rendering System on openSUSE

2014-10-17 A Closer Look at Fonts and Font Rendering System on openSUSE 27/30

Ongoing issues

● Multi-weight font support– Fontconifg cannot query correctly

– Gtk also● The Adobe engine is disabled on some applications● Sub-pixel rendering

– Hinting engines seem to require it

$ fc-match "Noto Sans Japanese":weight=RegularNotoSansJP-DemiLight.otf: "Noto Sans Japanese" "DemiLight"

Page 28: A Closer Look at Fonts and Font Rendering System on openSUSE

2014-10-17 A Closer Look at Fonts and Font Rendering System on openSUSE 28/30

Conclusion

● FreeType2 and fontconfig– fc-match -v for trouble shooting and bug reports

● Hinting– Provides clear rendering or causes problems

● Need your help– Addressing ongoing issues– Packaging fonts with appropriate configurations

● Any questions?