I don't have to an answer to why FT_New_Face is failing, but since FreeType is 
also open source, you can trace into it.

However, I will point out that you won't legally be able to bundle that font as 
part of your project/application.

Leonard

-----Original Message-----
From: Ismael Schellemberg [mailto:[email protected]] 
Sent: Monday, October 08, 2012 1:38 PM
To: Leonard Rosenthol
Cc: Dominik Seichter; [email protected]
Subject: Re: [Podofo-users] unicode text

I was just struggling with this one, I downloaded Arial Unicode MS font .ttf 
and add it to the project resources, and i'm creating the PdfFont like this:

NSString *fontPath = [[NSBundle mainBundle] pathForResource:@"Arial Unicode MS" 
ofType:@"ttf"]; PdfFontCache::EFontCreationFlags flags = 
PdfFontCache::eFontCreationFlags_AutoSelectBase14;

PdfFont *fileFont2 = document->CreateFont( "Arial Unicode MS", false, false,

                                             new PdfIdentityEncoding(0, 0xffff, 
true),
                                             flags,
                                             true, localPath.UTF8String);

however it throws an exception in PdfFontMetricsFreetype.cpp when trying to 
create the font face:

CRITICAL: FreeType returned the error 6 when calling FT_New_Face for font 
/var/mobile/Applications/DC615388-057F-4ED3-8A1A-E99BEF5137F3/Documents/Arial 
Unicode MS.ttf

looking up i found error 6 is invalid glyph index, but i've no idea what this 
means


On 08/10/2012, at 15:31, Leonard Rosenthol 
<[email protected]<mailto:[email protected]>>
 wrote:

Unless it was rewritten for Cocoa, I think you need to pass in a full pathname 
to the font file since the Mac code doesn't know how to do lookups in the OS.

Leonard

-----Original Message-----
From: Ismael Schellemberg 
[mailto:[email protected]<http://infragistics.com>]
Sent: Monday, October 08, 2012 8:39 AM
To: Dominik Seichter
Cc: Leonard Rosenthol; 
[email protected]<mailto:[email protected]>
Subject: Re: [Podofo-users] unicode text

Im able to create a font named ArialUnicodeMS or Arial Unicode MS normally 
using obj-c (UIFont) so the font does exist in the system

       UIFont *arialUnicodeFont = [UIFont fontWithName:@"Arial Unicode MS" 
size:8];

Maybe there's something I need to do to be able to create one in PoDoFo?

Is there a way to create one "manually"? How should I approach this?


On 07/10/2012, at 16:44, Dominik Seichter 
<[email protected]<mailto:[email protected]><mailto:[email protected]>>
 wrote:

PoDoFo should do the conversion from UTF8 to Identity-H encoding here 
automatically. Problem seems to be that the fond Arial Unicode MS cannot be 
found on your system. Did you check this?

Regards,
Dom

On Sun, Oct 7, 2012 at 8:12 PM, Leonard Rosenthol 
<[email protected]<mailto:[email protected]><mailto:[email protected]>> 
wrote:
You can't put UTF-8 into the content stream of a PDF - it's not supported.

Leonard

-----Original Message-----
From: Ismael Schellemberg 
[mailto:[email protected]<http://infragistics.com><http://infragistics.com>]
Sent: Friday, October 05, 2012 2:42 PM
To: 
[email protected]<mailto:[email protected]><mailto:[email protected]>
Subject: [Podofo-users] unicode text

Greetings, i'm having some problems trying to use unicode characters …

In CreationTest.cpp there is this code:

void CreateUnicodeAnnotationFreeText( PdfPage* pPage, PdfDocument* pDocument ) {
  PdfString sJap(reinterpret_cast<const pdf_utf8*>("「PoDoFo」は今から日本語も話せます。"));
  PdfFont* pFont = pDocument->CreateFont( "Arial Unicode MS", new 
PdfIdentityEncoding( 0, 0xffff, true ) );

  PdfRect rect( 200.0, 200.0, 200.0, 200.0 );

  std::ostringstream  oss;
  oss << "BT" << std::endl << "/" <<   pFont->GetIdentifier().GetName()
      << " "  <<   pFont->GetFontSize()
      << " Tf " << std::endl;

  WriteStringToStream( sJap, oss, pFont );
  oss << "Tj ET" << std::endl;

  PdfDictionary fonts;
  fonts.AddKey(pFont->GetIdentifier().GetName(), 
pFont->GetObject()->Reference());
  PdfDictionary resources;
  resources.AddKey( PdfName("Fonts"), fonts );

  PdfAnnotation* pAnnotation =
      pPage->CreateAnnotation( ePdfAnnotation_FreeText, rect );

  PdfString sGerman(reinterpret_cast<const pdf_utf8*>("Unicode Umlauts: ÄÖÜß"));
  pAnnotation->SetTitle( sGerman );
  pAnnotation->SetContents( sJap );
  //pAnnotation->SetAppearanceStream( &xObj );
  pAnnotation->GetObject()->GetDictionary().AddKey( PdfName("DA"), 
PdfString(oss.str()) );
  pAnnotation->GetObject()->GetDictionary().AddKey( PdfName("DR"), resources );


}


But when i try to create the font, pFont returns NULL Any idea why this is 
happening?

if not, how can i write unicode characters into a PdfStream when creating a 
FreeText annotation?

The problem is that adobe viewers (among others) don't display the annotation 
properly because the stream isn't properly drawn It is invisible until 
selected, and then it becomes visible (searching through the pdf structure, i 
found that the Tj command in the annotations content stream has no value)
------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM Deploy 
New Relic app performance management and know exactly what is happening inside 
your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and 
get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
_______________________________________________
Podofo-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/podofo-users
------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM Deploy 
New Relic app performance management and know exactly what is happening inside 
your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and 
get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
_______________________________________________
Podofo-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/podofo-users


------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
_______________________________________________
Podofo-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/podofo-users

Reply via email to