Hi -
I'm using ContentCreator and ShowtextBlock to add text to my PDF, and I've found an issue when using
Stroke and font size.
Even though I'm using CoreAPI, I've replicated the problem in PDF-XChange Editor and used the screenshots here.
The issue is that the Stroke Width is not absolute, but seems tied to the Font Size instead which gives unusable output.
If you compare these two screenshots, you can see that the only change is the Font Size, but the result has vastly different
strokes:
I would expect the 0.7pt stroke to appear exactly the same, but clearly it does not....
I have the same issue when using Stroke via CoreAPI.
Stroke/Outline issue with ShowTextBlock
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.
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.
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: Stroke/Outline issue with ShowTextBlock
Hello Wayne,
Well you have the "Scale relative to target page" checkbox enabled - try experimenting without it.
Cheers,
Alex
Well you have the "Scale relative to target page" checkbox enabled - try experimenting without it.
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Re: Stroke/Outline issue with ShowTextBlock
Unchecking 'relative' only makes the font size exact (instead of auto-scaling up to fit).
However, when the font size is small, the stroke is still way too large:
Plus, since I'm using CoreAPI I would need an equivalent to "scale relative".
I'm also auto-scaling to fit the diagonal and getting the same problem that I originally
posted - giant stroke....
However, when the font size is small, the stroke is still way too large:
Plus, since I'm using CoreAPI I would need an equivalent to "scale relative".
I'm also auto-scaling to fit the diagonal and getting the same problem that I originally
posted - giant stroke....
- Lzcat - Tracker Supp
- Site Admin
- Posts: 677
- Joined: Thu Jun 28, 2007 8:42 am
Re: Stroke/Outline issue with ShowTextBlock
Hi Wayne.
You have specified font size 10 pt, and stroke width 1 pt, so you result is exactly as expected.
When you using autosize you enlarging text with stroke, not just text, as you saw before (because autosize does not change font size, but change matrix that affect everything).
When using Stroke via CoreAPI how do you set stroke width and how position text with stroke? If you are changing CTM - it will affect all drawings (coordinates, line widths, fonts size). So if you want to change only font size - you should change only it, but not CTM.
HTH.
You have specified font size 10 pt, and stroke width 1 pt, so you result is exactly as expected.
When you using autosize you enlarging text with stroke, not just text, as you saw before (because autosize does not change font size, but change matrix that affect everything).
When using Stroke via CoreAPI how do you set stroke width and how position text with stroke? If you are changing CTM - it will affect all drawings (coordinates, line widths, fonts size). So if you want to change only font size - you should change only it, but not CTM.
HTH.
Victor
Tracker Software
Project manager
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
Tracker Software
Project manager
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
Re: Stroke/Outline issue with ShowTextBlock
I'm using ContentCreator for the Font and Drawing (is that what you mean when you refer to CTM?)
So how can I keep the Stroke at a specific value (1pt, 1.5pts, etc) ?
(I see the exact same issue in the Editor as shown by my screenshots)
Code: Select all
contentCreator.SetStrokeColorRGB(color.RGB);
contentCreator.SetLineWidth(1);
...
contentCreator.ConcatCS(mResMatrix);
...
contentCreator.ShowTextBlock....
(I see the exact same issue in the Editor as shown by my screenshots)
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: Stroke/Outline issue with ShowTextBlock
Hello Wayne,
Here's a screenshot from MS Word (that behaves like the Editor): About CTM:
viewtopic.php?f=66&t=25815&p=101005&hilit=CTM#p101005
What we suspect that you are doing, is changing the text box's size by using the matrix that you have specified and this, of course, changes the Font Size and the Stroke Width accordingly. We'll need a full code sample on what you are doing to tell for sure.
If you want the correct behavior, you would first need to calculate the correct font size by the resulting rectangle size and then place it with the needed stroke.
Cheers,
Alex
Here's a screenshot from MS Word (that behaves like the Editor): About CTM:
viewtopic.php?f=66&t=25815&p=101005&hilit=CTM#p101005
What we suspect that you are doing, is changing the text box's size by using the matrix that you have specified and this, of course, changes the Font Size and the Stroke Width accordingly. We'll need a full code sample on what you are doing to tell for sure.
If you want the correct behavior, you would first need to calculate the correct font size by the resulting rectangle size and then place it with the needed stroke.
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Re: Stroke/Outline issue with ShowTextBlock
Hi Alex -
I reviewed the word sample, and you're right (again!) - I was being stupid and confusing font size with thickness.
So, yes, I need a way to apply the stroke after the scaling of the font....
The code I'm using is actually code that you supplied here: viewtopic.php?f=67&t=29823
I reviewed the word sample, and you're right (again!) - I was being stupid and confusing font size with thickness.
So, yes, I need a way to apply the stroke after the scaling of the font....
The code I'm using is actually code that you supplied here: viewtopic.php?f=67&t=29823
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: Stroke/Outline issue with ShowTextBlock
Hello Wayne,
Well, the algorithm should be like this:
1) You calculate the rectangle for the font size (name, parameters) that you need.
2) Then you take the size of the rectangle that you will need to put the text into.
3) Calculate the new font size based on the rectangle proportions scale coefficient (new height/old height).
4) Output the font with the new size and apply stroke to it.
Cheers,
Alex
Well, the algorithm should be like this:
1) You calculate the rectangle for the font size (name, parameters) that you need.
2) Then you take the size of the rectangle that you will need to put the text into.
3) Calculate the new font size based on the rectangle proportions scale coefficient (new height/old height).
4) Output the font with the new size and apply stroke to it.
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ