Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with Courier font #5

Open
hsyl20 opened this issue May 18, 2021 · 1 comment
Open

Issue with Courier font #5

hsyl20 opened this issue May 18, 2021 · 1 comment

Comments

@hsyl20
Copy link
Owner

hsyl20 commented May 18, 2021

It was reported to me that the following code using Courier font produces invalid font output:

#!/usr/bin/env stack
-- stack --resolver lts-17.12 script --package HPDF
{-# LANGUAGE OverloadedStrings #-}

import Graphics.PDF

main :: IO ()
main = do
   Just courier <- mkStdFont Courier
   runPdf "test-pdf.pdf" standardDocInfo (PDFRect 0 0 (8.5*72) (11*72)) $ do
      page1 <- addPage Nothing
      newSection "Foo" Nothing Nothing $ do
         drawWithPage page1 $ do
            strokeColor black
            displayFormattedText (Rectangle (100 :+ 100) (300 :+ 300)) NormalParagraph (Font (PDFFont courier 12) black black)  $ do
               paragraph $ do
                  txt "for exAmple the 'A' chAr should be different"

I couldn't reproduce the issue. pdffonts reports an issue though:

❯ pdffonts test-pdf.pdf
Internal Error: xref num 971476492 not found but needed, try to reconstruct<0a>
name                                 type              encoding         emb sub uni object ID
------------------------------------ ----------------- ---------------- --- --- --- ---------
Courier                              Type 1            MacRoman         no  no  no  [none]
@hsyl20
Copy link
Owner Author

hsyl20 commented May 18, 2021

The font is perhaps not installed? On my system (ArchLinux) okular uses the font in /usr/share/fonts/Type1/cour.pfa which is provided by xorg-fonts-type1 package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant