How to draw Thai/Chinese strings in J2ME? - blackberry

I'm trying to draw Thai/Chinese strings on a J2ME Canvas using graphics.drawString(string, i, i, aAnchor); but the device hangs when I do so. When I use SOP on string, it displays ?????????. I've tried hard-coding the string too as - String string = "บริการโทรกลับ"; I've read here that the device also needs Chinese/Thai fonts installed on device, so I tested a Thai website on my device and found that it was able to display Thai characters in clickable links (text). I'm sure I'm missing something but just can't figure out what it is! Somebody, please point me in the right direction...
Blackberry related solutions are also welcome.
EDIT I've made a custom font as described here but was still unable to display it. Also, I could use some Thai/Chinese font files (preferably .fnt extension).

Have you tried with custom fonts with Java ME application? Also look on some useful search for using custom fonts.

Related

Why google sheets save as PDF doesn't show emoji in Cell?

Do you know why some times the emoji icons show normal and some times show as just empty square in google sheets , also when I save sheet as PDF the icon show as line ! , can anyone advise the reason ? what should i do ?
Here is a link of the sheet ( ICON in B24 )
https://docs.google.com/spreadsheets/d/1LRmyNlKSQjADz0bG_-mDf6w0LqEg7IcPgVizXF4C-Xc/edit?usp=sharing
this is the link were i took the icon from .
https://emojipedia.org/emoji/%F0%9F%8C%9E/
Thanks,
Why This is Impossible
Google Sheets does not export emoji to .pdf because it does not know what an emoji is. Google Sheets is able to display emoji when doing work not because Google Sheets itself can display emoji, but because your browser/operating system can. If everything was left only to Google Sheets, it wouldn't know how to display emoji at all.
The one exception to this is Noto Emoji (as already mentioned by Max Makhrov). Through this page, it can be seen that no font built into Google Sheets has the ability to display emoji except Noto Emoji. Even then, Noto Emoji only displays it as a black-and-white outline. Every other font available in Google Sheets does not have support for emojis.
If Google Sheets allowed the addition of custom fonts, this would be fixable. However, it is currently not possible to add custom fonts into Google Sheets. There are additional "advanced" fonts hidden in the "Fonts Dropdown->More Fonts" menu (one of which is Noto Emoji), but adding truly custom fonts is not possible.
Perhaps a correctly built extension could fix this issue. Currently though, no such extension seems to exist. One Google Sheets add-on called Free and New Font purports to add this functionality, but it has absolutely abysmal reviews and demands some very dodgy permissions regarding one's Google account. I have not tested it, and have intentionally refrained from linking to it because it seems nearer to a virus than actual solution. I would not want anyone skimming this to get the wrong idea.
All of that leaves us with no way (except Noto Emoji) to have Google Sheets recognize emoji; therefore, there is no way to use the built-in Google Sheets "Export as PDF" functionality and have emoji be exported correctly.
Alternatives
Since it is not possible to complete this task directly, I have provided some alternatives below.
Use Noto Emoji
Noto Emoji itself is the closest option Google Sheets has for exporting to .pdf which include emoji. The downside of this is that Noto Emoji only exports emoji as black-and-white outlines. If this is serviceable, Noto Emoji can be accessed by:
Selecting all cells with emoji in them.
Clicking the fonts dropdown menu.
Selecting "More Fonts" at the top of the list.
Searching for "Noto Emoji" and selecting it.
Pressing "OK"
Export Using Another Method
As OSM suggests, exporting as an .html document instead of a .pdf would retain colored emoji correctly. Another program can then be used to convert the .html document into a .pdf. Similarly (with even more jankiness), a screenshot of the document could be taken, and the image added to a PDF later. If access to Excel is possible, Google Sheets supports exporting to .xlsx, and Excel has better support for exporting emojis into PDFs.
The downside of this solution is that it requires numerous additional steps that take place outside of Google Sheets. If this is serviceable, refer to OSM's answer for steps to implement the .html solution, or Microsoft documentation for steps to implement the .xlsx solution.
Use Images Instead
Rather than using emoji, images could instead be used as this answer by pjmg suggests. Using the =IMAGE() formula (documentation here), a picture of an emoji could be pulled from an outside source. Google Sheets would correctly export that image when a .pdf file is created.
The downside of this solution is that it is cumbersome to find sources for external images, the images are not true emoji (which will be evident when editing the document), and if the host of the image goes down, exporting will no longer function correctly. If this is serviceable:
Find a website that hosts images of emoji. In this answer, jpmg suggests iEmoji. The Emojipedia website would also work.
Right click the image and click "Open in New Tab".
Copy the link and put it into an =IMAGE() formula in the desired cell.
For example (courtesy of jpmg), if you wanted the "face with tears of joy" emoji, you could use =IMAGE("https://s3.amazonaws.com/pix.iemoji.com/images/emoji/apple/ios-12/256/face-with-tears-of-joy.png") or =IMAGE("https://emojipedia-us.s3.dualstack.us-west-1.amazonaws.com/thumbs/120/apple/325/face-with-tears-of-joy_1f602.png")
Create New Functionality
If none of the above solutions are serviceable, it's possible to request that Google update their software to fix the problem. Max Makhrov has already submitted a bug report here, which can be voted on to improve the chances that Google updates things. Though, it should be noted: I think that this is technically all intended functionality, so a feature request might be a better route.
Furthermore, if anyone is particularly motivated, creating a non-shady alternative to the add-on I previously mentioned could also be a solution. Ultimately though, I suspect this would be a very time-consuming task for little gain.
Conclusion
It is not possible to use the built-in "Export as PDF" functionality in Google Sheets to get a resulting file with colored emoji. This is because there are no appropriate fonts available in Google Sheets. Workarounds exist, but none are optimal.
Solution
You can print easily with few steps, Colored and with any font.
1 - Add a dot in the right bottom corner to indicate the edge
and Go to File > Download > Web Page (.html)
2 - Open the webpage in your browser and print as a PDF
Edit with Pdf editor
3 - Open the PDF file with illustrator or a PDF editor, delete the grid and columns and rows.
Print and Enjoy :)
Running into the same problem, and so far the only work-around I have discovered is to go to File > Download > Web Page and then print the resulting HTML file for that sheet. You have to check the option in your browser's print dialogue to print background and images to get some of the formatting to print correctly.
I've reported this as an issue here:
https://issuetracker.google.com/issues/241147770
Please wote the issue if you want Google to solve it.
Note: when I use fonr Noto Emoji emojis are printed, but they are not colored.
To use this font select 'More Fonts' option.
The original solution: change the font
if you don't have to choose exact font, emoji containing cells that are formatted with Inconsolata or Sawarabi Mincho fonts are perfectly exported to PDF.
UPD. It appears that these fonts export correctly only certain emojis like arrows, card signs, etc... while others popular emojis are not exported correctly.
Notes
As #Osm noted:
failed with Inconsolata and Sawarabi Mincho see this
Noto Emoji seems to be the only font to work. Still Google has tons of fonts and we have no solid proof if some or any of them will work.
Chnaging the font seems to be the only programmable solution at the moment.
Vote the issue if you are effected.
Emojis are considered to be special characters.
So according to this, if you want to insert a special character, it is recommended you follow the steps mentioned in there.
As for the reason why the PDF is not exported in the way you expect it - this is due to encoding since emojis are special characters. I suggest you insert the emoji as an image and only afterwards export the spreadsheet.
Pdf translators cannot support exotic fonts like woof or csvg. commonly the html styles are
"Noto Color Emoji" (often via Google android platform apps)
"Apple Color Emoji" (used on Apple platforms such as iOS and macOS)
"Segoe UI Emoji" (as used by Windows platform in NotePad etc.)
Here the source text is on left in windows 11 notepad, as inserted say on a keyboard.
Then we can see in windows 11 notepad (!argh !why two apps same name), what it would look like if on the web as HTML.
Then from that print to PDF is on right and its not same as source !argh !argh, why the differences
so for above the pdf shows
Title: try.txt - Notepad
PDF Producer: Microsoft: Print To PDF
PDF Version: 1.7
Fonts:
CIDFont+F1 (TrueType (CID); Identity-H; embedded)
CIDFont+F2 (TrueType (CID); Identity-H; embedded)
CIDFont+F3 (TrueType (CID); Identity-H; embedded)
CIDFont+F4 (TrueType (CID); Identity-H; embedded)
PDF has enough trouble using TTF monochromatic fonts as shown above so google export fonts in the sample file are
 
<office:font-face-decls><style:font-face style:name="Arial" svg:font-family="Arial" /><style:font-face style:name="Cambria" svg:font-family="Cambria" /><style:font-face style:name="Liberation Sans" svg:font-family="'Liberation Sans'" style:font-family-generic="swiss" style:font-pitch="variable" /><style:font-face style:name="DejaVu Sans" svg:font-family="'DejaVu Sans'" style:font-family-generic="system" style:font-pitch="variable" /><style:font-face style:name="Linux Libertine G" svg:font-family="'Linux Libertine G'" style:font-family-generic="system" style:font-pitch="variable" /></office:font-face-decls>
and the plain text is
<table:table-cell table:style-name="ce1" office:value-type="string"
calcext:value-type="string">text:p😂</text:p></table:table-cell>
but on a web that is naturally colour enhanced since lol is considered naff however in any of the above fonts it would be a null character, or plain text in black and white.
For non font supported characters you could see Fonts: <#4> (Type3; embedded)
As explained by others simply export the html with html iconic characters and then print html to pdf where you can use the html emojis as plain text for find etc.

How to extract bold text from pdf file programmatically using PDFKit in iOS?

I am using PDFKit to display my pdf files. I've integrated the searching functionality but I want to search only bold texts/words.
I'm wondering is it possible to do what I'm looking for or does Apple don't allow it? Because String data type is from Foundation class and UIFont is from UIKit.
I can search text only on the basis of lowercase, uppercase or text color. I've googled a lot. And I found that pdf files are made up of vectors. So, sometimes its difficult to extract the font-family of the text.
hm.. I guess you want to show all pdf files from your device's storage.
Generally.. if you want to show pdf file on your app, you should mapped the path and file name of the special folder into your code.
But I think you can't get the result you want with this method.
I am not sure In case this but probably you should use "UIDocumentPickerViewController".
I think also you need to set the value of documentTypes by [String(kUTTypePDF)] because you want to only show all the pdf.
Please check the following link for more details:
How to open the Document files e.g(.pdf,.doc,.docx) in ios mobile when a button action using swift3.0?
The attributed string has the font attributes, using which you can achieve what you want.
pdfDocument.page(at: 0)?.attributedString

Parse iOS SDK Localizing

I am using Parse SDK as a backend and when application loading data from server i see label "Loading". But my app using another language and i wanna translate it. How can i fix it?
Image here
I am tried to change simulator language and and changing value of Localization native development region key in plist.
Anyone had this problem? I think there is very simple answer, but i cannot find it. :)
Thank you for help!
So after a long search, i discovered that you should create a file named "ParseUI.strings" in order to change UI elements like "Loading.." as you mentioned. You can see the file in the image below. You should use at least ParseUI framework 1.1.6 for this method.
After you create a file and named it as "ParseUI.strings" you can change UI elements which parse provides us. You can see which strings are editable here.
In your example you want to change "Loading..." string, so all you have to do is enter the code in your ParseUI.strings file.
"Loading..." = "Whatever thing you want to say...";
Thats it, it worked for me.

How to read international character sets using CoreText on iOS?

I am trying to load international character glyphs on iOS using CoreText, but I am having some trouble. I am trying to use the following function call to create the font:
CTFontCreateUIFontForLanguage(kCTFontUIFontUser, 15, (__bridge CFStringRef)#"zh-CN");
However, this does not return Chinese characters. Instead I get the regular default en-US font file. What am i doing wrong here? Also, is there a way to get any font, not just the system fonts, or maybe set the font used by these constants? Is there another function call I should be using?
Furthermore, is it possible to determine which built in iOS fonts are capable of rendering international characters and which are not? I would really hate to have to load in my own TTF file, but if the font we want can't support international characters by default, we will have no choice. I am aware that there are certain fonts that support international characters such as "ArialHebrew", but I was hoping that we could use the same font face for all character sets.
Thanks.
EDIT - I also tried the language code with an underscore instead of a dash; no luck.

Blackberry Hindi and Gujarati text display

I want to develop a blackberry application that supports multiple languages, such as English, Hindi and Gujarati. I have tried using utf-8 characters but it displays "??????" for Hindi.
I have try also i18n but there are not possible to write in Hindi in property file. have any idea.
The device needs to have the appropriate fonts installed to display different languages. So you would need to make sure Hindi fonts are available. It sounds like they aren't. Try going to a hindi web page, and see if the characters display correctly there.
For the resource bundle, which I think is what you mean by 'i18n', the compiler forces you to use the default java character encoding. If you're on Windows, this is CP1252. To get characters outside of that encoding, you use the Java unicode escape, which is the four digit hexidecimal encoding of the unicode code point, prefixed with '\u', such as '\u00f3'. The Eclipse editor will do this for you automatically, but if you are editing the file with another editor, this escape encoding will be required.
Make sure you are testing your code on an actual device, and not just the simulator. I learned this the hard way. I spent many hours trying to figure out why my translated text was showing as "?????", and once I tried it on the actual device, the translations showed with no problem (japanese, chinese, russian, arabic, etc).

Resources