PDA

View Full Version : FG XML characters



Bidmaron
July 20th, 2018, 19:28
OK, so we know you have to escape >,<,&,",' (well, that isn't even purely true, but it is safe to always escape them), but what about ascii codes<32 and >127? I know &#10 is ok to get a new line, but what other codes in those ranges are ok, if any?

Talyn
July 20th, 2018, 21:16
13 will get you a carriage return. 10 won't do a damn thing.

I use Yellowpipe (https://www.yellowpipe.com/yis/tools/ASCII-HTML-Characters/) but any list of ASCII HTML characters will do.

Actually it's possible I misread the intent of your question. FG will render most (not all) characters with their ASCII codes. But your question makes it sound like perhaps you're trying to do something else???

Bidmaron
July 20th, 2018, 21:21
Well, okay 13 does the carriage return. I couldn't remember. I knew there was an undocumented control character that had an effect on output. I am just trying to find out if there are any others that are undocumented.

Also, XML standard says (as far as I can determine) that characters above 127 are not allowed, but many places claim that most xml displays will attempt to render stuff above 127. I cannot see anything about whether FG does anything with ascii above 127.

Talyn
July 20th, 2018, 21:25
It does higher than 127. The copyright symbol is 169 and I use that in every single DLC I do on the credits page (also on the definition.xml but I'm the only developer who does that).

FG does have a cutoff point, however, but I've never bothered to figure out what it is. I just know it can't do some of the really high ASCII characters, but it's extremely rare we'd have a need for it. I'm hoping post-Unity that FG gets something more akin to a browser rendering engine so we can do more advanced layout.

Bidmaron
July 20th, 2018, 21:27
I am asking because I am working on a tool that will significantly simplify module production from PDFs, and I need to know what FG valid characters are. Seems like that should be documented somewhere.

Talyn
July 20th, 2018, 21:30
I should also clarify that it's entirely possible that FG itself can display the higher ASCII characters that I was unable to render last year, but the font being used (especially those old .fgf "fake fonts") may not have those characters, which obviously creates a problem for rendering.

Bidmaron
July 20th, 2018, 21:32
Well, the XML standard warns you not to use 128 upon pain of death (I don't know why), so I just am at a loss to understand what the real no-no's are.

Talyn
July 20th, 2018, 21:35
128? The Euro symbol? € € € € :p

Honestly, instead of asking here, just whip up a Story or whatever page with each character to see which ones FG (and/or FG's fonts) have issues with.

Bidmaron
July 20th, 2018, 21:37
If there is a bad character, FG won't load, and then I will have to do it one character at a time to see which one it is. I guess that's what I'll do later if MW doesn't chime in with the answer. I figure Trenloe doesn't know or he would have said something already.

Talyn
July 20th, 2018, 21:38
I've gotten "bad" characters quite often. FG loads fine, no console errors, no nothing, you'll just notice a "wtf is that?" character instead of the one you wanted.

Bidmaron
July 20th, 2018, 21:39
But I won't know if that is a font problem or FG puking on the character.

Talyn
July 20th, 2018, 21:45
Having looked and built a few .fgf fonts, I'd be willing to wager the font would be the problem more often than FG's text rendering... with the exception of a few such as the aforementioned 10. Also 9 is a problem; FG will not render a tab. I'd say you're ok with most actual renderable characters (13 being the main "does something" character that is extremely useful) just avoid the ones that typically have an action with them.

Trenloe
July 20th, 2018, 23:02
Can you clarify the question please? Are you referring to characters within the XML that are going to be parsed by the base XML engine itself?

Or, are you referring to markup within the formattedtext control used to display formatted text?

These are two different things. The former is standard XML, the latter is based off the limited FG markup and the FGF font file used.

Bidmaron
July 21st, 2018, 00:40
I have done some exhaustive testing, and here is what I discovered. These are assuming that the xml in the story entry is of the form &#x; where x is a decimal ascii code. I did not attempt to call setValue within FG to do this, but exited FG, edited db.xml, and stated up FG. These results apply regardless of whether you actually display the story entry with the escaped sequence:
0 - if you use (not sure why you would, but tested for completeness), FG will strip this code AND ANYTHING AFTER it in the xml tag text.
1-12: does nothing, although I assume that if the font had a printable character in these codes, it would probably display.
13: this issues a new line, as discussed in other forum threads.
14-31: as with 1-12.
32-126: I really didn't have the patience to test these printable characters, but my guess is they would behave like 127 next.
127: If you use this, it will be replaced with the actual non-escaped character (that is &# and the ; will be stripped out and just the ascii character placed).
128-255: These are untouched by FG and will display whatever the font has in the ascii code used.

Thanks for trying to help, Trenloe, but I think I have satisfied my question just doing it the hard way like Talyn suggested.

Bidmaron
August 11th, 2018, 06:55
I am trying to put in a blank line between lines of text in a string control, but the xml parser senses that the contents (and I have tried <default> and <static> to no avail) are empty, and it surpasses the control generation so that the two lines have no blank between them. What is a good way to insert a blank line between single line text controls?

Bidmaron
August 11th, 2018, 07:12
Not a very elegant solution perhaps but I just wound up appending string.char(10) to the end of the control text before where I needed the blank line

Trenloe
August 11th, 2018, 07:30
Look at the column templates. There’s at least a spacer a line template to break up layout.

Talyn
August 11th, 2018, 11:37
In a string field you can use \n and \r whichever gives the result you're after.

Bidmaron
August 11th, 2018, 13:15
Talyn, I was attempting to do it with controls for some reason, and what I did is the code equivalent of what you are saying. I am working on a general-purpose DialogLib manager for ruleset and extension developers. I will post a teaser example graphic of it today with a dialog similar to what will be in the next version of the Generators extension.