GithubHelp home page GithubHelp logo

plan44 / fonthexer2 Goto Github PK

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

A simple macOS App to convert fonts to hard-coded bit representation ("hex")

License: Other

Objective-C 57.39% Objective-C++ 42.61%

fonthexer2's Introduction

FontHexer2

FontHexer2 is a simple macOS app for converting fonts into "hex" (binary one-bit-per-pixel) representations for use in embedded devices with low-res pixel displays such as SmartLED (WS281x) chains. This works best for fonts that were originally designed for low resolutions, like retro fonts taken from or inspired from old computers and terminals.

The current version of the app can only export the fonts as C++ source files suitable for use in p44lrgraphics TextView. These can be of any height up to 64pixels max, and support variable character widths.

The app structure is such that adding different export formats would be simple, the sampling process is completely separated from the export (which is in the P44FontGenerator class)

fonthexer2

Usage

  • select a font using the popup or the font panel (sometimes flakey)
  • use the size slider at the right to fit the grid on the first character (you can set different chars for preview).
  • Drag the grid and place the red origin point at the bottom left corner (including descenders)
  • possibly modify the character set in the long line at the bottom, these are the characters that will be included in the output. Standard is ASCII 0x20..0x7E plus a few Central European accented characters.
  • possibly modify the font name for the output
  • press "Generate...", select where to generate the output file
  • To use/compile with p44lrgraphics, put the output file into the p44lrgraphics/fonts folder and modify the fonts[] table in p44lrgraphics/textview.cpp accordingly.

How this app came to be

The p44lgraphics export part is fully hand-coded C++, most of it adapted from existing code in p44lgraphics/textview.cpp.

However the mac app itself is primarily the result of a conversation with ChatGPT 3.5. I have a firm understanding of the Cocoa concepts, but my practice is very dated and mostly iOS focused, so for every little UI detail I would have needed to research APIs and howtos. Asking the AI chatbot made this much easier - the suggested code usually worked out of the box. Only finetuning turned out to be more efficient to do manually (or leave for later, like proper fontpanel functioning) - the more detailed and specific my prompt was, the more the AI tended to hallucinate the APIs that would fit my needs - but don't exist.


(c) 2023 by luz/plan44.ch

fonthexer2's People

Contributors

plan44 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.