iTextSharp - Pre filled Chinese characters in PDF do not come visible until textfield is focused - localization

I am creating PDF with pre filled values in Chinese but when opening the PDF all the textfields containing Chinese text are empty. When focusing a textfield the Chinese text comes visible but is hided again when unfocusing the field. What could be the issue?

Please share some more info, as there could be more than one reason why the appearances aren't generated by iText.
A. The first reason is explained in the StackOverflow question "AcroForm values missing after flattening". In this case, the PDF contains a parameter that instructs iText not to generate appearances, which would explain why you don't see any value up until you click the field, in which case the viewer will create them.
B. The second reason is explained in section 8.3.3 (entitled "Text fields and fonts") of my book. In this case, the parameter in the PDF doesn't prevent the creation of field appearances, but iText fails to do so because you're not providing a font that knows how to display the Chinese characters.
See for instance figure 8.3 and 8.4 of the book.
In figure 8.3, you see that Chinese text isn't displayed in the upper window. By fixing the form (using two different strategies), the Chinese text appears in the lower two windows. Note that the Chinese text won't appear in all viewers in the case of the middle window.
In figure 8.4, you see that Korean text isn't displayed in the upper window, nor in the third window. In all other windows, different strategies were used to fix this problem:
It would lead us too far to discuss all the different strategies in an answer on SO. Instead, please take a look at the TextFontFields example (for the C# version, please take a look at the ported examples). My guess is that you'll benefit most from the AddSubstitutionFont() method, provided that you use a font of which a subset will be embedded in the document (in the example arialuni.ttf is used).
In case of A., the phenomenon also concerns other languages. In case of B., the parameter is correct, but you're not providing a font that can be used to generate the appearance.

Related

Using custom font inside UserControl is making my font bold

When I use my fonts outside of user controls I have them loading correctly. But when the word has accent and is inside UserControl the font is appearing in bold, I've tested more than one font and the problem happens.
In the image I inserted a sentence written on top of the whole frame in the same way as a sentence written inside a UserControl, what is outside proves that the accents work without being bold and inside shows that all the words that are accented are in bold.
The problem only happens on iOS.
I found the problem. I had edited some texts in another editor (VSCode) and also copied some others from another platform that we used, the problem happened due to the encode of these other tools, when pasting in VStudio it caused the problem.
Just rewriting the texts directly by VStudio and the problem has been fixed.

How to use non-English characters in Godot?

I want to use non-English characters in Godot, but when I write them (In every node, like a Label or a Button) and run the project, the text does not display. For example, I write some Arabic characters in a Label and run the project, but I do not see anything. But I can see the characters in editor separately and reversely. ("عالم" is displayed "م ل ا ع")
I know that this problem is discussed on GitHub, but there was not any good solution. Please advise me a good and simple solution to solve this problem. I think it is not solved so far.
The default Label font in Godot doesn't support non-ASCII characters.
You can try to change the font in your Label node to one that supports non-ASCII symbols by picking a font from your computer, or if it doesn't exist on your device, uploading it from some site like Google Fonts, and choosing an arabic-supporting font, like Amiri.
After choosing the font for your Label node, open the Custom Fonts property in the editor of the node, and create a DynamicFont, and in Font => Font Data press Load and choose your font in the opened window in the file system (.ttf or any another font extension).

code that does what the home button is supposed to do in a line of text

I have an arabic line with english letters in it.
Ex: أنا في abcd البيت
I opened notepad. I started writing.
What I wanted to write is I'm at abcd home but what you see now (left to right) is at I'm abcd home
To fix this, I click anywhere on that line. I press the HOME button. You'll see the cursor moving to the beginning of the arabic word that to the left of the english word. I right click, choose INSERT UNICODE CONTROL CHARACTER then I choose RLE.
When i do that, the reads I'm at abcd home. It's fixed.
If you right click again and choose SHOW UNICODE CONTROL CHARACTER. you'll see that the very first "character" is the unicode character I inserted.
I wish to automate this process.
How do I do that? :D
I can tell you that RLE is represented as \u202B
Thanx
There's no very easy way to automate the process, but there are a couple of things that you can try:
Press Ctrl-Shift on the right-hand side of your keyboard. This will work in Notepad and in many other programs on Windows: Word, Internet Explorer, Google Chrome. It may work in Firefox, too, but if it doesn't, use Ctrl-Shift-X to set right-to-left direction in Firefox. Note that this will correct the display of the text and the cursor movement for you while you are writing it, but not necessarily for the people to whom you send this text.
Use the Microsoft Keyboard Layout Creator to add the RLE character to your keyboard. This program will let you create a new keyboard layout that you will be able to use in all the programs. Load the keyboard layout that you are currently using, find a key that is not assigned to any character and assign the RLE to it. Note that if you use RLE, you must also use the PDF character (U+202C) in the end of the right-to-left text, so assign this to some key, too (this is similar to writing <span dir="rtl">أنا في abcd البيت<span> in HTML—you must use the closing tag). This will fix your text, although it's tricky. Also, note that some websites remove characters like RLE when you try to post on them - Facebook and Twitter do this, for example.
Finally, note that this problem is unique to plain text. If you use a real word processor, like MS-Word or LibreOffice, or write your text as HTML with proper dir attributes, then it's a lot easier, but you'll have to store and send your text in these formats.

Using Unicode characters with Delphi XE2

I'm looking at converting one of our applications to Delphi XE2 and generally take the opportunity to bring it up to date.
One of the features of the application is a StringGrid that displays a number of check marks in a couple of columns. To achieve this the grid is actually 2 aligned grids - the second of which is setup with the font as Wingdings in order to display the check marks.
Am I wrong in thinking that I should be able to use something like a TListView and use the checkmark char (U+2713) alongside the rest of the text... If so how the heck do I do this?
Do I need to set the font to Wingdings for that column? Does this need to be in OnDraw?
Am I barking up the wrong tree...
File->New->VCL Forms application
In the Component Palette, expand the Win32 tab and choose TListView, and drop it on the form.
Right-click the newly added TreeView1, and choose Items Editor... from the context menu.
Click New Item. Type in any text (for instance x Testing, using the 'x' as a placeholder for now).
Start the Windows Character Map application (Start button, type Chara in the search box, or Start->Programs->Accessories->Character Map). Change the font to Arial Unicode MS, and navigate to the character you want (it's in there).
Click the character, and then the Copy button. Switch back to the IDE, select the x placeholder you put in the edit, and hit Ctrl+V to paste the character you just chose from Character Map. You should now see your check mark (or whatever character you chose), followed by Testing.
(The steps above are the two-minute process I followed to find out how to do this, and that quick experiment showed that you could.)

Special characters not displaying, sifr r436

I followed the explanation on the sIFR wiki, but can't seem to get accented characters to display in my Flash movie. I opened up the Character Embedding palette, pasted "ÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ" into the "Include these characters" field after the ampersand, hit "OK", then re-exported the .SWF.
The characters still don't render in my sIFR file--any suggestions? I'm running r436.
have you tried checking the 'Basic Latin' or 'Latin I' boxes (just for sanity check?)
I've just looked through mine and I use 'Latin I'.
could be that the encoding between the webpage/javascript and flash isn't picking up the special chars - have you debugged your javascript to see what's being passed in?
[edit] what is the webpage encoding set to?[/edit]
Perhaps the font you're using just doesn't include those characters? Frequently, fonts will support just ascii.
As jeremy said, the major issue i've seen with sifr and charecters is that special charecters aren't part of the font you are using.
One way to test is run your current method with another standard font such as arial, if it works then it's probably down to your font.
What font is it?
Secondly when making the font glyphs inside flash you have to change the settings to include any foreign characters to insure they are within the font flash movie. most none standard characters are removed as it keeps the file size of the swf font file down.
Unicode escape sequences?
or maybe check a url encode chart
when you view the generated source (below) you'll see that the chars are being encoded by javascript...
content=This%2520is%2520an%2520embedding%2520test%253A%253Cbr%253E%25C3%25C4%25C5%25C6%25C7%25C8%25C9%25CA%25CB%25CC%25CD%25CE%25CF
can you switch on HTML on the text field to see if they show up?
Checking Latin I was mentioned, what about Latin Extended A, Extended B and Add'l? Cmd+clicking Punctuation, Basic Latin, plus all of the other Latin options may get you your missing characters.
I suspect its a problem with Flash. If I go to your example page (http://unstoppablerobotninja.com/demos/sifr-encode/), right-click on the Flash movie, and copy to the clipboard, this is the output:
This is an embedding test:
ÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ
Did it work?
Which to me indicates that the characters are ending up just fine in the Flash movie, but they're not being rendered.
Can Flash render these characters if you use static publishing for some other Flash movie?
I have the same problem with a dynamic text field not rendering special characters, despite the field being set up correctly and the specific characters required being embedded in the field.
I noticed that HTML source text which is formatted to appear as Bold (i.e. using tags) creates this problem - the same text without Bold results in the special chars being rendered correctly (although obviously not in Bold :)
I tried various things including using the unicode reference and exporting the Bold variant of the font (Verdana) but nothing helps, so I think it's a Flash bug.
Of course, knowing this doesn't solve the problem if you need to use a Bold font, like I do - I'm still looking for solutions and will post back if I find something.
Good luck ;)
Solving the Bold issue is easy. Special characters not appearing is another problem entirely and one in which we are encountering currently.
Here's the deal with bold (and italic):
If you use bold or italic tags in the HTML, Flash has not necessarily embedded the bold and italic version of the font. What you have to do is create some hidden dynamic text fields that have the bold and italic versions of the font embedded. These hidden text fields can be placed in a frame past the end of the timeline so that they don't appear at runtime.
A related problem is when you click the B (for bold) in the properties panel and insert HTML text into the textfield without a <b> tag. Flash will embed the bold font into the SWF, but if you don't insert the <b> tag in your text, Flash will render it with a non-bold font (which won't appear because it wasn't embedded).
Unfortunately, we have a situation where a dynamic text field was created with one font, and if we change it to any other font, it doesn't render. Special characters, such as the ® symbol, don't render, even though they are embedded in the font.
This is with Flash CS3 and AS2.

Resources