Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 04-09-2009, 05:54 AM   #1 (permalink)
ftm
FasterThanMonkeys.com
 
Join Date: Mar 2009
Location: Southern California
Posts: 523
ftm is on a distinguished road
Send a message via AIM to ftm
Default PDF Font Problem - can't get CIDs for glyphs

Has anyone seen this error before in their console:

<Error>: can't get CIDs for glyphs for 'ArialMT'.

I am trying to use an Arial font for outputting to a PDFContext, and am getting this error over and over in my console.

I have tried different fonts, and they all seem to have this same error (just font name changes).

I also get an error like this:

<Error>: CGFont/Freetype: The function 'get_subset_format' is currently unimplemented


Any help on getting rid of these errors would be greatly appreciated. Everything actually renders fine in my PDF, but the vast # of these errors in my console makes it very hard to troubleshoot my app which has several NSLog(...) lines that get lost amongst the sea of errors as noted above.

Thank you.
__________________


Website: http://fasterthanmonkeys.com

iScore Baseball Scorekeeper Top baseball scorekeeping app for iPhone
Bug Squash Reached #1 kids game in 15+ countries including USA, now with OpenFeint
Jam Packed! Fun puzzle game for all ages
Jam Packed Christmas Holiday puzzle game!
iScore Basketball Scorekeeper Best basketball scorekeeping application
ftm is offline   Reply With Quote
Old 04-10-2009, 03:26 AM   #2 (permalink)
ftm
FasterThanMonkeys.com
 
Join Date: Mar 2009
Location: Southern California
Posts: 523
ftm is on a distinguished road
Send a message via AIM to ftm
Default

Nobody?
__________________


Website: http://fasterthanmonkeys.com

iScore Baseball Scorekeeper Top baseball scorekeeping app for iPhone
Bug Squash Reached #1 kids game in 15+ countries including USA, now with OpenFeint
Jam Packed! Fun puzzle game for all ages
Jam Packed Christmas Holiday puzzle game!
iScore Basketball Scorekeeper Best basketball scorekeeping application
ftm is offline   Reply With Quote
Old 04-16-2009, 09:09 PM   #3 (permalink)
New Member
 
Join Date: Mar 2009
Posts: 1
ericguedespinto is on a distinguished road
Default

Quote:
Originally Posted by ftm View Post
Has anyone seen this error before in their console:

<Error>: can't get CIDs for glyphs for 'ArialMT'.


I also get an error like this:

<Error>: CGFont/Freetype: The function 'get_subset_format' is currently unimplemented


Thank you.
I feel your pain, as I 'm getting this errors too...

So this is what I've found:

the iPhone only has about 11 families of fonts, being :

American Typewriter
American Typewriter Condensed
Arial
Arial Rounded MT Bold
Courier New
Georgia
Helvetica
Marker Felt
Times New Roman
Trebuchet MS
Verdana
Zapfino

to me, this errors comme with another that says: can't get CIDs for glyphs for `MyriadSet-Bold', so I'm guessing it happens because I'm trying to render a PDFpage that tries to load a non-embedded / non-platform font.
ericguedespinto is offline   Reply With Quote
Old 04-16-2009, 09:35 PM   #4 (permalink)
ftm
FasterThanMonkeys.com
 
Join Date: Mar 2009
Location: Southern California
Posts: 523
ftm is on a distinguished road
Send a message via AIM to ftm
Default

I have tried Arial, Verdana, Helvetica, Times New Roman... all supposedly on the phone, but the all cause the error. I can't believe nobody has a solution for this. I have tried Google, developer.apple.com, and every other source for information, but nobody seems to have the answer.

I think this might be the first question I have actually posed in this forum while answering many, so I am really hoping someone can reciprocate.

The odd things is everything actually WORKS just fine... I see my text on both the iPhone and when viewing the generated PDFs on other machines. It is just very annoying to get all the error messages which making seeing my "real" NSLog statements more difficult when surrounded by a hundred of these errors.

Anyone???


Thank you.
__________________


Website: http://fasterthanmonkeys.com

iScore Baseball Scorekeeper Top baseball scorekeeping app for iPhone
Bug Squash Reached #1 kids game in 15+ countries including USA, now with OpenFeint
Jam Packed! Fun puzzle game for all ages
Jam Packed Christmas Holiday puzzle game!
iScore Basketball Scorekeeper Best basketball scorekeeping application
ftm is offline   Reply With Quote
Old 04-29-2009, 05:53 PM   #5 (permalink)
ftm
FasterThanMonkeys.com
 
Join Date: Mar 2009
Location: Southern California
Posts: 523
ftm is on a distinguished road
Send a message via AIM to ftm
Default

bump.

Really? Nobody?
__________________


Website: http://fasterthanmonkeys.com

iScore Baseball Scorekeeper Top baseball scorekeeping app for iPhone
Bug Squash Reached #1 kids game in 15+ countries including USA, now with OpenFeint
Jam Packed! Fun puzzle game for all ages
Jam Packed Christmas Holiday puzzle game!
iScore Basketball Scorekeeper Best basketball scorekeeping application
ftm is offline   Reply With Quote
Old 05-21-2009, 05:01 PM   #6 (permalink)
Registered Member
 
Join Date: May 2009
Posts: 4
Jesse13 is on a distinguished road
Default Me Too

Hello there,

Unfortunately I do not have an answer, but I am having the same problem and will be trying to sort it out as I am working on generating pdfs.

I can say that I went looking for the 'get_subset_font' function, and i can't even find it, even in the Core Graphics Framework.

J
Jesse13 is offline   Reply With Quote
Old 05-21-2009, 05:09 PM   #7 (permalink)
ftm
FasterThanMonkeys.com
 
Join Date: Mar 2009
Location: Southern California
Posts: 523
ftm is on a distinguished road
Send a message via AIM to ftm
Default

Apparently not many people are creating PDF's as I have gotten no answers, and it happens with all sample code I have found for writing text to a PDF.

I have spent MANY hours trying to come up with a solution, and finally gave up. Our product shipped with these error messages, adn everything works fine. I just hate that when I try and use NSLog(...) for debugging, I now need to wade through tons of these error messages.

If anyone finds a solution, I will be very grateful.

Good luck in trying to find one Jesse.
__________________


Website: http://fasterthanmonkeys.com

iScore Baseball Scorekeeper Top baseball scorekeeping app for iPhone
Bug Squash Reached #1 kids game in 15+ countries including USA, now with OpenFeint
Jam Packed! Fun puzzle game for all ages
Jam Packed Christmas Holiday puzzle game!
iScore Basketball Scorekeeper Best basketball scorekeeping application

Last edited by ftm; 06-24-2009 at 01:40 AM.
ftm is offline   Reply With Quote
Old 06-23-2009, 11:50 PM   #8 (permalink)
New Member
 
Join Date: May 2009
Posts: 10
prameshu is on a distinguished road
Default can't get CIDs for glyphs for `Helvetica'

Hi ftm,
I am getting the same error too. If you have a solution now, could you please share it with me.

thanks,
Ramesh.
prameshu is offline   Reply With Quote
Old 06-24-2009, 01:41 AM   #9 (permalink)
ftm
FasterThanMonkeys.com
 
Join Date: Mar 2009
Location: Southern California
Posts: 523
ftm is on a distinguished road
Send a message via AIM to ftm
Default

I still don't have a solution... app works fine, but log gets filled with these messages when putting a lot of text in the PDF files.
ftm is offline   Reply With Quote
Old 06-25-2009, 07:28 AM   #10 (permalink)
New Member
 
Join Date: May 2009
Posts: 10
prameshu is on a distinguished road
Default PDF Font - Times New Roman working for iPhone

I have used Times New Roman font for the PDF generation in iPhone device. It works perfectly without any warnings.

Sample code is provided below.......

const char *text;
text = "Sample Text for PDF on iPhone device";
CGContextSelectFont (pdfContext, "Times New Roman", 12, kCGEncodingMacRoman);

CGContextSetTextDrawingMode (pdfContext, kCGTextFillStroke);
CGContextShowTextAtPoint (pdfContext, 100, 900, text, strlen(text));
prameshu is offline   Reply With Quote
Old 06-25-2009, 10:20 AM   #11 (permalink)
ftm
FasterThanMonkeys.com
 
Join Date: Mar 2009
Location: Southern California
Posts: 523
ftm is on a distinguished road
Send a message via AIM to ftm
Default

I just tried changing to "Times New Roman", and the error message is still there. The actual font name it is complaining about has now changed, but the message is still there:

<Error>: can't get CIDs for glyphs for 'TimesNewRomanPSMT'
__________________


Website: http://fasterthanmonkeys.com

iScore Baseball Scorekeeper Top baseball scorekeeping app for iPhone
Bug Squash Reached #1 kids game in 15+ countries including USA, now with OpenFeint
Jam Packed! Fun puzzle game for all ages
Jam Packed Christmas Holiday puzzle game!
iScore Basketball Scorekeeper Best basketball scorekeeping application
ftm is offline   Reply With Quote
Old 06-28-2009, 08:58 PM   #12 (permalink)
New Member
 
Join Date: Jun 2009
Posts: 1
amyuni is on a distinguished road
Default PDF Files generated by the iPhone SDK are not valid

These warnings started when we installed 2.2.1 SDK. We were worried that the PDF files might not be readable because of these warnings. One customer noted that the text was garbled when viewing the PDF, so we analyzed the PDF in detail to check if the fonts are properly represented. Here is what we found out:
The fonts are being inserted into the PDF as CID fonts which allow for more than 255 characters per font. This is useful to support anything more than MacRoman character sets. Here is how the font is typically represented in the PDFs generated from an iPhone application:
Main font object:
8 0 obj << /Type /Font /Subtype /Type0 /Encoding /Identity-H /ToUnicode 35 0 R /BaseFont /ArialMT /DescendantFonts [ 30 0 R ] >> endobj

Descendant font (PDF allows only 1 descendant per font)

30 0 obj<< /Type /Font /Subtype /CIDFontType2 /BaseFont /ArialMT /CIDSystemInfo <</Registry (Adobe) /Ordering (Identity) /Supplement 0 >> /FontDescriptor 31 0 R /W 32 0 R /DW 1000 /CIDToGIDMap 33 0 R >> endobj

The font contains a valid ToUnicode entry, which makes the files searchable. It also contains a CIDToGIDMap, which maps the character IDs to GlyphIndexes which is used for rendering the fonts. In order to render the text, a viewer would first map from the character code to the glyph index using the CIDToGIDMap, then retrieve the glyph from the embedded font in order to render it. In this case, there is no embedded font, so in theory a viewer that follows the PDF specs will not view these files. One way a viewer can get around this issue is to ignore the CIDToGIDMap and use the ToUnicode entry, but this is not what the PDF specifications say. The specifications are actually very clear, quote:
"
If the TrueType font program is not embedded but is referenced by name, the
Type 2 CIDFont dictionary must not contain a CIDToGIDMap entry, since it is
not meaningful to refer to glyph indices in an external font program.
"
Acrobat 5 actually refuses to open these files, so does Ghostscript (a library that is behind a number of PDF viewing applications.) Later versions of Acrobat succeed in displaying these files as they seem to ignore the CIDToGIDMap when the font is not embedded. In the Amyuni libraries, we have two modes for viewing PDFs, one mode ignores the CIDToGIDMap and uses only the Unicode table, so this mode has to be used in order to process these files.

Sorry for the bad news, maybe Apple will fix the SDK in a future version.

Looking for tools to create, process and validate PDF files, visit Amyuni Technologies | Quality PDF Developer Tools for .NET and ActiveX.

Amyuni Dev Team
amyuni is offline   Reply With Quote
Old 06-28-2009, 09:44 PM   #13 (permalink)
ftm
FasterThanMonkeys.com
 
Join Date: Mar 2009
Location: Southern California
Posts: 523
ftm is on a distinguished road
Send a message via AIM to ftm
Default

It's really not that big of a deal... everything works fine with the standard PDF viewer, and the PDF viewer built into the iPhone. The web based PDF viewer in Google Mail does not display the PDF correctly, but as long as the user downloads the PDF to view it, it works fine.

Really no need for a tool to create the PDF... just annoying that we get the warnings in the console log.
__________________


Website: http://fasterthanmonkeys.com

iScore Baseball Scorekeeper Top baseball scorekeeping app for iPhone
Bug Squash Reached #1 kids game in 15+ countries including USA, now with OpenFeint
Jam Packed! Fun puzzle game for all ages
Jam Packed Christmas Holiday puzzle game!
iScore Basketball Scorekeeper Best basketball scorekeeping application
ftm is offline   Reply With Quote
Old 11-21-2009, 05:41 PM   #14 (permalink)
Registered Member
 
Join Date: Feb 2009
Location: Seattle
Posts: 48
pmattf is on a distinguished road
Default

Have there been any new developments on this? I am working on an app that generates pdf's, and just started running into these errors, and hence found this thread on google. I am using the latest SDK, so clearly the problem has not been fixed.

This is a pretty big issue for me, because my app emails out the pdf's, so a significant chunk of users will open them in gmail, where they are (still) not readable.

I found this blog post which describes a workaround, but it requires use of an undocumented API, so with the recent changes to the app store, any app that used it will probably get rejected...
http://mexircus.com/blog//blog4.php/...with-pdf-files

Quote:
Originally Posted by ftm View Post
It's really not that big of a deal... everything works fine with the standard PDF viewer, and the PDF viewer built into the iPhone. The web based PDF viewer in Google Mail does not display the PDF correctly, but as long as the user downloads the PDF to view it, it works fine.

Really no need for a tool to create the PDF... just annoying that we get the warnings in the console log.

Last edited by pmattf; 11-21-2009 at 05:48 PM.
pmattf is offline   Reply With Quote
Old 11-21-2009, 05:48 PM   #15 (permalink)
Registered Member
 
Join Date: Feb 2009
Location: Seattle
Posts: 48
pmattf is on a distinguished road
Default

Update, I just noticed that the person who wrote that blog post has some recent updates. He actually did get an app rejected for using that method, so basically he rewrote it himself. So I guess this is a workaround for the problem, though it looks like a lot to digest...
CGFontGetGlyphsForUnichars fixes

Quote:
Originally Posted by pmattf View Post
Have there been any new developments on this? I am working on an app that generates pdf's, and just started running into these errors, and hence found this thread on google. Using the latest SDK, so clearly the problem has not been fixed.

This is a pretty big issue for me, because my app emails out the pdf's, so a significant chunk of users will open them in gmail, where they are (still) not readable.

I found this blog post which describes a workaround, but it requires use of an undocumented API, so with the recent changes to the app store, any app that used it will probably get rejected...
Messing with PDF files
pmattf is offline   Reply With Quote
Old 12-21-2009, 03:27 PM   #16 (permalink)
iPhone20
 
Join Date: Sep 2009
Posts: 140
apiphone is on a distinguished road
Default PDF file font issue

Hello ftm,

I also came across the same issue while creating pdf file. Did you find the solution to this?

ERROR: <Error>: can't get CIDs for glyphs for `Helvetica'.

Any help is appreciated
Thanks
apiphone is offline   Reply With Quote
Old 12-21-2009, 10:17 PM   #17 (permalink)
ftm
FasterThanMonkeys.com
 
Join Date: Mar 2009
Location: Southern California
Posts: 523
ftm is on a distinguished road
Send a message via AIM to ftm
Default

We still don't have an fix for this, though everything does work fine... it's just an annoying message in the console log.
__________________


Website: http://fasterthanmonkeys.com

iScore Baseball Scorekeeper Top baseball scorekeeping app for iPhone
Bug Squash Reached #1 kids game in 15+ countries including USA, now with OpenFeint
Jam Packed! Fun puzzle game for all ages
Jam Packed Christmas Holiday puzzle game!
iScore Basketball Scorekeeper Best basketball scorekeeping application
ftm is offline   Reply With Quote
Old 12-22-2009, 07:47 PM   #18 (permalink)
Registered Member
 
Join Date: Feb 2009
Location: Seattle
Posts: 48
pmattf is on a distinguished road
Default

Quote:
Originally Posted by ftm View Post
We still don't have an fix for this, though everything does work fine... it's just an annoying message in the console log.
It is more than an annoying message in the console log, because the resulting pdf's are not valid, and do not work everywhere. In particular, if you email them to a gmail account, and look at it with gmail's embedded viewer, none of the text is visible -- only graphic elements.

The workaround I reference a few posts up is not really a fix, because it basically looks up the glyphs for the font, and renders them as vector graphics. So your resulting pdf will look right, but it will contain graphics, not text. So for example copy/paste and search/spotlight would not work.

It is conceivable that it could be fixed by finding a C library for generating pdf's, and getting that to run on iPhone, and using that instead of the iPhone sdk pdf support. A few that have some promise are libharu, podofo, and libpdf. There may be others. If anybody does this, please let us know here.

Other than that, I think the only other real fix is to develop a corresponding web service with your app, and generate the pdf on your web server instead of in your app.

I have decided to go the route of the Sign Here app. See the "I'm Having Trouble Viewing PDF's" entry in their faq...
FAQ | Sign Here by LexAlign

In other words, go ahead and use the iPhone sdk to generate an invalid pdf, and warn your users that they need to use Adobe Reader to see it.
pmattf is offline   Reply With Quote
Old 12-22-2009, 07:49 PM   #19 (permalink)
Registered Member
 
Join Date: Feb 2009
Location: Seattle
Posts: 48
pmattf is on a distinguished road
Default

Also, it would be great if everybody following this thread would file a bug report with Apple about this. The more people who report it, the more likely they are to fix it.
pmattf is offline   Reply With Quote
Old 02-16-2010, 04:36 PM   #20 (permalink)
Registered Member
 
Join Date: Mar 2009
Posts: 27
jj0b is on a distinguished road
Default

Exact same problem here. Seems to work fine but really annoyed by the warnings.
jj0b is offline   Reply With Quote
Old 03-18-2010, 07:54 AM   #21 (permalink)
Registered Member
 
Join Date: Feb 2010
Posts: 4
Panajev is on a distinguished road
Default

What about the libharu based PDF creator approach (some people mentioned a C based PDF creator approach)?

(libharu's homepage) libHaru.org wiki

(sample app using libharu on iPhone) akisute's iPhonePDF at master - GitHub
Panajev is offline   Reply With Quote
Old 03-23-2010, 05:50 AM   #22 (permalink)
Registered Member
 
Join Date: Feb 2010
Posts: 4
Panajev is on a distinguished road
Default

Any advice on libHaru? Should be avoided?
Panajev is offline   Reply With Quote
Old 04-10-2010, 01:42 PM   #23 (permalink)
Registered Member
 
Join Date: Feb 2009
Location: Seattle
Posts: 48
pmattf is on a distinguished road
Default

Thanks for that tip Panajev -- I can confirm that libharu works. Using that sample as a guide, I have just replaced Apple's buggy pdf code with libharu in my app, and submitted an update. This is my app...
mRelease for iPhone, iPod touch, and iPad on the iTunes App Store

The current version generates pdf's where the text is invisible in gmail, and a couple users have reported garbled displays with Adobe Reader and Windows, even though in my testing it works fine (possibly has to do with what fonts are installed on the Windows machine?). In any case, when version 1.0.2 comes through, the problem will be resolved.

Libharu is a bit weird though. A couple things I ran into:

There is a function, HPDF_Page_TextRect, which is equivalent to the NSString drawInRect, which will take a very long string, and do the word wrapping into a box you specify. However, there is no equivalent to NSString's sizeWithFont to tell you how tall the resulting text ends up being. So it is difficult to determine where to place an item that has to go below the string.

This may force you to have to draw out your text line by line. There is a function HPDF_Page_MeasureText() which does make the manual word wrapping much simpler -- it tells you how many characters will fit in a given width, with word wrapping.

Another weird/annoying thing is that the image drawing functions use x, y, width, height, as you would expect, but the HPDF_Page_TextRect uses left, top, right, bottom for some reason.

Quote:
Originally Posted by Panajev View Post
What about the libharu based PDF creator approach (some people mentioned a C based PDF creator approach)?

(libharu's homepage) libHaru.org wiki

(sample app using libharu on iPhone) akisute's iPhonePDF at master - GitHub
pmattf is offline   Reply With Quote
Old 09-09-2010, 07:29 AM   #24 (permalink)
Registered Member
 
Join Date: Dec 2009
Posts: 1
jagse is on a distinguished road
Default how to setup libharu?

Could anyone please post a step by step tutorial on howto setup libharu.
Just cant figure out how to do this.

Cheers.
jagse is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 331
7 members and 324 guests
blueorb, guusleijsten, jbro, Kryckter, LEARN2MAKE, n00b, SLIC
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,649
Threads: 94,113
Posts: 402,880
Top Poster: BrianSlick (7,990)
Welcome to our newest member, Anwerbl
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 08:57 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0