packages feed

woffex (empty) → 0.1

raw patch · 4 files changed

+98/−0 lines, 4 filesdep +basedep +binarydep +bytestringsetup-changed

Dependencies added: base, binary, bytestring, filepath, zlib

Files

+ LICENSE view
@@ -0,0 +1,30 @@+Copyright (c)2011, Andrew Drake++All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions are met:++    * Redistributions of source code must retain the above copyright+      notice, this list of conditions and the following disclaimer.++    * Redistributions in binary form must reproduce the above+      copyright notice, this list of conditions and the following+      disclaimer in the documentation and/or other materials provided+      with the distribution.++    * Neither the name of Andrew Drake nor the names of other+      contributors may be used to endorse or promote products derived+      from this software without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ Main.hs view
@@ -0,0 +1,30 @@+import Control.Monad+import qualified Data.ByteString.Lazy as B+import Data.Binary.Get+import Data.Binary.Put+import Data.Sfnt.Put+import Data.Woff.Get+import System.Environment+import System.FilePath++main = do+  args <- getArgs+  unless (length args >= 1) $ fail "Usage: woffex <in> [outprefix]"+  let input = head args+  let output = if length args == 1 then input else args !! 1+  +  woff <- fmap (runGet getWoffFile) $ B.readFile (head args)+  let sfnt = woffSfnt woff+  let sfntBits = runPut $ putSfntFile sfnt++  let ext = case sfFlavor sfnt of+        0x00010000 -> "ttf" -- Fixed-pont "1.0" - TrueType 1.0+        0x74727565 -> "ttf" -- "true" - Apple TrueType (?)+        0x74797031 -> "ttf" -- "typ1" - Apple TrueType (?)+        0x4f54544f -> "otf" -- "OTTO" - OpenType+        _ -> "sfnt"+  B.writeFile (replaceExtension output ext) sfntBits+  when (B.length (woffMetadata woff) > 0) $+    B.writeFile (replaceExtension output ".xml") $ woffMetadata woff+  when (B.length (woffPrivate woff) > 0) $+    B.writeFile (replaceExtension output ".dat") $ woffPrivate woff
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ woffex.cabal view
@@ -0,0 +1,36 @@+Name:                woffex+Version:             0.1+Author:              Andrew Drake+Maintainer:          adrake@adrake.org+Stability:           experimental++Synopsis:            Web Open Font Format (WOFF) unpacker.+License:             BSD3+License-file:        LICENSE+Copyright:           (c) 2011 Andrew Drake+Category:            Data+Build-type:          Simple+Description:+  This is a small program to repackage fonts in the Web Open Font Format (WOFF)+  to the Sfnt file format. The code contains a general WOFF parser and Sfnt+  file generator which could be split out and extended to be useful for other+  applications.+  .+  [@WOFF Spec@] <http://www.w3.org/TR/WOFF/>+  .+  [@Sfnt Spec@] <http://developer.apple.com/fonts/TTRefMan/RM06/Chap6.html>++Cabal-version:       >= 1.6++Source-Repository head+  Type:     git+  Location: http://git.hax.so/pub/scm/woffex.git++Executable woffex+  Main-is: Main.hs+  Build-depends:+    base >= 4 && < 5,+    binary >= 0.5.0.2 && < 0.6,+    bytestring >= 0.9.1.10 && < 0.10,+    filepath >= 1.2.0.0 && < 1.3,+    zlib >= 0.5.3.1 && < 0.6