Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Typography in general and fonts in particular are a fairly complex topic I'm not really into. That said here's what I've figured from <a href="http://msdn.microsoft.com/en-us/library/ms742190.aspx" rel="nofollow noreferrer">Typography in Windows Presentation Foundation</a> and related MSDN documentation:</p> <ul> <li>Text is rendered by means of a text rendering pipeline (see link above for a diagram).</li> <li>WPF facilitates OpenType as an extension of the TrueType font format. <ul> <li>The <a href="http://msdn.microsoft.com/en-us/library/system.windows.documents.typography.aspx" rel="nofollow noreferrer"><code>Typography</code></a> object exposes many of the advanced features of OpenType fonts.</li> </ul></li> <li>An important low level text rendering concept is the <code>Glyphs</code> element, see MSDN <a href="http://msdn.microsoft.com/en-us/library/ms748985.aspx" rel="nofollow noreferrer">introduction</a>.</li> </ul> <p>If you look at the mentioned text rendering pipeline diagram you'll notice that while glyphs are the building blocks they may be acted upon in various ways (filtered/transformed/...) before finally getting displayed on a particular medium, e.g. a screen or a printer; one example would be applying ClearType for LCD screens. However, as usually with pipelining concepts, those transformations are more ore less optional in general.</p> <p>Now, depending on your application requirements, this might already yield a solution. If you don't really need a TextBox you might as well just use Glyphs in itself like so:</p> <pre><code>&lt;Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" &gt; &lt;Grid&gt; &lt;TextBox Text="TextBox: 1234567890" FontFamily="Scramble" FontSize="12" /&gt; &lt;Glyphs UnicodeString="Glyphs: 1234567890" FontUri="C:\WINDOWS\Fonts\Scramble.TTF" FontRenderingEmSize="12" Fill="Black" OriginX="5" OriginY="32"/&gt; &lt;/Grid&gt; &lt;/Page&gt; </code></pre> <p>The Glyphs element is rendering empty tiles for numbers as desired while the TextBox element does not. Please note that due to Glyphs being a low level element, several restrictions apply, especially FontUri/Fill/FontRenderingEmSize are all required, i.e. there are no defaults like for the related TextBox properties.</p> <p>With all this in mind back to your original question: I wouldn't think of the problem at hand as a WPF limitation (or a bug even), rather of an effect regarding the text rendering requirements and defaults applied in the context of WPF UI layout. E.g. the composite (i.e. non low level) <code>TextBox</code> control is applying text formatting and typography settings to its content (glyphs), facilitating the various character mapping tables embedded in fonts (there are potentially <a href="http://www.microsoft.com/typography/otspec/otff.htm#otttables" rel="nofollow noreferrer">lots</a> of them...); special/simplistic fonts like Scramble might just not provide enough or correct information here, consequently the WPF rendering engine might be forced to apply font fallback as <a href="https://stackoverflow.com/questions/832470/wpf-font-why-are-some-characters-missing/1087947#1087947">outlined by GalacticCowboy</a> already.</p> <p>If that's indeed the case, it might be possible to override the WPF default rendering algorithm somehow (see class <a href="http://msdn.microsoft.com/en-us/library/system.windows.media.textformatting.textformatter.aspx" rel="nofollow noreferrer"><code>TextFormatter</code></a>, the WPF text engine), but likely one would need to dig pretty deep into the framework to figure out what's going on within a <code>TextBox</code>. It's probably much easier to 'debug' the eventually missing or incorrect character mappings within the Scramble font. This would be an entirely different endeavor though...</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload