Git Product home page Git Product logo

claudiobo / zandronum-font-generator Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 116 KB

A tool for showing Doom font using special Zandronum's TEXTCOLOR using Javascript Canvas

Home Page: https://www.claudiobo.com/zandronum-font/

License: GNU General Public License v3.0

HTML 12.62% Python 13.19% CSS 2.94% JavaScript 71.25%
canvas font gzdoom javascript text textcolor zandronum textcolo doom doom-2

zandronum-font-generator's Introduction

Zandronum Font Generator/Previewer

A tool for generating Doom's text using special ZDoom/Zandronum's TEXTCOLO using Javascript Canvas

ZDoom TEXTCOLO
ZDoom Text Colors
Zandronum Text Colors

To-Do list

  • Re-organize the images and JSON on a /data/ folder to fetch externally
  • Don't use Base64 images hardcoded in the code
  • Don't use .js files with dict to load the JSONs
  • Make the ZanFont class a little better to handle with a instance
  • Put const on variables instead of var or let where possible
  • Add to ZanFont the possibility to read custom URLs when initializing
  • Rewrite/refactor zanfont.js to be less awful
  • Allow to use your own fonts (only possible via custom URLs loading)
  • Create your own font-coords.json via a Python script (I don't know how did I generated the default font-coords.json... ๐Ÿ˜ถ)

Demo example

You can check the live preview
or you can load ./src/index.html into your browser.

Implementation example

/* First, after the closing </body> tag you need to import zanfont.js */
<script src="zanfont.js"></script>

/* Then you need to set a id to a img element where you want the font to be rendered */
<img id="zanfont-preview-1">
<img id="zanfont-preview-2"> 

/* Then you initialize a ZanFont class */
/* You can add a callback that gets executed when ZanFont is ready loading everything */
/* i.e. generating a default image */
const zanFontInstance = new ZanFont({
    // Initial text generation
    zanFontInstance.createPNG("zanfont-preview-1", "Wow some \c[x1]tests!", "bigfont");
    zanFontInstance.createPNG("zanfont-preview-2", "\c[x2]Very cool", "smallfont");
    // Maybe you can add to a element a "onInput" event to re-call the 'createPNG' function
})

/* Optionally, you can specify custom URLs with a dictionary so ZanFont fetchs the required data from other sources */
/* Just in case the default sites that are in the library doesn't work anymore */
const zanFontInstance = new ZanFont({ /*...*/ }, {
    bigFontURL: "https://www.claudiobo.com/zandronum-font/dbigfont.png",
    smallFontURL: "https://www.claudiobo.com/zandronum-font/dsmallfont.png",
    colorsJSONURL: "https://www.claudiobo.com/zandronum-font/colors.json",
    fontCoordsJSONURL: "https://www.claudiobo.com/zandronum-font/font-coords.json"
})

And boila, if you use bigfont you'll get:
Output Image 1

And if you use smallfont:
Output Image 2

zandronum-font-generator's People

Contributors

claudiobo avatar

Stargazers

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