- Posts: 4
- Thank you received: 0
Microsoft Windows Phone 8.1 support ends (13 Jul 2017)
Microsoft has ended support for Windows Phone 8.1
Questions about Android development and PDF
Annotation font not rendering
- rpankhurst
- Topic Author
- Offline
- New Member
-
Less
More
9 years 8 months ago #10815
by rpankhurst
Annotation font not rendering was created by rpankhurst
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?
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?
9 years 8 months ago #10819
by Davide
Replied by Davide on topic Annotation font not rendering
Hi,
to set the font to the annot you should use something like that (Global.java) :
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?
to set the font to the annot you should use something like that (Global.java) :
Code:
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?
- rpankhurst
- Topic Author
- Offline
- New Member
-
Less
More
- Posts: 4
- Thank you received: 0
9 years 8 months ago #10821
by rpankhurst
Replied by rpankhurst on topic Annotation font not rendering
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)
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)
9 years 8 months ago #10823
by Davide
Replied by Davide on topic Annotation font not rendering
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.
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.
- rpankhurst
- Topic Author
- Offline
- New Member
-
Less
More
- Posts: 4
- Thank you received: 0
9 years 8 months ago - 9 years 8 months ago #10841
by rpankhurst
Replied by rpankhurst on topic Annotation font not rendering
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
with
it solved the problem.
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
Code:
if (!setAnnotFont("DroidSansFallback") &&
!setAnnotFont("Arimo") && face_name != null) {
setAnnotFont(face_name);
}
Code:
setAnnotFont("Arimo");
Last edit: 9 years 8 months ago by rpankhurst. Reason: Added code formatting to code snippet for readability
Time to create page: 0.422 seconds