Skip to content
This repository has been archived by the owner on Nov 10, 2018. It is now read-only.

Monospace fallback incorrect in Chrome with recommended font.conf #16

Closed
13rac1 opened this issue Mar 13, 2016 · 6 comments
Closed

Monospace fallback incorrect in Chrome with recommended font.conf #16

13rac1 opened this issue Mar 13, 2016 · 6 comments

Comments

@13rac1
Copy link
Owner

13rac1 commented Mar 13, 2016

Chrome using a Serif font

Chrome uses a serif font to display monospace text when Emoji One Color is set as the default monospace font. It should use the next monospace font.

This is the correct display when the modified config is disabled making DejaVu Sans Mono the default:
Chrome with DejaVu Mono

@13rac1 13rac1 added the bug label Mar 13, 2016
@13rac1 13rac1 self-assigned this Mar 13, 2016
@13rac1
Copy link
Owner Author

13rac1 commented Mar 13, 2016

The emoji characters which need to be overridden are only in DejaVu Sans, they do not appear in DejaVu Serif or DejaVu Mono according to my tests with the fc-search-codepoint.py script from: http://unix.stackexchange.com/a/268286/157461

$ python fc-search-codepoint.py 😀
/usr/share/fonts/truetype/dejavu/DejaVuSansCondensed-BoldOblique.ttf
/usr/share/fonts/truetype/dejavu/DejaVuSans-BoldOblique.ttf
/usr/share/fonts/truetype/ttf-dejavu/DejaVuSansCondensed-Bold.ttf
/usr/share/fonts/truetype/ttf-dejavu/DejaVuSansCondensed-Oblique.ttf
/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-Bold.ttf
/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf
/usr/share/fonts/truetype/ttf-ancient-scripts/Symbola605.ttf
/usr/share/fonts/truetype/ttf-dejavu/DejaVuSansCondensed.ttf
/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf
/usr/share/fonts/truetype/ttf-dejavu/DejaVuSansCondensed-BoldOblique.ttf
/usr/share/fonts/truetype/dejavu/DejaVuSansCondensed-Oblique.ttf
/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf
/usr/share/fonts/truetype/dejavu/DejaVuSansCondensed.ttf
/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-BoldOblique.ttf
/usr/share/fonts/truetype/dejavu/DejaVuSans-Oblique.ttf
/home/user/.local/share/fonts/TwitterColorEmoji-SVGinOT.ttf
/home/user/.local/share/fonts/EmojiOneColor-SVGinOT.ttf
/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-Oblique.ttf
/usr/share/fonts/truetype/dejavu/DejaVuSansCondensed-Bold.ttf

@13rac1
Copy link
Owner Author

13rac1 commented Mar 13, 2016

Ok, this updated fonts.conf gives priority to DejaVu Serif and Mono:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">

<fontconfig>
  <!--
  Make Emoji One Color the fallback font for sans-serif, serif, and
  monospace, but give priority to the DejaVu serif/monospace fonts
  since they do not contain any emoji.
  Override any specific requests for Apple Color Emoji.
  -->
  <match>
    <test name="family"><string>sans-serif</string></test>
    <edit name="family" mode="prepend" binding="strong">
      <string>Emoji One Color</string>
    </edit>
  </match>
  <match>
    <test name="family"><string>serif</string></test>
    <edit name="family" mode="prepend" binding="strong">
      <string>DejaVu Serif</string>
      <string>Emoji One Color</string>
    </edit>
  </match>
  <match>
    <test name="family"><string>monospace</string></test>
    <edit name="family" mode="prepend" binding="strong">
      <string>DejaVu Sans Mono</string>
      <string>Emoji One Color</string>
    </edit>
  </match>
  <match>
    <test name="family"><string>Apple Color Emoji</string></test>
    <edit name="family" mode="prepend" binding="strong">
      <string>Emoji One Color</string>
    </edit>
  </match>
</fontconfig>

Should fix the issue. I'm going to leave this in place a while to see if it causes any problems on my machine.

Test before and after with: https://raw.githubusercontent.com/eosrei/emojione-color-font/master/full-demo.html

Any other testers appreciated!

@13rac1 13rac1 added this to the v1.0 milestone Mar 13, 2016
@13rac1 13rac1 changed the title Monospace fall back broken in Chrome with recommended font.conf Monospace fallback incorrect in Chrome with recommended font.conf Mar 13, 2016
@13rac1
Copy link
Owner Author

13rac1 commented Mar 13, 2016

😭 There are a few characters in DejaVuSerif and DejaVu Sans Mono too. Not many, but I need to change them also.

@13rac1
Copy link
Owner Author

13rac1 commented Mar 13, 2016

Giving priority to DejaVu Serif or Mono won't fix this issue. I'm closing it to defer to the actual solution/workaround in #17

@13rac1 13rac1 closed this as completed Mar 13, 2016
13rac1 added a commit that referenced this issue Mar 17, 2016
The DejaVu font family is based on the Bitstream Vera font family to provide
greater unicode coverage. The only way to override the emoji it includes is
to make the emoji font the primary system font. This shouldn't be a problem,
but a number of programs do not correctly use font fallback resulting in font
rendering errors everywhere: #1, #5, #16, #18, #19.

This font.conf makes Bitstream Vera the default font for Serif, Sans-Serif,
and Monospace font requests since it does not contain any Unicode Emoji
characters. Emoji One Color font is the first fallback, followed by DejaVu
to provide everything else.

Test with:
fc-match -s serif
fc-match -s sans-serif
fc-match -s monospace

May be the solution for #17
@0matgal0
Copy link

A good workaround is to actually spoof the EmojiOne as Segoe UI Emoji. A lot of pages with emoji put Segoe in their CSS. Here how getemoji.com looks like with segoe installed:

image

As you can see no dejavu here.

@13rac1
Copy link
Owner Author

13rac1 commented Apr 23, 2017

Yes, that's the method used in the provided font config https://github.com/eosrei/emojione-color-font/blob/master/linux/fontconfig/56-emojione-color.conf#L135

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants