From fe89f847503573378180ddbe5e6badec18093c37 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Thu, 13 Dec 2018 17:52:15 -0500 Subject: render: font: Include a default font for convenience. * data/fonts/good-neighbors.fnt: New file. * data/fonts/good-neighbors.png: New file. * data/CREDITS: New file. * examples/fonts/AUTHORS: Delete. * examples/fonts/good_neighbors_starling.png: Delete. * examples/fonts/good_neighbors_starling.xml: Delete. * Makefile.am (dist_pkgdata_DATA, fontsdir, dist_fonts_DATA): New variables. (EXTRA_DIST): Remove examples/fonts files. * chickadee/render/font.scm (draw-text): Make font an optional keyword argument. * doc/api.texi (Fonts): Document it. * examples/grid.scm: Update to use new draw-text API. * examples/nine-patch.scm: Ditto. * examples/text.scm: Ditto. squash! render: font: Include a default font for convenience. --- Makefile.am | 11 +- chickadee/render/font.scm | 9 +- data/CREDITS | 9 ++ data/fonts/good-neighbors.fnt | 239 ++++++++++++++++++++++++++++ data/fonts/good-neighbors.png | Bin 0 -> 5108 bytes doc/api.texi | 7 +- examples/fonts/AUTHORS | 5 - examples/fonts/good_neighbors_starling.png | Bin 6659 -> 0 bytes examples/fonts/good_neighbors_starling.xml | 244 ----------------------------- examples/grid.scm | 4 +- examples/nine-patch.scm | 6 +- examples/text.scm | 17 +- 12 files changed, 274 insertions(+), 277 deletions(-) create mode 100644 data/CREDITS create mode 100644 data/fonts/good-neighbors.fnt create mode 100644 data/fonts/good-neighbors.png delete mode 100644 examples/fonts/AUTHORS delete mode 100644 examples/fonts/good_neighbors_starling.png delete mode 100644 examples/fonts/good_neighbors_starling.xml diff --git a/Makefile.am b/Makefile.am index 2933194..3bb8c2d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -90,11 +90,16 @@ EXTRA_DIST += \ examples/images/chickadee.png \ examples/images/dialog-box.png \ examples/images/tiles.png \ - examples/fonts/AUTHORS \ - examples/fonts/good_neighbors_starling.png \ - examples/fonts/good_neighbors_starling.xml \ examples/maps/example.tmx +dist_pkgdata_DATA = \ + data/CREDITS + +fontsdir = $(pkgdatadir)/fonts +dist_fonts_DATA = \ + data/fonts/good-neighbors.fnt \ + data/fonts/good-neighbors.png + shadersdir = $(pkgdatadir)/shaders dist_shaders_DATA = \ data/shaders/pbr/pbr-vert.glsl \ diff --git a/chickadee/render/font.scm b/chickadee/render/font.scm index 8ecd219..6136849 100644 --- a/chickadee/render/font.scm +++ b/chickadee/render/font.scm @@ -30,6 +30,7 @@ #:use-module (srfi srfi-11) #:use-module (sxml xpath) #:use-module (sxml simple) + #:use-module (chickadee config) #:use-module (chickadee math matrix) #:use-module (chickadee math rect) #:use-module (chickadee math vector) @@ -333,12 +334,16 @@ extension must be either .xml or .fnt." (define %default-scale (vec2 1.0 1.0)) (define %null-vec2 (vec2 0.0 0.0)) +(define default-font + (delay + (load-font (scope-datadir "fonts/good-neighbors.fnt")))) + (define draw-text (let ((matrix (make-null-matrix4))) - (lambda* (font - text + (lambda* (text position #:key + (font (force default-font)) (origin %null-vec2) (rotation 0) (scale %default-scale) diff --git a/data/CREDITS b/data/CREDITS new file mode 100644 index 0000000..b3db067 --- /dev/null +++ b/data/CREDITS @@ -0,0 +1,9 @@ +-*- org -*- + +* fonts/good-neighbors.png +Clint Bellanger - CC0 +https://opengameart.org/content/good-neighbors-pixel-font + +* fonts/good-neighbors.fnt +PROWNE & The_Blog - CC0 +https://opengameart.org/content/good-neighbors-pixel-font-starlingunity-version-updated diff --git a/data/fonts/good-neighbors.fnt b/data/fonts/good-neighbors.fnt new file mode 100644 index 0000000..80f1a5c --- /dev/null +++ b/data/fonts/good-neighbors.fnt @@ -0,0 +1,239 @@ +info face="GoodNeighbors" size=32 bold=0 italic=0 charset="" unicode=0 stretchH=100 smooth=1 aa=1 padding=0,0,0,0 spacing=1,1 +common lineHeight=16 base=26 scaleW=167 scaleH=168 pages=1 packed=0 alphaChnl=1 redChnl=0 greenChnl=0 blueChnl=0 +page id=0 file="good-neighbors.png" +chars count=233 +char id=33 x=153 y=26 width=6 height=12 xoffset=0 yoffset=4 xadvance=5 page=0 chnl=0 letter="!" +char id=34 x=82 y=32 width=7 height=7 xoffset=0 yoffset=4 xadvance=6 page=0 chnl=0 letter=""" +char id=35 x=24 y=77 width=10 height=10 xoffset=0 yoffset=5 xadvance=9 page=0 chnl=0 letter="#" +char id=36 x=24 y=88 width=10 height=14 xoffset=0 yoffset=3 xadvance=9 page=0 chnl=0 letter="$" +char id=37 x=12 y=124 width=11 height=12 xoffset=0 yoffset=4 xadvance=10 page=0 chnl=0 letter="%" +char id=38 x=0 y=146 width=11 height=12 xoffset=0 yoffset=4 xadvance=10 page=0 chnl=0 letter="&" +char id=39 x=45 y=136 width=4 height=7 xoffset=0 yoffset=4 xadvance=3 page=0 chnl=0 letter="'" +char id=40 x=160 y=26 width=6 height=14 xoffset=0 yoffset=3 xadvance=5 page=0 chnl=0 letter="(" +char id=41 x=160 y=41 width=6 height=14 xoffset=0 yoffset=3 xadvance=5 page=0 chnl=0 letter=")" +char id=42 x=24 y=126 width=10 height=11 xoffset=0 yoffset=3 xadvance=9 page=0 chnl=0 letter="*" +char id=43 x=126 y=156 width=8 height=9 xoffset=0 yoffset=6 xadvance=7 page=0 chnl=0 letter="+" +char id=44 x=135 y=160 width=4 height=7 xoffset=0 yoffset=11 xadvance=3 page=0 chnl=0 letter="," +char id=45 x=0 y=160 width=9 height=5 xoffset=0 yoffset=8 xadvance=8 page=0 chnl=0 letter="-" +char id=46 x=43 y=161 width=4 height=5 xoffset=0 yoffset=11 xadvance=3 page=0 chnl=0 letter="." +char id=47 x=144 y=13 width=8 height=14 xoffset=0 yoffset=3 xadvance=7 page=0 chnl=0 letter="/" +char id=48 x=136 y=0 width=8 height=12 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="0" +char id=49 x=160 y=13 width=6 height=12 xoffset=0 yoffset=4 xadvance=5 page=0 chnl=0 letter="1" +char id=50 x=144 y=54 width=8 height=12 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="2" +char id=51 x=144 y=80 width=8 height=12 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="3" +char id=52 x=45 y=26 width=9 height=12 xoffset=0 yoffset=4 xadvance=8 page=0 chnl=0 letter="4" +char id=53 x=135 y=78 width=8 height=12 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="5" +char id=54 x=144 y=28 width=8 height=12 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="6" +char id=55 x=144 y=41 width=8 height=12 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="7" +char id=56 x=144 y=93 width=8 height=12 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="8" +char id=57 x=144 y=132 width=8 height=12 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="9" +char id=58 x=160 y=158 width=4 height=8 xoffset=0 yoffset=7 xadvance=3 page=0 chnl=0 letter=":" +char id=59 x=161 y=0 width=4 height=10 xoffset=0 yoffset=8 xadvance=3 page=0 chnl=0 letter=";" +char id=60 x=44 y=145 width=9 height=14 xoffset=0 yoffset=3 xadvance=8 page=0 chnl=0 letter="<" +char id=61 x=117 y=159 width=7 height=8 xoffset=0 yoffset=7 xadvance=6 page=0 chnl=0 letter="=" +char id=62 x=35 y=81 width=9 height=14 xoffset=0 yoffset=3 xadvance=8 page=0 chnl=0 letter=">" +char id=63 x=126 y=89 width=8 height=12 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="?" +char id=64 x=13 y=86 width=10 height=12 xoffset=0 yoffset=4 xadvance=9 page=0 chnl=0 letter="@" +char id=65 x=144 y=119 width=8 height=12 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="A" +char id=66 x=144 y=106 width=8 height=12 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="B" +char id=67 x=144 y=67 width=8 height=12 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="C" +char id=68 x=36 y=0 width=9 height=12 xoffset=0 yoffset=4 xadvance=8 page=0 chnl=0 letter="D" +char id=69 x=135 y=13 width=8 height=12 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="E" +char id=70 x=127 y=0 width=8 height=12 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="F" +char id=71 x=126 y=117 width=8 height=12 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="G" +char id=72 x=135 y=130 width=8 height=12 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="H" +char id=73 x=153 y=67 width=6 height=12 xoffset=0 yoffset=4 xadvance=5 page=0 chnl=0 letter="I" +char id=74 x=35 y=13 width=9 height=12 xoffset=0 yoffset=4 xadvance=8 page=0 chnl=0 letter="J" +char id=75 x=135 y=91 width=8 height=12 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="K" +char id=76 x=135 y=143 width=8 height=12 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="L" +char id=77 x=13 y=46 width=10 height=12 xoffset=0 yoffset=4 xadvance=9 page=0 chnl=0 letter="M" +char id=78 x=35 y=119 width=9 height=12 xoffset=0 yoffset=4 xadvance=8 page=0 chnl=0 letter="N" +char id=79 x=135 y=117 width=8 height=12 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="O" +char id=80 x=135 y=104 width=8 height=12 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="P" +char id=81 x=45 y=52 width=9 height=13 xoffset=0 yoffset=4 xadvance=8 page=0 chnl=0 letter="Q" +char id=82 x=34 y=148 width=9 height=12 xoffset=0 yoffset=4 xadvance=8 page=0 chnl=0 letter="R" +char id=83 x=135 y=65 width=8 height=12 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="S" +char id=84 x=135 y=52 width=8 height=12 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="T" +char id=85 x=135 y=39 width=8 height=12 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="U" +char id=86 x=135 y=26 width=8 height=12 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="V" +char id=87 x=24 y=113 width=10 height=12 xoffset=0 yoffset=4 xadvance=9 page=0 chnl=0 letter="W" +char id=88 x=26 y=0 width=9 height=12 xoffset=0 yoffset=4 xadvance=8 page=0 chnl=0 letter="X" +char id=89 x=126 y=143 width=8 height=12 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="Y" +char id=90 x=126 y=130 width=8 height=12 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="Z" +char id=91 x=153 y=109 width=6 height=14 xoffset=0 yoffset=3 xadvance=5 page=0 chnl=0 letter="[" +char id=92 x=126 y=102 width=8 height=14 xoffset=0 yoffset=3 xadvance=7 page=0 chnl=0 letter="\" +char id=93 x=153 y=39 width=6 height=14 xoffset=0 yoffset=3 xadvance=5 page=0 chnl=0 letter="]" +char id=94 x=0 y=124 width=11 height=8 xoffset=0 yoffset=3 xadvance=10 page=0 chnl=0 letter="^" +char id=95 x=34 y=161 width=8 height=5 xoffset=0 yoffset=12 xadvance=7 page=0 chnl=0 letter="_" +char id=96 x=127 y=13 width=6 height=6 xoffset=0 yoffset=4 xadvance=5 page=0 chnl=0 letter="`" +char id=97 x=126 y=56 width=8 height=9 xoffset=0 yoffset=7 xadvance=7 page=0 chnl=0 letter="a" +char id=98 x=126 y=43 width=8 height=12 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="b" +char id=99 x=126 y=33 width=8 height=9 xoffset=0 yoffset=7 xadvance=7 page=0 chnl=0 letter="c" +char id=100 x=126 y=20 width=8 height=12 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="d" +char id=101 x=118 y=10 width=8 height=9 xoffset=0 yoffset=7 xadvance=7 page=0 chnl=0 letter="e" +char id=102 x=145 y=0 width=7 height=12 xoffset=0 yoffset=4 xadvance=6 page=0 chnl=0 letter="f" +char id=103 x=117 y=146 width=8 height=12 xoffset=0 yoffset=7 xadvance=7 page=0 chnl=0 letter="g" +char id=104 x=117 y=133 width=8 height=12 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="h" +char id=105 x=153 y=96 width=6 height=12 xoffset=0 yoffset=4 xadvance=5 page=0 chnl=0 letter="i" +char id=106 x=153 y=80 width=6 height=15 xoffset=0 yoffset=4 xadvance=5 page=0 chnl=0 letter="j" +char id=107 x=117 y=94 width=8 height=12 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="k" +char id=108 x=160 y=130 width=5 height=12 xoffset=0 yoffset=4 xadvance=4 page=0 chnl=0 letter="l" +char id=109 x=24 y=67 width=10 height=9 xoffset=0 yoffset=7 xadvance=9 page=0 chnl=0 letter="m" +char id=110 x=117 y=61 width=8 height=9 xoffset=0 yoffset=7 xadvance=7 page=0 chnl=0 letter="n" +char id=111 x=117 y=51 width=8 height=9 xoffset=0 yoffset=7 xadvance=7 page=0 chnl=0 letter="o" +char id=112 x=117 y=38 width=8 height=12 xoffset=0 yoffset=7 xadvance=7 page=0 chnl=0 letter="p" +char id=113 x=35 y=26 width=9 height=12 xoffset=0 yoffset=7 xadvance=8 page=0 chnl=0 letter="q" +char id=114 x=109 y=12 width=8 height=9 xoffset=0 yoffset=7 xadvance=7 page=0 chnl=0 letter="r" +char id=115 x=108 y=157 width=8 height=9 xoffset=0 yoffset=7 xadvance=7 page=0 chnl=0 letter="s" +char id=116 x=109 y=0 width=8 height=11 xoffset=0 yoffset=5 xadvance=7 page=0 chnl=0 letter="t" +char id=117 x=108 y=147 width=8 height=9 xoffset=0 yoffset=7 xadvance=7 page=0 chnl=0 letter="u" +char id=118 x=108 y=137 width=8 height=9 xoffset=0 yoffset=7 xadvance=7 page=0 chnl=0 letter="v" +char id=119 x=24 y=103 width=10 height=9 xoffset=0 yoffset=7 xadvance=9 page=0 chnl=0 letter="w" +char id=120 x=108 y=117 width=8 height=9 xoffset=0 yoffset=7 xadvance=7 page=0 chnl=0 letter="x" +char id=121 x=108 y=104 width=8 height=12 xoffset=0 yoffset=7 xadvance=7 page=0 chnl=0 letter="y" +char id=122 x=108 y=94 width=8 height=9 xoffset=0 yoffset=7 xadvance=7 page=0 chnl=0 letter="z" +char id=123 x=144 y=145 width=7 height=14 xoffset=0 yoffset=3 xadvance=6 page=0 chnl=0 letter="{" +char id=124 x=160 y=143 width=4 height=14 xoffset=0 yoffset=3 xadvance=3 page=0 chnl=0 letter="|" +char id=125 x=152 y=145 width=7 height=14 xoffset=0 yoffset=3 xadvance=6 page=0 chnl=0 letter="}" +char id=126 x=10 y=160 width=9 height=6 xoffset=0 yoffset=4 xadvance=8 page=0 chnl=0 letter="~" +char id=1040 x=108 y=39 width=8 height=12 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="А" +char id=1041 x=108 y=26 width=8 height=12 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="Б" +char id=1042 x=100 y=13 width=8 height=12 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="В" +char id=1043 x=100 y=0 width=8 height=12 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="Г" +char id=1044 x=13 y=59 width=10 height=13 xoffset=0 yoffset=4 xadvance=9 page=0 chnl=0 letter="Д" +char id=1045 x=99 y=136 width=8 height=12 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="Е" +char id=1025 x=99 y=120 width=8 height=15 xoffset=0 yoffset=1 xadvance=7 page=0 chnl=0 letter="Ё" +char id=1046 x=0 y=27 width=12 height=12 xoffset=0 yoffset=4 xadvance=11 page=0 chnl=0 letter="Ж" +char id=1047 x=99 y=94 width=8 height=12 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="З" +char id=1048 x=35 y=39 width=9 height=12 xoffset=0 yoffset=4 xadvance=8 page=0 chnl=0 letter="И" +char id=1049 x=35 y=52 width=9 height=15 xoffset=0 yoffset=1 xadvance=8 page=0 chnl=0 letter="Й" +char id=1050 x=99 y=65 width=8 height=12 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="К" +char id=1051 x=35 y=68 width=9 height=12 xoffset=0 yoffset=4 xadvance=8 page=0 chnl=0 letter="Л" +char id=1052 x=13 y=73 width=10 height=12 xoffset=0 yoffset=4 xadvance=9 page=0 chnl=0 letter="М" +char id=1053 x=99 y=26 width=8 height=12 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="Н" +char id=1054 x=91 y=13 width=8 height=12 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="О" +char id=1055 x=91 y=0 width=8 height=12 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="П" +char id=1056 x=90 y=145 width=8 height=12 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="Р" +char id=1057 x=90 y=132 width=8 height=12 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="С" +char id=1058 x=90 y=119 width=8 height=12 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="Т" +char id=1059 x=126 y=76 width=8 height=12 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="У" +char id=1060 x=0 y=14 width=12 height=12 xoffset=0 yoffset=4 xadvance=11 page=0 chnl=0 letter="Ф" +char id=1061 x=35 y=132 width=9 height=12 xoffset=0 yoffset=4 xadvance=8 page=0 chnl=0 letter="Х" +char id=1062 x=13 y=99 width=10 height=13 xoffset=0 yoffset=4 xadvance=9 page=0 chnl=0 letter="Ц" +char id=1063 x=90 y=48 width=8 height=12 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="Ч" +char id=1064 x=0 y=40 width=12 height=12 xoffset=0 yoffset=4 xadvance=11 page=0 chnl=0 letter="Ш" +char id=1065 x=0 y=0 width=14 height=13 xoffset=0 yoffset=4 xadvance=13 page=0 chnl=0 letter="Щ" +char id=1066 x=15 y=0 width=10 height=12 xoffset=0 yoffset=4 xadvance=9 page=0 chnl=0 letter="Ъ" +char id=1067 x=0 y=133 width=11 height=12 xoffset=0 yoffset=4 xadvance=10 page=0 chnl=0 letter="Ы" +char id=1068 x=81 y=128 width=8 height=12 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="Ь" +char id=1069 x=81 y=115 width=8 height=12 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="Э" +char id=1070 x=12 y=137 width=11 height=12 xoffset=0 yoffset=4 xadvance=10 page=0 chnl=0 letter="Ю" +char id=1071 x=45 y=13 width=9 height=12 xoffset=0 yoffset=4 xadvance=8 page=0 chnl=0 letter="Я" +char id=1072 x=81 y=76 width=8 height=9 xoffset=0 yoffset=7 xadvance=7 page=0 chnl=0 letter="а" +char id=1073 x=81 y=62 width=8 height=13 xoffset=0 yoffset=3 xadvance=7 page=0 chnl=0 letter="б" +char id=1074 x=81 y=52 width=8 height=9 xoffset=0 yoffset=7 xadvance=7 page=0 chnl=0 letter="в" +char id=1075 x=81 y=42 width=8 height=9 xoffset=0 yoffset=7 xadvance=7 page=0 chnl=0 letter="г" +char id=1076 x=13 y=113 width=10 height=9 xoffset=0 yoffset=7 xadvance=9 page=0 chnl=0 letter="д" +char id=1077 x=72 y=157 width=8 height=9 xoffset=0 yoffset=7 xadvance=7 page=0 chnl=0 letter="е" +char id=1105 x=73 y=16 width=8 height=12 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="ё" +char id=1078 x=24 y=24 width=10 height=9 xoffset=0 yoffset=7 xadvance=9 page=0 chnl=0 letter="ж" +char id=1079 x=72 y=147 width=8 height=9 xoffset=0 yoffset=7 xadvance=7 page=0 chnl=0 letter="з" +char id=1080 x=25 y=13 width=9 height=9 xoffset=0 yoffset=7 xadvance=8 page=0 chnl=0 letter="и" +char id=1081 x=35 y=96 width=9 height=12 xoffset=0 yoffset=4 xadvance=8 page=0 chnl=0 letter="й" +char id=1082 x=108 y=127 width=8 height=9 xoffset=0 yoffset=7 xadvance=7 page=0 chnl=0 letter="к" +char id=1083 x=35 y=109 width=9 height=9 xoffset=0 yoffset=7 xadvance=8 page=0 chnl=0 letter="л" +char id=1084 x=24 y=34 width=10 height=9 xoffset=0 yoffset=7 xadvance=9 page=0 chnl=0 letter="м" +char id=1085 x=90 y=158 width=8 height=9 xoffset=0 yoffset=7 xadvance=7 page=0 chnl=0 letter="н" +char id=1086 x=117 y=123 width=8 height=9 xoffset=0 yoffset=7 xadvance=7 page=0 chnl=0 letter="о" +char id=1087 x=117 y=84 width=8 height=9 xoffset=0 yoffset=7 xadvance=7 page=0 chnl=0 letter="п" +char id=1088 x=117 y=71 width=8 height=12 xoffset=0 yoffset=7 xadvance=7 page=0 chnl=0 letter="р" +char id=1089 x=81 y=157 width=8 height=9 xoffset=0 yoffset=7 xadvance=7 page=0 chnl=0 letter="с" +char id=1090 x=126 y=66 width=8 height=9 xoffset=0 yoffset=7 xadvance=7 page=0 chnl=0 letter="т" +char id=1091 x=63 y=142 width=8 height=12 xoffset=0 yoffset=7 xadvance=7 page=0 chnl=0 letter="у" +char id=1092 x=24 y=54 width=10 height=12 xoffset=0 yoffset=7 xadvance=9 page=0 chnl=0 letter="ф" +char id=1093 x=118 y=0 width=8 height=9 xoffset=0 yoffset=7 xadvance=7 page=0 chnl=0 letter="х" +char id=1094 x=13 y=35 width=10 height=10 xoffset=0 yoffset=7 xadvance=9 page=0 chnl=0 letter="ц" +char id=1095 x=63 y=88 width=8 height=9 xoffset=0 yoffset=7 xadvance=7 page=0 chnl=0 letter="ч" +char id=1096 x=24 y=138 width=10 height=9 xoffset=0 yoffset=7 xadvance=9 page=0 chnl=0 letter="ш" +char id=1097 x=0 y=90 width=12 height=10 xoffset=0 yoffset=7 xadvance=11 page=0 chnl=0 letter="щ" +char id=1098 x=24 y=44 width=10 height=9 xoffset=0 yoffset=7 xadvance=9 page=0 chnl=0 letter="ъ" +char id=1099 x=12 y=150 width=11 height=9 xoffset=0 yoffset=7 xadvance=10 page=0 chnl=0 letter="ы" +char id=1100 x=55 y=23 width=8 height=9 xoffset=0 yoffset=7 xadvance=7 page=0 chnl=0 letter="ь" +char id=1101 x=55 y=13 width=8 height=9 xoffset=0 yoffset=7 xadvance=7 page=0 chnl=0 letter="э" +char id=1102 x=13 y=14 width=11 height=9 xoffset=0 yoffset=7 xadvance=10 page=0 chnl=0 letter="ю" +char id=1103 x=54 y=156 width=8 height=9 xoffset=0 yoffset=7 xadvance=7 page=0 chnl=0 letter="я" +char id=1028 x=72 y=134 width=8 height=12 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="Є" +char id=1030 x=153 y=13 width=6 height=12 xoffset=0 yoffset=4 xadvance=5 page=0 chnl=0 letter="І" +char id=1031 x=54 y=111 width=8 height=15 xoffset=0 yoffset=1 xadvance=7 page=0 chnl=0 letter="Ї" +char id=1038 x=63 y=98 width=8 height=15 xoffset=0 yoffset=1 xadvance=7 page=0 chnl=0 letter="Ў" +char id=1168 x=63 y=114 width=8 height=14 xoffset=0 yoffset=2 xadvance=7 page=0 chnl=0 letter="Ґ" +char id=1108 x=55 y=33 width=8 height=9 xoffset=0 yoffset=7 xadvance=7 page=0 chnl=0 letter="є" +char id=1110 x=153 y=54 width=6 height=12 xoffset=0 yoffset=4 xadvance=5 page=0 chnl=0 letter="і" +char id=1111 x=153 y=0 width=7 height=12 xoffset=0 yoffset=4 xadvance=6 page=0 chnl=0 letter="ї" +char id=1118 x=54 y=127 width=8 height=15 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="ў" +char id=1169 x=45 y=95 width=8 height=11 xoffset=0 yoffset=5 xadvance=7 page=0 chnl=0 letter="ґ" +char id=196 x=54 y=82 width=8 height=15 xoffset=0 yoffset=1 xadvance=7 page=0 chnl=0 letter="Ä" +char id=228 x=46 y=0 width=8 height=12 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="ä" +char id=192 x=45 y=66 width=8 height=15 xoffset=0 yoffset=1 xadvance=7 page=0 chnl=0 letter="À" +char id=224 x=45 y=107 width=8 height=12 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="à" +char id=194 x=45 y=120 width=8 height=15 xoffset=0 yoffset=1 xadvance=7 page=0 chnl=0 letter="Â" +char id=226 x=45 y=82 width=8 height=12 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="â" +char id=193 x=54 y=66 width=8 height=15 xoffset=0 yoffset=1 xadvance=7 page=0 chnl=0 letter="Á" +char id=225 x=54 y=98 width=8 height=12 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="á" +char id=195 x=63 y=72 width=8 height=15 xoffset=0 yoffset=1 xadvance=7 page=0 chnl=0 letter="Ã" +char id=227 x=54 y=143 width=8 height=12 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="ã" +char id=197 x=64 y=32 width=8 height=16 xoffset=0 yoffset=0 xadvance=7 page=0 chnl=0 letter="Å" +char id=229 x=72 y=49 width=8 height=13 xoffset=0 yoffset=3 xadvance=7 page=0 chnl=0 letter="å" +char id=198 x=0 y=77 width=12 height=12 xoffset=0 yoffset=4 xadvance=11 page=0 chnl=0 letter="Æ" +char id=230 x=0 y=114 width=12 height=9 xoffset=0 yoffset=7 xadvance=11 page=0 chnl=0 letter="æ" +char id=200 x=72 y=118 width=8 height=15 xoffset=0 yoffset=1 xadvance=7 page=0 chnl=0 letter="È" +char id=232 x=63 y=155 width=8 height=12 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="è" +char id=202 x=64 y=0 width=8 height=15 xoffset=0 yoffset=1 xadvance=7 page=0 chnl=0 letter="Ê" +char id=234 x=99 y=52 width=8 height=12 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="ê" +char id=201 x=99 y=78 width=8 height=15 xoffset=0 yoffset=1 xadvance=7 page=0 chnl=0 letter="É" +char id=233 x=72 y=63 width=8 height=12 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="é" +char id=199 x=108 y=52 width=8 height=15 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="Ç" +char id=231 x=72 y=105 width=8 height=12 xoffset=0 yoffset=7 xadvance=7 page=0 chnl=0 letter="ç" +char id=286 x=55 y=43 width=8 height=15 xoffset=0 yoffset=1 xadvance=7 page=0 chnl=0 letter="Ğ" +char id=287 x=82 y=16 width=8 height=15 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="ğ" +char id=206 x=160 y=56 width=6 height=15 xoffset=0 yoffset=1 xadvance=5 page=0 chnl=0 letter="Î" +char id=238 x=160 y=104 width=6 height=12 xoffset=0 yoffset=4 xadvance=5 page=0 chnl=0 letter="î" +char id=205 x=160 y=88 width=6 height=15 xoffset=0 yoffset=1 xadvance=5 page=0 chnl=0 letter="Í" +char id=237 x=160 y=117 width=6 height=12 xoffset=0 yoffset=4 xadvance=5 page=0 chnl=0 letter="í" +char id=304 x=160 y=72 width=6 height=15 xoffset=0 yoffset=1 xadvance=5 page=0 chnl=0 letter="İ" +char id=305 x=64 y=49 width=6 height=9 xoffset=0 yoffset=7 xadvance=5 page=0 chnl=0 letter="ı" +char id=209 x=24 y=148 width=9 height=16 xoffset=0 yoffset=0 xadvance=8 page=0 chnl=0 letter="Ñ" +char id=241 x=63 y=129 width=8 height=12 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="ñ" +char id=214 x=64 y=16 width=8 height=15 xoffset=0 yoffset=1 xadvance=7 page=0 chnl=0 letter="Ö" +char id=246 x=108 y=81 width=8 height=12 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="ö" +char id=210 x=73 y=0 width=8 height=15 xoffset=0 yoffset=1 xadvance=7 page=0 chnl=0 letter="Ò" +char id=242 x=73 y=29 width=8 height=12 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="ò" +char id=212 x=82 y=0 width=8 height=15 xoffset=0 yoffset=1 xadvance=7 page=0 chnl=0 letter="Ô" +char id=244 x=90 y=61 width=8 height=12 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="ô" +char id=211 x=90 y=90 width=8 height=15 xoffset=0 yoffset=1 xadvance=7 page=0 chnl=0 letter="Ó" +char id=243 x=99 y=39 width=8 height=12 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="ó" +char id=213 x=99 y=149 width=8 height=15 xoffset=0 yoffset=1 xadvance=7 page=0 chnl=0 letter="Õ" +char id=245 x=108 y=68 width=8 height=12 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="õ" +char id=338 x=0 y=101 width=12 height=12 xoffset=0 yoffset=4 xadvance=11 page=0 chnl=0 letter="Œ" +char id=339 x=0 y=67 width=12 height=9 xoffset=0 yoffset=7 xadvance=11 page=0 chnl=0 letter="œ" +char id=216 x=0 y=53 width=12 height=13 xoffset=0 yoffset=3 xadvance=11 page=0 chnl=0 letter="Ø" +char id=248 x=13 y=24 width=10 height=10 xoffset=0 yoffset=6 xadvance=9 page=0 chnl=0 letter="ø" +char id=350 x=117 y=107 width=8 height=15 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="Ş" +char id=351 x=90 y=106 width=8 height=12 xoffset=0 yoffset=7 xadvance=7 page=0 chnl=0 letter="ş" +char id=220 x=90 y=74 width=8 height=15 xoffset=0 yoffset=1 xadvance=7 page=0 chnl=0 letter="Ü" +char id=252 x=72 y=92 width=8 height=12 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="ü" +char id=217 x=72 y=76 width=8 height=15 xoffset=0 yoffset=1 xadvance=7 page=0 chnl=0 letter="Ù" +char id=249 x=55 y=0 width=8 height=12 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="ù" +char id=219 x=81 y=86 width=8 height=15 xoffset=0 yoffset=1 xadvance=7 page=0 chnl=0 letter="Û" +char id=251 x=63 y=59 width=8 height=12 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="û" +char id=218 x=117 y=22 width=8 height=15 xoffset=0 yoffset=1 xadvance=7 page=0 chnl=0 letter="Ú" +char id=250 x=81 y=102 width=8 height=12 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="ú" +char id=376 x=81 y=141 width=8 height=15 xoffset=0 yoffset=1 xadvance=7 page=0 chnl=0 letter="Ÿ" +char id=255 x=90 y=32 width=8 height=15 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="ÿ" +char id=191 x=99 y=107 width=8 height=12 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=0 letter="¿" +char id=161 x=153 y=124 width=6 height=12 xoffset=0 yoffset=4 xadvance=5 page=0 chnl=0 letter="¡" +char id=223 x=45 y=39 width=9 height=12 xoffset=0 yoffset=4 xadvance=8 page=0 chnl=0 letter="ß" +char id=32 x=0 y=0 width=0 height=0 xoffset=0 yoffset=0 xadvance=4 page=0 chnl=0 letter=" " +char id=9 x=0 y=0 width=0 height=0 xoffset=0 yoffset=0 xadvance=32 page=0 chnl=0 letter=" " + +kernings count=0 diff --git a/data/fonts/good-neighbors.png b/data/fonts/good-neighbors.png new file mode 100644 index 0000000..f223403 Binary files /dev/null and b/data/fonts/good-neighbors.png differ diff --git a/doc/api.texi b/doc/api.texi index ace2e7f..df68889 100644 --- a/doc/api.texi +++ b/doc/api.texi @@ -1578,12 +1578,13 @@ Return @code{#t} if @var{font} is a bold font. Return @code{#t} if @var{font} is an italicized font. @end deffn -@deffn {Procedure} draw-text @var{font} @var{text} @var{position} - [#:origin] [#:scale] [#:rotation] [#:blend-mode] +@deffn {Procedure} draw-text @var{text} @var{position} + [#:font] [#:origin] [#:scale] [#:rotation] [#:blend-mode] [#:start 0] [#:end @code{(string-length text)}] Draw the string @var{text} with the first character starting at -@var{position} using @var{font}. +@var{position} using @var{font}. If @var{font} is not specified, a +built-in font is used. @example (draw-text font "Hello, world!" (vec2 128.0 128.0)) diff --git a/examples/fonts/AUTHORS b/examples/fonts/AUTHORS deleted file mode 100644 index 13a3415..0000000 --- a/examples/fonts/AUTHORS +++ /dev/null @@ -1,5 +0,0 @@ --*- org -*- - -* good_neighbors_starling.png, good_neighbors_starling.xml - By PROWNE and Clint Bellanger, CC0 - http://opengameart.org/content/good-neighbors-pixel-font-starlingunity-version-updated diff --git a/examples/fonts/good_neighbors_starling.png b/examples/fonts/good_neighbors_starling.png deleted file mode 100644 index 74197a6..0000000 Binary files a/examples/fonts/good_neighbors_starling.png and /dev/null differ diff --git a/examples/fonts/good_neighbors_starling.xml b/examples/fonts/good_neighbors_starling.xml deleted file mode 100644 index 0a7afde..0000000 --- a/examples/fonts/good_neighbors_starling.xml +++ /dev/null @@ -1,244 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/grid.scm b/examples/grid.scm index 39ad50e..6fab47a 100644 --- a/examples/grid.scm +++ b/examples/grid.scm @@ -10,7 +10,6 @@ (chickadee sdl) (sdl2 input keyboard)) -(define font #f) (define grid (make-grid)) (define item-color (make-color 0.7 0.0 0.0 0.5)) (define cell-color (make-color 0.0 0.7 0.0 0.2)) @@ -20,7 +19,6 @@ (define player-velocity #v(0.0 0.0)) (define (load) - (set! font (load-font "fonts/good_neighbors_starling.xml")) (grid-add grid 'wall-left 0 0 32 480) (grid-add grid 'wall-top 32 448 576 32) (grid-add grid 'wall-right 608 0 32 480) @@ -75,7 +73,7 @@ (for-each-cell (lambda (cell x y) (set-vec2-x! %cell-count-pos (+ (* x size) (/ size 2))) (set-vec2-y! %cell-count-pos (+ (* y size) (/ size 2))) - (draw-text font (number->string* (cell-count cell)) + (draw-text (number->string* (cell-count cell)) %cell-count-pos)) grid))) (for-each-item (lambda (item rect) diff --git a/examples/nine-patch.scm b/examples/nine-patch.scm index 7e0db1a..d20ba06 100644 --- a/examples/nine-patch.scm +++ b/examples/nine-patch.scm @@ -7,14 +7,12 @@ (chickadee sdl)) (define image #f) -(define font #f) (define (load) - (set! image (load-image "images/dialog-box.png")) - (set! font (load-font "fonts/good_neighbors_starling.xml"))) + (set! image (load-image "images/dialog-box.png"))) (define (draw alpha) (draw-nine-patch image (make-rect 192.0 192.0 256.0 96.0) #:margin 6) - (draw-text font "I am error." #v(200.0 266.0))) + (draw-text "I am error." #v(200.0 266.0))) (run-game/sdl #:load load #:draw draw) diff --git a/examples/text.scm b/examples/text.scm index 0903a90..40b7653 100644 --- a/examples/text.scm +++ b/examples/text.scm @@ -3,21 +3,12 @@ (chickadee render font) (chickadee sdl)) -(define font #f) - -(define (load) - (set! font (load-font "fonts/good_neighbors_starling.xml"))) - (define (draw alpha) - (draw-text font "(draw-text font \"Hello, world!\" (vec2 100.0 200.0))" + (draw-text "(draw-text font \"Hello, world!\" (vec2 100.0 200.0))" #v(100.0 200.0)) - (draw-text font "Chickadee is a game development toolkit for Guile Scheme." + (draw-text "Chickadee is a game development toolkit for Guile Scheme." #v(100.0 150.0)) - (draw-text font "The quick brown fox jumps over the lazy dog" + (draw-text "The quick brown fox jumps over the lazy dog" #v(100.0 100.0))) -(define (key-press key scan modifiers repeat?) - (when (eq? key 'q) - (abort-game))) - -(run-game/sdl #:load load #:draw draw #:key-press key-press) +(run-game/sdl #:draw draw) -- cgit v1.2.3