Giter Site home page Giter Site logo

glyph's Introduction

Glyph v0.0.1 (experimental)

Over 100 glyph icons in a font that can be used for button, label and frame captions.

Example

Note: Due to a bug in earlier versions of Factorio, custom fonts only work with Factorio 0.14.3 and above.

Usage

This mod is still in experimental pre-alpha development. Don't use it for production use, but feel free to experiment with it and leave feedback :)

The mod adds a glyph font contianing numerous vector icons, along with a locale dictionary (locale/en/dictionary.cfg) allowing them to be referenced by name in your code.

Adding dependency

The mod is designed to be a library, which other mods can depend on - this allows a single instance of the glyph font to be used by multiple mods.

In your mods' info.json add the dependency for both the Glyph mod and also the base mod (to make sure valid version of Factorio is being used), for example:

  "dependencies": ["Glyph >= 0.0.1","base >= 0.14.3"],

Setting the font

Set the font in a prototype style sheet (see core and base mods for examples of that) or, at runtime, via the .style.font property of a LuaGuiElement, for example:

game.players[1].gui.top.my_gui_element.style.font = 'glyph-large'

Four font sizes are currently provided:

  • glyph-small - 12pt text
  • glyph - 14pt text
  • glyph-medium - 16pt text
  • glyph-large - 18pt text

You can add additional sizes - see prototypes/fonts.lua for example.

Choosing the glyph

After downloading the mod, unzip it and open the reference.htm in a browser to display a handy chart listing all the glyphs and their associated locale keys.

To display a glyph, set yourElement.caption to the relevant key for the icon you want, for example:

game.players[1].gui.top.my_gui_element.caption = { 'glyph-biter' }

License

The .lua, .cfg and .json files were made by me (aubergine) and are MIT licensed.

The font was built using Fontastic, a site that allows glyphs from numerous open source fonts (and a few commerical ones, which aren't used for obvious reasons) to be merged in to a single font file with custom character code mappings.

Glyphs are from the following fonts:

The reference.htm and associated .css were automatically created by Fontastic, and subsequently edited by me. As far as I can tell, those files are MIT licensed, although the Fontastic app doesn't specifically state that in the files themselves.

Contributing

Yes please! In particular I could use some help with:

  • general testing, feedback, improvements
  • merging glyphs in to vanilla fonts
  • easier way to maintain the locale dictionary (maybe by parsing the reference.htm to autogenerate the dictionary?)
  • custom Factorio-related glyphs in SVG format can be added to the font

Ping me via the issue tracker if you want to discuss, or just send pull requests :)

Future plans

  • Move all glyphs to private unicode space (U+E000โ€“U+F8FF)
  • Merge with vanilla fonts so that glyphs and normal text can be used together
  • Add more glyphs based on feedback (possibly remove some too)
  • Maybe add remote interface with list of supported glyphs?
  • Add demo script that populates a simple grid with all available glyphs?
  • Add additional open source fonts, such as LCD, dot matrix, etc.

glyph's People

Contributors

originalfoo avatar

Stargazers

 avatar

Watchers

 avatar  avatar

glyph's Issues

0.15?

Any plans to port this up to 0.15?
Regards,
~B

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.