go-fonts

module
v0.0.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2024 License: Apache-2.0

README

go-fonts: Render open source fonts to polygons in Go

GoDoc Test Status

This is an experimental package used to render open source fonts to polygons using Go.

Example usage

To use one or more fonts within a Go program, import the main package and the font(s) you want, like this:

import (
  "github.com/gmlewis/go-fonts/fonts"
  _ "github.com/gmlewis/go-fonts/fonts/ubuntumonoregular"
)

Then render the text to polygons and use them however you want:

  render, err := fonts.Text(xPos, yPos, xScale, yScale, message, "ubuntumonoregular", Center)
  if err != nil {
    return err
  }
  log.Printf("MBB: %v", render.MBB)
  for _, poly := range render.Polygons {
    // ...
  }

See https://github.com/gmlewis/go-gerber for an example application that uses this package.


Enjoy!


License

Copyright 2019-2024 Glenn M. Lewis. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.


Font samples

aaarghnormal abeezee_italic abeezee_regular acme_regular aguafinascript_regular aileron_black aileron_blackitalic aileron_bold aileron_bolditalic aileron_heavy aileron_heavyitalic aileron_italic aileron_light aileron_lightitalic aileron_regular aileron_semibold aileron_semibolditalic aileron_thin aileron_thinitalic aileron_ultralight aileron_ultralightitalic airstream alexbrush_regular alfaslabone_regular allura_regular amerika amerikasans amita_bold amita_regular anagram aquilinetwo arizonia_regular asset_regular atomicage_regular baloo baskervville_italic baskervville_regular berkshireswash_regular bitstreamverasansmono_bold bitstreamverasansmono_boldob bitstreamverasansmono_oblique bitstreamverasansmono_roman blazium cacchampagne carrelectronicdingbats coiny_regular combinumeralsltd davysregular deliusswashcaps_regular diplomata_regular dited edwin_bdita edwin_bold edwin_italic edwin_roman embossedblack_normal embossedblackwide_normal englandhanddb entypo f20db f2dumb fantasquesansmono_bold fantasquesansmono_bolditalic fantasquesansmono_italic fantasquesansmono_regular fascinate_inlineregular fauxsnowbrk floralia font3933 fontleroybrown freebooterscript freemono freemonobold freemonoboldoblique freemonooblique freesans freesansbold freesansboldoblique freesansoblique freeserif freeserifbold freeserifbolditalic freeserifitalic genzschetheyse genzschetheysealternate geometrysoftpro_boldn gooddogregular goudystm goudystm_italic grandhotel_regular gravitasone greatvibes_regular grutchshaded hanalei_regular hanaleifill_regular headhunter_regular heavydata helsinkiregular heydingsicons im_fell_flowers_2 impactlabel impactlabelreversed incisedblack_normal incisedblackwide_normal inconsolata italianno_regular kawoszeh kellssd kingthingsitalique kingthingsxstitch konstytucyja landliebe latoregular leaguescriptthin_regular lobstertwo lobstertwo_bold lobstertwo_bolditalic lobstertwo_italic loversquarrel_regular membra miama modak monospacetypewriter monoton_regular montez_regular mothproofscript oi_regular overlockregular oxygen oxygen_bold oxygen_bolditalic oxygen_italic oxygenmono_regular pacifico parisienne_regular pixelcode pixelcode_black pixelcode_blackitalic pixelcode_bold pixelcode_bolditalic pixelcode_demibold pixelcode_demibolditalic pixelcode_extrablack pixelcode_extrablackitalic pixelcode_extrabold pixelcode_extrabolditalic pixelcode_extralight pixelcode_extralightitalic pixelcode_italic pixelcode_light pixelcode_lightitalic pixelcode_medium pixelcode_mediumitalic pixelcode_thin pixelcode_thinitalic plainblack_normal plainblackwide_normal plasmadripbrk plasmadripemptybrk princesssofia printbold printclearly printdashed printersornamentsone promocyja qwigley_regular ralewaydots_regular rammettoone_regular rechtmanplain rothenburgdecorative_normal rougescript_regular rubik_black rubik_blackitalic rubik_bold rubik_bolditalic rubik_italic rubik_light rubik_lightitalic rubik_medium rubik_mediumitalic rubik_regular ruthie_regular rye_regular sail_regular satisfy_regular scratch scriptinapro sevillana_regular sfarcheryblack sfarcheryblack_oblique sfarcheryblacksc sfarcheryblacksc_oblique sfwasabi sfwasabicondensed shojumaru_regular shortstack shrikhand_regular simpel_medium sjonarbok_classic snickles sniglet_extrabold sniglet_regular sofia_regular solveigbold solveigbold_italic solveigdemibold solveigdemibold_italic solveigdisplay solveigdisplay_italic solveigtext solveigtext_italic sonsieone soria_soria soucisans spacemono_bold spacemono_bolditalic spacemono_italic spacemono_regular spiltink spirax_regular sportrop_regular squadaone_regular stardosstencil_bold stardosstencil_regular stateface_regular stmarie_thin symbolsigns_basisset synthetiqueot tangerine tangerine_bold teutonicno1_demibold teutonicno2_demibold teutonicno3_demibold teutonicno4_demibold texgyreadventor_bold texgyreadventor_bolditalic texgyreadventor_italic texgyreadventor_regular titanone topsecret_bold typemymusic_notation ubuntumonoregular vanilla vastshadow_regular veggieburger veggieburger_bold veggieburger_light veterantypewriter vibur wcsoldoutabta wcsoldoutbbta wcsoldoutcbta websymbols_regular wellfleet_regular windsong woodennickelblack yataghan yellowtail yesevaone zenda znikomit znikomitno24

Directories

Path Synopsis
cmd
font2go
font2go reads one or more standard SVG webfont file(s) and writes Go file(s) used to render them to polygons.
font2go reads one or more standard SVG webfont file(s) and writes Go file(s) used to render them to polygons.
font2irmf
font2irmf reads one or more standard SVG webfont file(s) and writes IRMF file(s) used to render them in IRMF model shaders.
font2irmf reads one or more standard SVG webfont file(s) and writes IRMF file(s) used to render them in IRMF model shaders.
font2lua
font2lua reads one or more standard SVG webfont file(s) and writes Lua file(s) used to render them to polygons in Blackjack and go-bjk.
font2lua reads one or more standard SVG webfont file(s) and writes Lua file(s) used to render them to polygons in Blackjack and go-bjk.
make-puzzle
make-puzzle generates a text puzzle for 3D-printing from a string.
make-puzzle generates a text puzzle for 3D-printing from a string.
render-fonts
render-fonts renders fonts with the given message in all imported fonts to PNG files in order to test out the font rendering.
render-fonts renders fonts with the given message in all imported fonts to PNG files in order to test out the font rendering.
examples module
bifilar-coil-diagram
bifilar-coil-diagram renders a diagram for the coil.
bifilar-coil-diagram renders a diagram for the coil.
dual-bifilar-coil-diagram
dual-bifilar-coil-diagram renders a diagram for the coil.
dual-bifilar-coil-diagram renders a diagram for the coil.
hept-bifilar-coil
hept-bifilar-coil-diagram renders a diagram for the coil.
hept-bifilar-coil-diagram renders a diagram for the coil.
hex-bifilar-coil-diagram
hex-bifilar-coil-diagram renders a schematic diagram representing the wiring of the hex bifilar coil design from https://github.com/gmlewis/go-gerber/tree/master/examples/hex-bifilar-coil .
hex-bifilar-coil-diagram renders a schematic diagram representing the wiring of the hex bifilar coil design from https://github.com/gmlewis/go-gerber/tree/master/examples/hex-bifilar-coil .
hex-bifilar-coil-diagram-v2
hex-bifilar-coil-diagram renders a diagram for the coil.
hex-bifilar-coil-diagram renders a diagram for the coil.
hexadeca-bifilar-coil-diagram
icosi-bifilar-coil-diagram renders a diagram for the coil.
icosi-bifilar-coil-diagram renders a diagram for the coil.
icosi-bifilar-coil-diagram
icosi-bifilar-coil-diagram renders a diagram for the coil.
icosi-bifilar-coil-diagram renders a diagram for the coil.
maryn-letter
maryn-letter renders a letter to Maryn.
maryn-letter renders a letter to Maryn.
maze-word
maze-word renders a word in white-on-black.
maze-word renders a word in white-on-black.
n333-bifilar-coil-diagram
n333-bifilar-coil-diagram renders a diagram for the coil.
n333-bifilar-coil-diagram renders a diagram for the coil.
n334-bifilar-coil-diagram
n334-bifilar-coil-diagram renders a diagram for the coil.
n334-bifilar-coil-diagram renders a diagram for the coil.
n9-bifilar-coil-diagram
icosi-bifilar-coil-diagram renders a diagram for the coil.
icosi-bifilar-coil-diagram renders a diagram for the coil.
oct-bifilar-coil
oct-bifilar-coil-diagram renders a diagram for the coil.
oct-bifilar-coil-diagram renders a diagram for the coil.
penta-bifilar-coil
penta-bifilar-coil-diagram renders a diagram for the coil.
penta-bifilar-coil-diagram renders a diagram for the coil.
quad-bifilar-coil-diagram
quad-bifilar-coil-diagram renders a diagram for the coil.
quad-bifilar-coil-diagram renders a diagram for the coil.
tri-bifilar-coil-diagram
tri-bifilar-coil-diagram renders a diagram for the coil.
tri-bifilar-coil-diagram renders a diagram for the coil.
Package fonts provides a collection of open source fonts converted to Go.
Package fonts provides a collection of open source fonts converted to Go.
actor_regular Module
alegreya_bold Module
amaranth_bold Module
arvo Module
arvo_bold Module
arvo_italic Module
bevan_italic Module
bevan_regular Module
chivo_black Module
chivo_bold Module
chivo_italic Module
chivo_light Module
chivo_medium Module
chivo_regular Module
chivo_thin Module
firasans_bold Module
firasans_thin Module
fjord_one Module
forum Module
jura_bold Module
jura_light Module
jura_medium Module
jura_regular Module
jura_semibold Module
kreon_bold Module
kreon_light Module
kreon_medium Module
kreon_regular Module
lato_black Module
lato_bold Module
lato_hairline Module
lato_italic Module
lato_light Module
lato_regular Module
lora_bold Module
lora_italic Module
lora_medium Module
lora_regular Module
lora_semibold Module
mplus1p_black Module
mplus1p_bold Module
mplus1p_light Module
mplus1p_thin Module
notosans_bold Module
notosans_thin Module
opensans_bold Module
oswald_bold Module
oswald_light Module
oswald_medium Module
ptsans_bold Module
ptsans_italic Module
signika_bold Module
signika_light Module
ubuntu_bold Module
ubuntu_italic Module
ubuntu_light Module
ubuntu_medium Module
vtcnumerals Module
pb
Package webfont performs common rune and glyph processing operations.
Package webfont performs common rune and glyph processing operations.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL