Issue with Fonts in ShowTextBlock

A forum for questions or concerns related to the PDF-XChange Core API SDK

Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Tracker Supp-Stefan

Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.

When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
Post Reply
whoit
User
Posts: 269
Joined: Tue Jul 07, 2015 3:30 pm

Issue with Fonts in ShowTextBlock

Post by whoit »

Hi -

CoreAPI 6.0.322.5

I'm testing ShowTextBlock and finding several issues/bugs.

I was told that you follow the Adobe XFA spec (3.3) however these settings do not seem to work properly.

When using the simplified "Font:" style described on page 1202 of the XFA guide:
Example: <span style="font: 24pt/80% 'Courier New' ">text</span>
1) /lineheight - values of % do not work ( 24pt/80% ) - the font shows as 24pt, but the line spacing
shows as 80pt not %.
2) /lineheight - values that are unitless numbers do not work ( 24pt/1.5 ) - line spacing is not
shown as 1.5 x FontSize
3) Using size without /lineheight does not work (24pt 'Courier New') - the font is shown in the proper size, but the font name is ignored
and the font used is defaulted.
Note that using '/normal' is a workaround but should not be required - ( 24pt/normal).

When using normal or expanded notation
Example: <span style="font-family:'Courier New';font-size:24pt;line-height:1">text</span>
4) line-height % does not work (line-height:20%) - value is ignored
5) line-height number (no unit) does not work (line-height:5) - it should be a multiplier of the font size but appears to be interpreted as "in"


I'll add more if I find them.
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Issue with Fonts in ShowTextBlock

Post by Sasha - Tracker Dev Team »

Hello Simon,

Have you tried this in the Adobe LiveCycle Designer? The easiest way of writing XFA type text is formatting the text there and then going to the XML source and use the generated body tag. Also, be aware of the default parameters that it uses outside of the body tag.

As for the line-height - it's a para property not a span property. So basically it should be used there. As for the percentage values - form fields do not support percents for the line height but they do support line height in points. The XFA differs when used in FreeText annotations and Form Fields - the Show Text block rich text is working in the Form Fields mode (basically the LiveCycle Designer mode).
Like you can see here in the XFA reference sample:
Example 27.20 Paragraph declaring a font with spans in different fonts
<p style='font:italic bold 16pt/0.5in "Minion Pro"'>
There are no percents here.

Also, when I tried using your sample in the LiveCycle Designer it said that there is no 'Courier New' font - basically meaning that this also won't work in our case (you can edit the XML there to see the results in the original Text Field for example).

As for the multiplier - well I don't know where you found that (it is not mentioned in the specification) - the LiveCycle Designer defaults values without types to inches - basically we do the same.

Summary:
If you want to use the XFA formatted rich text - format it in the LiveCycle Designer for your liking and then use the XFA formatted xml to output it.
PS:
The Adobe itself often does not stick to their specification and there were plenty of cases that were fixed experimentally that were not mentioned in the specification itself.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
whoit
User
Posts: 269
Joined: Tue Jul 07, 2015 3:30 pm

Re: Issue with Fonts in ShowTextBlock

Post by whoit »

Hi Alex -

Regarding line-height - I was going by the XFA guide you referred me to, page 1191, "Line Spacing":
"A paragraph of text may have the line-spacing of its text set via the use of the [CSS2] line-height style
attribute with a measurement"
CSS2 allows for percentage and for a multiplier ("number") - https://www.w3.org/TR/REC-CSS2/visudet.html#line-height

As for Courier New font, it is clearly present on my Windows 10 machine and works except as pointed out in my previous post.
This is true for any existing font - don't focus on Courier New specifically - try the formatting issue with ANY font...
I'm not sure why it does not work for you.

Your comment is probably most important: "The Adobe itself often does not stick to their specification and there were plenty of cases that were fixed experimentally that were not mentioned in the specification itself."

However, it would be nice if this stuff was documented in your on-line help ! :)

Thanks,
Wayne

P.S. Not "Simon" :)
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Issue with Fonts in ShowTextBlock

Post by Sasha - Tracker Dev Team »

Hello Wayne,

Sorry - there are many posts from different developers :)
As I previously said - if the Adobe does not support this, then we don't - we tried to make it work from their behavior. The best way to format your text is through the Adobe LiveCycle. I tried playing with fonts there - it formats the xml for you that will work.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
whoit
User
Posts: 269
Joined: Tue Jul 07, 2015 3:30 pm

Re: Issue with Fonts in ShowTextBlock

Post by whoit »

Also of note:

I just tried using "text-align:right" in the para field of my html and it does not appear to have any effect.
The html works fine in any browser.

<p style="text-align:right;color:#ff0000">This is html formatted text wrapped with one word in <b>bold</b>.<br/>and a line break plus <i>italic</i> word.</p>

So, are the text-align flags ignored by the TextBlock ?
Do I have to use the flags in ContentCreator?

-Wayne

P.S. I do not have access to LiveCycle Designer , and my clients probably won't either.
So, I need to know what all the rules are for formatting text because my clients will also want to know!
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Issue with Fonts in ShowTextBlock

Post by Sasha - Tracker Dev Team »

Hello Wayne,

Everything is implemented via the XFA specification - you can use it and it will work. Everything outside the specification (your html tests etc.) won't work as you expect. The HTML engine and XFA engine are entirely different. Here's a quote from the reference:
Rich Text is expressed in XFA via the use of [XHTML] markup augmented with a restricted set of Cascading Style Sheet attributes [CSS2], and a number of style attributes and values that are currently not part of the Cascading Style Sheet standard, but are proposed extensions. In addition there are several XFA-specific attributes, but these use an XFA namespace so that the content incorporating them is still valid XHTML/CSS.
What you need is to output a few lines of text - this should not be such a problem here if he watermarks simple logic worked for you. You can do this event without the rich text - would be much easier for you. The Content Creator has a possibility to define font parameters that Watermarks can do.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
whoit
User
Posts: 269
Joined: Tue Jul 07, 2015 3:30 pm

Re: Issue with Fonts in ShowTextBlock

Post by whoit »

OK, I'll see what I can do.
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Issue with Fonts in ShowTextBlock

Post by Sasha - Tracker Dev Team »

:)
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
whoit
User
Posts: 269
Joined: Tue Jul 07, 2015 3:30 pm

Re: Issue with Fonts in ShowTextBlock

Post by whoit »

OK, after a lot of testing, I'm still finding issue with the "line-height" property.

I cannot get "line-height" to work at all - here is an example that should work but does not.
(The fonts, sizes, and colors work - not line-height):

Code: Select all

<p style="line-height:1in; font-family:'Arial'; font-size:12pt;"><span style="color:#ff0000">This is html formatted</span><span style="font-family:'Times New Roman'; font-size:24pt; color:#0000ff"> text wrapped with one word in <b>bold</b>.<br/>and a line break plus <i>italic</i> word.</span></p>
The code is the paragraph "<p>" tag as required.
None of these variants work:
line-height:1in
line-height:1pt
line-height:1em
line-height:1%
line-height:1

Can you tell me why this does not work?
And, more importantly - can you reply with code that does work?

Thanks.
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Issue with Fonts in ShowTextBlock

Post by Sasha - Tracker Dev Team »

Hello Wayne,

Please use the XFA formatting with all of the needed tags (body etc) and try again.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
whoit
User
Posts: 269
Joined: Tue Jul 07, 2015 3:30 pm

Re: Issue with Fonts in ShowTextBlock

Post by whoit »

Hi Alex -

What tag besides "body" is missing?

(FYI - I've tried using body with no effect)

Have you tried the sample code I sent?
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Issue with Fonts in ShowTextBlock

Post by Sasha - Tracker Dev Team »

Hello Wayne,

Just experimented with this - it seems the RichText mode differs from the XFA Field's mode behavior in general. I will ask the developer who's responsible about this one.
Anyways I will explain again - changing the line height to 0 won't remove the gaps that you want.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
whoit
User
Posts: 269
Joined: Tue Jul 07, 2015 3:30 pm

Re: Issue with Fonts in ShowTextBlock

Post by whoit »

Hi Alex -
Ok, good - I didn't think I was going crazy, but it's always possible.

It would be nice to have an accurate document/example of exactly what works - I've spent
a lot of time testing and trying to figure this out.

Thanks,
Wayne
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Issue with Fonts in ShowTextBlock

Post by Sasha - Tracker Dev Team »

Hello Wayne,

Well we are waiting for the reply of developer who implemented this - as soon as we have that - I can tell you more.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Issue with Fonts in ShowTextBlock

Post by Sasha - Tracker Dev Team »

Hello Wayne,

Did some more experiments - this code includes the line-height correctly (which is basically your code):

Code: Select all

CC.ShowTextBlock("<body xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:xfa=\"http://www.xfa.org/schema/xfa-data/1.0/\" ><p style=\"line-height:1in; font-name:'Arial'; font-size:12pt;\" ><span style=\"color:#ff0000\" > This is html formatted</span><span style=\"font -family:'Times New Roman'; font-size:24pt; color:#0000ff\" > text wrapped with one word in <b>bold</b>.<br/>and a line break plus <i>italic</i> word.</span></p></body>", rcText, rcText, (uint)PXC_DrawTextFlags.DTF_RichText, -1, cf, null, null, out rcBlock);  //draw text block
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
whoit
User
Posts: 269
Joined: Tue Jul 07, 2015 3:30 pm

Re: Issue with Fonts in ShowTextBlock

Post by whoit »

Hi Again -

I'm trying to use several of the tags for ShowTextBlock but I'm not sure if they are supported or not.
I've tried several ways to use them, and they do not seem to work. I don't have access to LiveCycle Designer.
Can you please verify:

1) Lists
2) Hrefs
3) anything else from the XFA specs that you know does not work.

Thanks.
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Issue with Fonts in ShowTextBlock

Post by Sasha - Tracker Dev Team »

Hello Wayne,

Sorry but no - we have a major release soon - we don't have that much time.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Post Reply