line2pdf 0.0.2 → 0.0.3
raw patch · 3 files changed
+28/−30 lines, 3 filessetup-changed
Files
- Setup.lhs +1/−8
- line2pdf.cabal +3/−3
- line2pdf.hs +24/−19
Setup.lhs view
@@ -3,12 +3,5 @@ import System.Cmd import Distribution.Simple -main = defaultMainWithHooks $ simpleUserHooks- { buildHook = myBuild (buildHook simpleUserHooks) }--myBuild doBuild x y z w = do- rv <- doBuild x y z w- system "make -f Makefile.pdfdump"- return rv-+main = defaultMainWithHooks simpleUserHooks \end{code}
line2pdf.cabal view
@@ -1,5 +1,5 @@ name: line2pdf-version: 0.0.2+version: 0.0.3 copyright: 2008 Audrey Tang license: BSD3 license-file: LICENSE@@ -17,8 +17,8 @@ description: Choose the new smaller, split-up base package. executable line2pdf- main-is: line2pdf.hs- extensions: ImplicitParams+ main-is: line2pdf.hs+ extensions: ImplicitParams if flag(small_base) build-depends: base >= 3, containers, bytestring else
line2pdf.hs view
@@ -105,17 +105,17 @@ info <- printObj $ "/CreationDate(D:20080707163949+08'00')" ++ "/Producer(line2pdf.hs)" ++ "/Title(Untitled)"- encoding <- printObj strDefaultEncoding- everyFont <- (`mapM` ([1..] `zip` baseFonts)) $ \(n, font) -> do+ encoding <- printObj strDefaultEncoding+ everyFont <- (`mapM` ([1..] `zip` baseFonts)) $ \(n, font) -> do markObj $ \obj -> do pr$ "/Type/Font" ++ "/Subtype/Type1" ++ "/Name/F" pr$ show (n :: Int) pr$ "/Encoding " ++ show encoding ++ " 0 R" pr$ font return $ "/F" ++ show n ++ " " ++ show obj ++ " 0 R"- tradFont <- tradChineseFonts- root <- incrObj- tPages <- incrObj+ tradFont <- writeTradChineseFonts+ root <- incrObj+ tPages <- incrObj markObj $ \resources -> do pr$ "/Font<<" ++ concat everyFont ++ concat tradFont ++ ">>" ++ "/ProcSet[/PDF/Text]" ++ "/XObject<<>>"@@ -281,26 +281,25 @@ pageHeight :: Int pageHeight = 612 -tradChineseFonts :: M [String]-tradChineseFonts = do+writeTradChineseFonts :: M [String]+writeTradChineseFonts = do tradFont <- newRef [] let addFont o fn = modifyRef tradFont- (("/F" ++ show (fn :: Int) ++ " " ++ show o ++ " 0 R"):)-- markFont fn suffix = do+ (("/F" ++ show fn ++ " " ++ show o ++ " 0 R"):)+ markFont fn name = do markObj $ \obj -> do addFont obj fn pr$ "/Type/Font" ++ "/Subtype/Type0" ++ "/Name/F"- pr$ show fn ++ "/BaseFont/MingLiU"- pr$ suffix ++ "/Encoding/ETen-B5-H"+ pr$ show fn ++ "/BaseFont/"+ pr$ name ++ "/Encoding/ETen-B5-H" pr$ "/DescendantFonts[" ++ show (succ obj) ++ " 0 R]" markObj $ \obj -> do pr$ "/Type/Font" ++ "/Subtype/CIDFontType2"- ++ "/BaseFont/MingLiU"- pr$ suffix ++ "/FontDescriptor " ++ show (succ obj) ++ " 0 R"+ ++ "/BaseFont/"+ pr$ name ++ "/FontDescriptor " ++ show (succ obj) ++ " 0 R" ++ "/CIDSystemInfo<<" ++ "/Registry(Adobe)" ++ "/Ordering(CNS1)"@@ -309,7 +308,8 @@ ++ "/DW 1000" ++ "/W[13500 14000 500]" printObj $ "/Type/FontDescriptor"- ++ "/FontName/MingLiU"+ ++ "/FontName/"+ ++ takeWhile (/= ',') name ++ "/FontBBox[0 -199 1000 801]" ++ "/Flags 7" ++ "/CapHeight 0"@@ -317,8 +317,13 @@ ++ "/Descent -199" ++ "/StemV 0" ++ "/ItalicAngle 0"- markFont 30 ""- markFont 31 ",Italic"- markFont 32 ",Bold"- markFont 33 ",BoldItalic"+ mapM_ (uncurry markFont) tradChineseFonts readRef tradFont++tradChineseFonts :: [(Int, String)]+tradChineseFonts =+ [ (30, "MingLiU")+ , (31, "MingLiU,Italic")+ , (32, "MingLiU,Bold")+ , (33, "MingLiU,BoldItalic")+ ]