Skip to content

WPF app to convert TT Fonts to Meadow.Foundation C# Fonts

License

Notifications You must be signed in to change notification settings

MarkAlanJones/FontConverter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FontConverter

WPF app to convert TT Fonts to Meadow.Foundation C# Fonts

Overview

TrueType and OpenType fonts on windows are vector based fonts, designed to be displayed on high resolution displays. For the Meadow F7 we have small displays that need bitmap fonts. The Graphics Library only supports 1bit fonts.

The approach is to select a font that is installed on windows, and then draw each character in white on a black 12x20 bitmap. These bitmaps use 4 bytes per pixel (and are rendered with anti-aliasing), so we will average the colour channels to get 1 byte per pixel greyscale. Then using a threshhold we can decide if each pixel should be white or black.

The difficulty for a WPF app, is that the WriteableBitmaps do not have a drawstring method. Instead we have to share the bitmap, and write to it using GDI+.

How to use

The application does not read or write any files.

  1. Pick a font from the dropdown at the top - Monospaced fonts may work better, but there is no indication of which are monospaced.
  2. Mouse over the character (4 btyes per pixel) to see how the pixels will be interpretted for it. @ is on, . is off. The & is used for pixels that may become @ if you move the slider to the left.
  3. The Threshhold slider sets where black becomes white. Typically move it to the left to fill in fonts, move to the right to open up close spots.
  4. The 14pt setting should fill the 12x20 box for most fonts. it can be adjusted up or down if necessary
  5. The x and y position shift the image within the box. look at characters with descenders and see if they are cut off. See if there is too much space on the left or right.
  6. Once you think you have a font that is legible, double click on the code at the bottom. it should all be selected.
  7. right click on the selected text to copy, and then paste it into a new class file in your meadow app.

Fonts generated by this application are available in this project: Meadow Font Test

Screenshot

About

WPF app to convert TT Fonts to Meadow.Foundation C# Fonts

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages