[Fontconfig] Webdings and other MS symbol fonts don't display
Raimund Steger
rs at mytum.de
Thu May 14 03:32:00 PDT 2015
On 05/13/15 03:45, Behdad Esfahbod wrote:
> On 15-05-12 04:45 PM, Raimund Steger wrote:
>> since Windows still supports the latin character mapping as per the OpenType
>> recommendation cited
>
> I have a hard time finding what this refers to. Can you point it out please?
It's mentioned in one of the comments in bug 58641:
http://www.microsoft.com/typography/otspec/recom.htm
However, now that I've read it again, I have to say it's rather vague.
An excerpt:
"
Non-Standard (Symbol) Fonts
[...]
The 'cmap' subtable (platform 3, encoding 0) must use format 4. The
character codes should start at 0xF000, which is in the Private Use Area
of Unicode. It is suggested to derive the format 4 encodings by simply
adding 0xF000 to the format 0 (Macintosh) encodings.
Under Windows, only the first 224 characters of non-standard fonts will
be accessible: a space and up to 223 printing characters. It does not
matter where in user space these start, but 0xF020 is suggested. The
usFirstCharIndex and usLastCharIndex values in the 'OS/2' table would be
set based on the actual minimum and maximum character indices used.
"
With some creativity, this could be understood as:
* Windows looks up usFirstCharIndex (which is 0xf020 for WingDings)
* starting from there, the characters are exposed as a space (0x20) and
the 223 following codepoints
Anyway when I try rendering some text in WPF using WingDings I see that
the glyphs are accessible in two ways:
* old 8-bit codepoints (0x20..0xff)
* PUA codepoints (0xf020..0xf0ff)
See the attached sample.
At this point, I'm not even sure fontconfig-2.8.0 handled it the same
way. For example, 0xd7 (CP1252/Latin-1/Unicode multiplication sign)
displays the glyph "head2left" on Windows (half-filled arrow sign
pointing to the left). However, fontconfig-2.8.0 exposed that glyph at
0x25ca because it's the Unicode codepoint for the Mac Roman 0xd7
character, see the following line in 2.8.0's fcfreetype.c:
{ 0x25CA, 0xD7 }, /* LOZENGE */
It's quite a mess. I suspect that typical Mac and Windows programs of
the day simply exposed WingDings glyph indices as 8-bit codepoints one
after another starting at 0x20, and when users selected other fonts on
the respective platforms for such text, Mac and Windows would should
different glyphs but as long as the text was set to WingDings it didn't
matter.
I've tested a fontconfig hack just now where I put the Apple Roman
decoder back in but with a mapping table that simply maps identity (e.
g. 0xd7 -> 0xd7 and such) and seem to get the same glyphs now in
pango-view as with WPF. Although I suppose if there are applications out
there that translate Mac Roman on their own, these will probably never
display the high 8-bit characters of WingDings the way Windows does it
(and never did).
Raimund
--
Worringer Str 31 Duesseldorf 40211 DE home: <rs at mytum.de>
+49-179-2981632 icq 16845346 work: <rs at interface-ag.de>
-------------- next part --------------
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Threading;
/* This compiles with:
* %WINDIR%\Microsoft.NET\Framework\v3.5\msbuild.exe
* (SDK not needed) */
class TextBoxTest
{
static void OpenWin()
{
Window win = new Window();
win.Title = "WingDings Text";
StackPanel stackPanel = new StackPanel();
TextBox box = new TextBox();
box.FontSize = 24;
box.MinLines = 16;
box.FontFamily = new FontFamily("WingDings");
box.TextWrapping = TextWrapping.Wrap;
for (int i = 0; i < 224; i++)
{
box.Text += (char)(0x20 + i) + "" + (char)(0xf020 + i);
}
stackPanel.Children.Add(box);
win.Content = stackPanel;
win.ShowDialog();
}
static void Main(string[] args)
{
Thread t = new Thread(OpenWin);
t.SetApartmentState(ApartmentState.STA);
t.Start();
}
}
-------------- next part --------------
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Compile Include="TextBox.cs" />
</ItemGroup>
<Target Name="Build">
<Csc Sources="@(Compile)"/>
</Target>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildBinPath)\Microsoft.WinFX.targets" />
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
</ItemGroup>
</Project>
More information about the Fontconfig
mailing list