go-fonts

module
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2022 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-2021 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 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 greatvibes_regular grutchshaded hanaleifill_regular hanalei_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 overlockregular oxygen oxygen_bold oxygen_bolditalic oxygen_italic oxygenmono_regular pacifico parisienne_regular plainblack_normal plainblackwide_normal plasmadripbrk plasmadripemptybrk princesssofia printbold printclearly printdashed printersornamentsone promocyja qwigley_regular ralewaydots_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 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 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.
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
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.
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.
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