GithubHelp home page GithubHelp logo

markalanjones / fontconverter Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 797 KB

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

License: MIT License

C# 100.00%
meadow font font-converter 1bit wpf-application

fontconverter's Introduction

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

fontconverter's People

Contributors

markalanjones avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.