I am making a report in Unity3D with iTextSharp. When I start app from Unity it creates PDF and works perfect. But when I build App on Android device, I have a problem with creating font. Here is what I do:
BaseFont bf = BaseFont.CreateFont(System.IO.Path.Combine(Application.streamingAssetsPath, "ADOBEARABIC-BOLD_0.OTF"), BaseFont.IDENTITY_H, false);
As I have seen, the first parameter for font creation is the path to the font. My font is in
/Assets/StreamingAssets/
folder.
When I try to load it with WWW class, it can find it, but when I give just the path to the creator it won’t work.
Any idea what should I do? Or is there any other way to create a font that supports Arabic characters?
EDIT:
Ok, I have somehow managed to get to the font. First I copy font from Assets to the root of the APP:
IEnumerator CopyFiles()
{
string fromPath = Application.streamingAssetsPath + "/";
string toPath = Application.persistentDataPath + "/";
string filesNamesToCopy = "ADOBEARABIC-BOLD_0.OTF";
WWW www1 = new WWW(fromPath + filesNamesToCopy);
yield return www1;
File.WriteAllBytes(toPath + filesNamesToCopy , www1.bytes);
}
And then I make BaseFont:
BaseFont bf = BaseFont.CreateFont(System.IO.Path.Combine(Application.persistentDataPath, "ADOBEARABIC-BOLD_0.OTF"), BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
Now I get new error when try to build on Android device:
ArgumentException: Encoding name ‘windows-1252’ not supported Parameter: name