Git Product home page Git Product logo

hd-osd-font-tools's Introduction

HD OSD Font Tools

A tool for building the HD OSD fonts for HDZERO VRXs and goggles. The initial version is supposed to build HD OSD fonts for the Betaflight (BTLF) FC variant. For the INAV6 FC variant the tool has a limited support to create the logo.

Usage

The tool is command line based with an option to preview the built font. User can choose one or more sources to build the font.

The source can be:

  • HDZERO OSD font (.bmp)
  • true type font file (.ttf)
  • Analog OSD font file (.mcm)
  • Analog OSD font preview file (.png / .bmp)
  • Generic bitmap, typically containing a logo (.png / .bmp )

The source can be used as a part of the built font such as:

  • all glyphs
  • characters
  • numbers
  • letters
  • special characters
  • values icons
  • units symbols
  • home arrow
  • AHI elements
  • logo
  • etc.

The expected most common usage of the tool will be creation of custom logos - boot / arming and pilot's "mini logo" - and rendering the characters glyphs out of .ttf fonts.

Command line options and values

Typical usage is:

fontbuilder.exe -option1 file1 value01 value02 value03 -option2 file2 -option3 -option4

or

py fontbuilder.py -option1 file1 value01 value02 value03 -option2 file2 -option3 -option4

Each option creates the source of the font to be built. One or more sources are built together to a target OSD font. The options are processed in order as they are entered. Please note that some options may overwrite the glyphs generated by previous option(s). The built font can be saved to a disk, displayed as preview or in form of a static demo.

Option -base

  • sets the base content of the font
  • loads all the possible glyphs from the source file
  • valid file formats
    • png
    • bmp
    • mcm
    • ttf

Option -btflcharacters

  • loads all BTFL characters glyphs from the source file
  • valid file formats
    • png
    • bmp
    • mcm
    • ttf

Option -btflspecials

  • loads BTFL special characters glyphs from the source file
  • valid file formats
    • png
    • bmp
    • mcm
    • ttf

Option -btflnumbers

  • loads BTFL numbers glyphs from the source file
  • valid file formats
    • png
    • bmp
    • mcm
    • ttf

Option -btflletters

  • loads BTFL letters glyphs from the source file
  • valid file formats
    • png
    • bmp
    • mcm
    • ttf

Option -btfllowletters

  • loads BTFL letters glyphs from the source file
  • valid file formats
    • ttf

Option -btflvalues

  • loads BTFL values glyphs from the source file
  • valid file formats
    • png
    • bmp
    • mcm

Option -btflunits

  • loads BTFL values glyphs from the source file
  • valid file formats
    • png
    • bmp
    • mcm

Option -btflahi

  • loads BTFL AHI (artifical horizont indicator) glyphs from the source file
  • valid file formats
    • png
    • bmp
    • mcm

Option -btfcompass

  • loads BTFL compass glyphs from the source file
  • valid file formats
    • png
    • bmp
    • mcm

Option -btflbattery

  • loads BTFL battery glyphs from the source file
  • valid file formats
    • png
    • bmp
    • mcm

Option -btflarrow

  • loads BTFL home arrow glyphs from the source file
  • valid file formats
    • png
    • bmp
    • mcm

Option -btflframe

  • loads BTFL camera framing and stick overlay glyphs from the source file
  • valid file formats
    • png
    • bmp
    • mcm

Option -btflprogress

  • loads BTFL progress bar glyphs from the source file
  • valid file formats
    • png
    • bmp
    • mcm

Option -btfllogo

  • loads generic bitmap or BTFL logo glyphs from the source file
  • valid file formats
    • png
    • bmp
    • mcm

Option -inavlogo

  • loads generic bitmap or INAV6 logo glyphs from the source file
  • valid file formats
    • png
    • bmp
    • mcm

Option -btflminilogo

  • loads generic bitmap the source file
  • the bitmap is scalled and renders to glyphs [\]^_
  • use as a craft name or pilot name to display in OSD
  • valid file formats
    • png
    • bmp

Option -o

  • saves the built font to a file
  • valid file formats
    • bmp

Option -explode

  • the saved built font will be rendered with 6px spacing between glyphs

Option -nopreview

  • the built font preview will not be displayed

Option -btfldemo

  • the built font preview will not be displayed
  • a demo mimicking real life view in the goggles will be displayed

Example

The demo above has been created using a base OSD font (.bmp), two .ttf fonts and two bitmap files used as a logos.

fontbuilder.exe^
 -base "resources/fonts/BTFL_ondrascz_color.bmp"^
 -btfllowletters "resources/ttf/DaysOne-Regular.ttf" 25 1.2 1 ^
 -btflnumbers "resources/ttf/a4speed.ttf" 22 1.4 1.7 -0.5 4.5 0.1 0.1 #FFFF44^
 -btfllogo "resources/logos/BTFL_hdzero.png"^
 -btflminilogo "resources/logos/BTFL_ondras.png"^
 -btfldemo

Option values

Option values are dependent on the input file formats. The values tell how the input file is used to render given glyphs. The values must be entered in a given order. None of the values is mandatory.

Values for bitmaps

Bitmap files (png, bmp) don't support any values, the input bitmap file is taken as-is and is processed automatically. The tool will automatically guess the content of the bitmap and will use it accordingly (glyphs, logo, etc...)

Values for .ttf files

The .ttf files are TrueType fonts. The tool loads the font renders all the possible glyphs. The render can be altered by a numerous values that allows (almost) pixel perfect outcomes.

Values:

  • font size
    • size of the font to be rendered
    • default value: 15
  • outline thickness
    • how thick (in px) the outline of the glyph is
    • can be float value
    • default value: 1.5
  • glyph vertical stretch
    • how the glyph is vertically stretched compared to default geometry
    • 1 = original, 2 = double height
    • can be float value
    • default value: 1.5
  • glyph x offset
    • horizontal offset (in px) of the glyph within the glyph box
    • can be float value, positive or negative
    • default value: 0
  • glyph y offset
    • vertical offset (in px) of the glyph within the glyph box
    • can be float value, positive or negative
    • default value: 0
  • glyph outline x offset
    • horizontal offset (in px) of the glyph outline
    • can be float value, positive or negative
    • default value: 0
  • glyph outline y offset
    • vertical offset (in px) of the glyph outline
    • can be float value, positive or negative
    • default value: 0
  • glyph color
    • a HEX color value with leading '#'
    • default value: #FFFFFF (white)
  • outline color
    • a HEX color value with leading '#'
    • default value: #000000 (black)

Example:

fontbuilder.exe^
 -base "resources/fonts/BTFL_ondrascz_grey.png"^
 -btflcharacters "resources/ttf/DaysOne-Regular.ttf" 25 1.2 1^
 -btfllowletters "resources/ttf/DaysOne-Regular.ttf" 25 1.2 1 0 0 0 0 #8899EE^
 -btflnumbers "resources/ttf/a4speed.ttf" 22 1.4 1.7 -0.5 4.5 0.1 0.1 #FFFF44^

This renders the glyphs based on two different .ttf fonts with three different settings. Please consider the offsets fine tuning of the a4speed.ttf font.

Values for .mcm files

The .mcm files are fonts definitions for the analog OSD systems. The tool loads the font and double scales it.

Values:

  • glyph color
    • a HEX color value with leading '#'
    • default value: #FFFFFF (white)
  • outline color
    • a HEX color value with leading '#'
    • default value: #000000 (black)

Exapmple:

fontbuilder.exe -base resources/fonts/BTFL_ondrascz.MCM #FFFF00 #0000FF

This renders double scaled analog font of yellow glyphs with blue outline.

hd-osd-font-tools's People

Contributors

ondrascz avatar yith1 avatar

Stargazers

onebody avatar Károly Kiripolszky avatar 阿卜杜热伊木·阿卜杜力木 avatar Dustin Lacewell avatar Richard Berg avatar KevinB avatar Paweł Stefański avatar Nils H. avatar Jarosław Domański avatar Keith avatar Philip Wintersteiner avatar Sightline avatar  avatar  avatar  avatar João Gouveia avatar Treadwm avatar André avatar Yves avatar nerdCopter avatar  avatar Jakub Steiner avatar

Watchers

 avatar  avatar

Forkers

yith1

hd-osd-font-tools's Issues

Add support for 1080p fonts

These tools are great, but they only support fonts for the 720p mode (and below).

Please add support for the 1080p fonts as well.

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.