Coder Social home page Coder Social logo

fontem's Introduction

C Font Embedder

Build Status

Overview

A simple C program to turn selected characters from a TrueType font file into a .c/.h file pair such that the type can be embedded into the binary of a program. This is particularly useful for Embedded systems that may not have a file storage device.

Command line parameters

    Usage: fontem [OPTION...]
      -f, --font=file        Font filename (default: null)
      -s, --size=integer     Font size (default: 10)
      -c, --chars=string     List of characters to produce (default: "!@#$%^&*()_+-={}|[]\:";'<>?,./`~ ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789")
      -n, --name=file        Output name (without extension) (default: null)
      -d, --dir=dir          Output directory (default: ".")

    Help options:
      -?, --help             Show this help message
          --usage            Display brief usage message

Example usage

   mkdir -p fonts

   ./fontem --font=/usr/share/fonts/truetype/ubuntu-font-family/UbuntuMono-B.ttf \
            --size=10 --name=ubuntumono --dir=fonts

This will generate two files, fonts/font-ubuntumono-10.c and fonts/font-ubuntumono-10.h.

To use them, you will need to copy src/resource/fontem.h to the fonts directory. Examples of these files may be found in the examples directory of this repository.

The .c file contains descriptions of each character (glyph) that was translated. At the end there is a lookup table mapping the glyphs to their ASCII code. (Note that this table is indexed on the ordinal value of each character; if you include high-valued UNICODE characters then this will make for a large empty table; this shortcoming will be addressed in a future revision.)

Dependencies

Along side GCC and GNU Autotools, this project depends on the libpopt and libfreetype libraries.

On Ubuntu the build dependencies can be installed with:

   sudo apt install build-essential automake autoconf libtool \
                    libpopt-dev libfreetype6-dev

And the runtime dependencies, if you need to move the program to another host, can be installed with:

   sudo apt install libpopt0 libfreetype6

License

This file is distributed under the terms of the MIT License. See the LICENSE file at the top of this tree, or if it is missing a copy can be found at http://opensource.org/licenses/MIT

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.