[tbb-bugs] #13313 [Tor Browser]: Enable bundled fonts in Tor Browser
Tor Bug Tracker & Wiki
blackhole at torproject.org
Mon Jan 5 07:39:14 UTC 2015
#13313: Enable bundled fonts in Tor Browser
-----------------------------+----------------------
Reporter: dcf | Owner: tbb-team
Type: enhancement | Status: new
Priority: normal | Milestone:
Component: Tor Browser | Version:
Resolution: | Keywords:
Actual Points: | Parent ID:
Points: |
-----------------------------+----------------------
Comment (by dcf):
I started looking at Firefox changes to disable system fonts and use only
bundled fonts. comment:1 shows that it's easy to do on linux with
fonts.conf. It remains to do it on other platforms.
I started by trying to disable system fonts for DirectWrite. DirectWrite
is one of two font rendering APIs used on Windows (the other is GDI). It
doesn't quite work yet. The system fonts are not loaded, and bundled fonts
are loaded. But all text is rendered as squares, even in browser
chrome—except, curiously, Georgian text. It seems that for whatever reason
the only font displayed by default is Droid Sans Georgian, even though you
can select others from the Content menu. More on that below.
This is the code I tried, my fonts branch of tor-browser-bundle.git, and a
patch against tor-browser.git. The tor-browser.git patch is
[https://bugzilla.mozilla.org/show_bug.cgi?id=998844 Mozilla #998844] (for
--enable-bundled-fonts), plus a dummy loader for system fonts in the
DirectWrite renderer.
* https://gitweb.torproject.org/user/dcf/tor-browser-
bundle.git/log/?h=fonts&id=tbb-4.5-alpha-2-fonts-1
* attachment:4.5-alpha-2-fonts-1.patch (applies to
[https://gitweb.torproject.org/tor-browser.git/log/?id=tor-
browser-31.3.0esr-4.5-1-build1&h=tor-browser-31.3.0esr-4.5-1 tor-
browser-31.3.0esr-4.5-1-build1])
I had to set
gfx.font_rendering.directwrite.enabled=true
and restart in order to enable DirectWrite. (Running in KVM, about:support
says "Direct2D Enabled: Blocked for your graphics card because of
unresolved driver issues." and "DirectWrite Enabled: false
(6.2.9200.16581)".)
Here's what it looks like:
[[Image(droid-sans-georgian-4.5-alpha-2-fonts-1.png)]]
Almost everything is rendered as boxes, except for the Georgian text. I
copy-pasted from the Fonts panel in the Inspector into a text editor,
which shows that the "Droid Sans Georgian" font is being used. However, if
I go into the Content menu, I can select Droid Sans (by looking for the
right pattern of boxes, "▯▯▯▯▯ ▯▯▯▯"), and then the Latin text shows up
properly (not on the Wikipedia page, but on other pages).
If I delete fonts/DroidSansGeorgian.ttf, then the font that gets loaded is
instead Lohit Oriya, and is similarly broken. The shape of the boxes in
Lohit Oriya have a noticeably different shape. Perhaps the fonts selection
governed by ordering in an internal hash table or something.
I turn on fontlist logging with
{{{
set NSPR_LOG_MODULES=fontlist:5
cd Browser
firefox.exe -console
}}}
and I see this on the console:
{{{
0[1197208]: (fontlist-postscript) name: Droid Sans Georgian Regular,
psname: Droid SansGeorgian
0[1197208]: (fontlist-fullname) name: Droid Sans Georgian Regular,
fullname: Droid Sans Georgian
0[1197208]: (fontlist) added (Droid Sans Georgian Regular) to family
(Droid Sans Georgian) with style: normal weight: 400 stretch: 0 psname:
DroidSansGeorgian fullname: Droid Sans Georgian
0[1197208]: (fontlist) added (Droid Sans Georgian Bold) to family (Droid
Sans Georgian) with style: normal weight: 700 stretch: 0 psname:
DroidSansGeorgian fullname: Droid Sans Georgian
0[1197208]: (fontlist-cmap) name: Droid Sans Georgian Bold, size: 304
hash: 29410df0 new
0[1197208]: (fontlist-cmap) name: Droid Sans Georgian Regular, size: 1880
hash:54f67428 new
}}}
a few seconds later, while it's sitting at the about:tor screen, I see it
load the rest of the fonts. The full log is in attachment:fontlist.log.
(However, note that only Droid Sans Georgian has fontlist-cmap lines.)
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/13313#comment:3>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
More information about the tbb-bugs
mailing list