load-font 0.1.0.0 → 0.1.0.1
raw patch · 8 files changed
+80/−67 lines, 8 filesdep ~fltkhsPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: fltkhs
API changes (from Hackage documentation)
Files
- .gitignore +0/−3
- README.org +8/−4
- load-font.cabal +13/−3
- package.yaml +0/−48
- screenshot-demo.jpg binary
- src/Graphics/UI/Font/Load.hs +59/−0
- src/cbits/font_load.h +0/−2
- stack.yaml +0/−7
− .gitignore
@@ -1,3 +0,0 @@-.stack-work/-load-font.cabal-*~
README.org view
@@ -1,15 +1,19 @@ * Load Font- This library aims to a cross-platform (Win/Lin/OSX) way to load a custom font bundled with your Haskell app. The font is automatically unloaded when the app exits.+ This library aims to a cross-platform (Win/Lin/OSX) GUI agnostic way to load a custom font bundled with your Haskell app and is [[https://hackage.haskell.org/package/load-font/docs/Graphics-UI-Font-Load.html][extensively]] documented on Hackage. - It ships with the [[https://www.dafont.com/moon-phases.font][Moon Phases]] font and a GUI demo, ~load-font-exe~ that uses the [[https://hackage.haskell.org/package/fltkhs][FLTKHS]] Haskell GUI library to show that Moon Phases is indeed loaded. It has been tested on Arch Linux, Windows 10 and OSX Sierra.+* Load Font Demo - While the demo uses FLTKHS font loading and unloading it is agnostic to the GUI framework. FLTKHS is used here simply because it's the easiest to build and install.+ Included is a demo that shows off the library, but it is optional and does not build unless you set the ~demo~ flag as in the build instructions below. + It builds an executable ~load-font-exe~ which uses the [[https://hackage.haskell.org/package/fltkhs][FLTKHS]] GUI framework and bundles the [[https://www.dafont.com/moon-phases.font][Moon Phases]] font. It has been tested on Arch Linux, Windows 10 and OSX Sierra.++ The demo uses FLTKHS font loading and unloading but it is agnostic to the GUI framework. FLTKHS is used here simply because it's the easiest to build and install.+ This library owes its existence to [[https://groups.google.com/d/msg/fltkgeneral/uAdg8wOLiMk/_CzBu995AwAJ][Albrecht Schlosser's post on the FLTK mailing list]]. To run the demo, clone this repo and do: #+BEGIN_EXAMPLE- > stack build --flag fltkhs:bundled+ > stack build --flag load-font:demo --flag fltkhs:bundled > stack exec load-font-exe #+END_EXAMPLE
load-font.cabal view
@@ -2,10 +2,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: f0d79e490fdec5930d56c78d859e5922183c991f5459dbbf6b10f130560ffb12+-- hash: a35a0008f735ae0a69c126ac9ea249d60a22cd0d34dc3c8c91374c6f09aea5f1 name: load-font-version: 0.1.0.0+version: 0.1.0.1 synopsis: A cross platform library for loading bundled fonts into your application description: Please see the README on Github at <https://github.com/deech/font-load#readme> category: UI,Graphics,GUI,User Interfaces, Font@@ -21,6 +21,7 @@ extra-source-files: ChangeLog.md+ README.org src/cbits/font_load.c data-files:@@ -30,6 +31,11 @@ type: git location: https://github.com/deech/load-font +flag demo+ description: Build the demo+ manual: True+ default: False+ library hs-source-dirs: src@@ -55,9 +61,13 @@ ghc-options: -O2 build-depends: base >=4.7 && <5- , fltkhs >=0.5.4.4+ , fltkhs >=0.5.4.5 , load-font , text >=1.2.2.0+ if flag(demo)+ buildable: True+ else+ buildable: False if (os(linux) || os(windows)) ghc-options: -pgml g++ "-optl-Wl,--allow-multiple-definition" "-optl-Wl,--whole-archive" "-optl-Wl,-Bstatic" "-optl-Wl,-lfltkc" "-optl-Wl,-Bdynamic" "-optl-Wl,--no-whole-archive" else
− package.yaml
@@ -1,48 +0,0 @@-name: load-font-version: 0.1.0.0-github: "deech/load-font"-license: BSD3-author: "Aditya Siram"-maintainer: "aditya.siram@gmail.com"-copyright: "2018 Aditya Siram"-synopsis: A cross platform library for loading bundled fonts into your application-category: UI,Graphics,GUI,User Interfaces, Font-extra-source-files:-- src/cbits/font_load.c-- README.md-- ChangeLog.md-data-files:-- test-fonts/*.ttf--description: Please see the README on Github at <https://github.com/deech/font-load#readme>--dependencies:-- base >= 4.7 && < 5--library:- source-dirs: src- exposed-modules: Graphics.UI.Font.Load- build-tools: c2hs- c-sources:- - src/cbits/font_load.c- include-dirs: src/cbits--executables:- load-font-exe:- main: Main.hs- source-dirs: app- ghc-options:- - -threaded- - -rtsopts- - -with-rtsopts=-N- dependencies:- - load-font- - fltkhs >= 0.5.4.4- - text >= 1.2.2.0- ghc-options: -O2- when:- - condition: (os(linux) || os(windows))- then:- ghc-options: -pgml g++ "-optl-Wl,--allow-multiple-definition" "-optl-Wl,--whole-archive" "-optl-Wl,-Bstatic" "-optl-Wl,-lfltkc" "-optl-Wl,-Bdynamic" "-optl-Wl,--no-whole-archive"- else:- ghc-options: "-optl-Wl,-lfltkc"
− screenshot-demo.jpg
binary file changed (13317 → absent bytes)
src/Graphics/UI/Font/Load.hs view
@@ -1,5 +1,17 @@ module Graphics.UI.Font.Load (+ -- * Motivation+ --+ -- $Motivation++ -- * Quick Start+ --+ -- $QuickStart++ -- * The API+ --+ -- $TheAPI+ loadFont , unloadFont )@@ -8,6 +20,53 @@ import Control.Applicative import Foreign.C.Types import qualified Graphics.UI.Font.LoadCWrapper as CWrapper++-- $Motivation+-- The goal of this library is to provide a simple way of giving an application access to a font that+-- isn't available system-wide allowing you to bundle fonts with your executable ensuring uniform look-and-feel+-- across platforms. It has been tested on Windows 10, Arch Linux and OSX Sierra++-- $QuickStart+-- While this package ships with a fully working [demo](https://github.com/deech/load-font#load-font-demo) the basic+-- usage is lost in all of the [GUI code](https://github.com/deech/load-font/blob/master/app/Main.hs).+-- And frankly the demo takes a while to build and pulls in a GUI library dependency so it's not worth it+-- unless you really want to convince yourself the library works. To get started with the minimum fuss+-- thrill at the [screenshot](https://github.com/deech/load-font#load-font-demo), take my word for it+-- and do the following:+--+-- - Add your fonts to the Cabal file's <https://www.haskell.org/cabal/users-guide/developing-packages.html#pkg-field-data-files data-files stanza> (completely optional, you can load fonts from anywhere on the file system but highly recommended for portability):+--+-- @+-- data-files:+-- fonts/*.ttf+-- @+--+-- - Add the @load-font@ dependency:+--+-- @+-- executable myAwesomeApp+-- ...+-- build-depends:+-- ...+-- , load-font+-- ...+-- ...+-- @+--+-- - Somewhere in your app code before you use the font :+--+-- @+--+-- import Paths_myAwesomeApp+-- ...+-- myAwesomeFunction = do+-- ...+-- fontPath <- getDataFileName "fonts/my-awesome-font.ttf"+-- loadFont fontPath+-- ...+--+-- @+ -- | -- Remove a private font located at 'FilePath' from the application. --
− src/cbits/font_load.h
@@ -1,2 +0,0 @@-int load_private_font(const char* path);-void unload_private_font(const char* path);
− stack.yaml
@@ -1,7 +0,0 @@-resolver: lts-10.7-packages:-- .-allow-newer: true-extra-deps:-- c2hs-0.28.3-- fltkhs-0.5.4.4