Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
Questions about Android development and PDF
  • Page:
  • 1

TOPIC:

Annotation font not rendering 8 years 10 months ago #10815

  • rpankhurst
  • rpankhurst's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 4
  • Thank you received: 0
Using 3.7beta2 but the same problem exists with 3.6.2
When I enter text into an annotation text box on a PDF the text displays as squares when the edit box goes away.
Annotations populated in other software (ie Acrobat on PC) display correctly.
When I change text in a field that displays correctly it displays as squares in the PDF afterward.
Attached is an example. The first field was filled in using Acrobat on PC. The second field was filled in using SetEditText(). It displays with squares on PC until edited, then it's corrected.
I've added all the fonts listed in the PDF using Global.Init(), fontFileMapping() calls to map them to Arimo without success.
Calling Annotation.SetEditFont(Document.NewFontCID("Arimo", 0)) on the appropriate annotation and document instance crashes with the following exception:
java.lang.UnsatisfiedLinkError: No implementation found for boolean com.radaee.pdf.Page.setAnnotEditFont(long, long, long) (tried Java_com_radaee_pdf_Page_setAnnotEditFont and Java_com_radaee_pdf_Page_setAnnotEditFont__JJJ)
Any thoughts?

File Attachment:

File Name: FullTest.pdf
File Size:56 KB
Attachments:

Please Log in or Create an account to join the conversation.

Annotation font not rendering 8 years 10 months ago #10819

  • Davide
  • Davide's Avatar
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 814
  • Thank you received: 65
Hi,
to set the font to the annot you should use something like that (Global.java) :
if (!setAnnotFont("DroidSansFallback") &&
            !setAnnotFont("Arimo") && face_name != null) {
            setAnnotFont(face_name);
        }

The method you mentioned is used when you create an edit text annot programmatically.

Can you please send us the font you are trying to embed?

Please Log in or Create an account to join the conversation.

Annotation font not rendering 8 years 10 months ago #10821

  • rpankhurst
  • rpankhurst's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 4
  • Thank you received: 0
I'm not actually trying to embed any font
Checking the PDF in Acrobat provides the following list of fonts used in the document:
ArialMT
Calibri-Bold
Helvetica
SegoeUI
ZapfDingbats
so I added the line to Global.java
fontfileMapping("SegoeUI, "Arimo");
and changed nothing else. The code snippet you provided appears at line 643 of my Global.java.
Arimo appears to be included in the build (at least when I do a file existence check it's there)

Please Log in or Create an account to join the conversation.

Annotation font not rendering 8 years 9 months ago #10823

  • Davide
  • Davide's Avatar
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 814
  • Thank you received: 65
Hi,
first of all please check if fontfileMapping returns true.
Are you sure that the full characteristic of SegoeUI are in the truetype font Arimo?
If not, you should follow this article to import the SegoeUI font and then setAnnotFont as suggested before.

Please Log in or Create an account to join the conversation.

Annotation font not rendering 8 years 9 months ago #10841

  • rpankhurst
  • rpankhurst's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 4
  • Thank you received: 0
fontFileMapping does return true.
I think I've discovered the problem, though. My usual test device was unavailable and when I tried the app on another device the problem wasn't there.
I guess the DroidSansFallback font on my test device doesn't contain Latin characters, so when I replaced the line
if (!setAnnotFont("DroidSansFallback") &&
            !setAnnotFont("Arimo") && face_name != null) {
            setAnnotFont(face_name);
}
with
		setAnnotFont("Arimo");
it solved the problem.

Please Log in or Create an account to join the conversation.

Last edit: by rpankhurst. Reason: Added code formatting to code snippet for readability
  • Page:
  • 1
Powered by Kunena Forum