LEADTOOLS Support
Document
Document SDK Questions
(LT14 + VB6) Resize Stamp to fit the text set in it.
This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Wednesday, August 11, 2010 11:49:29 PM(UTC)
Groups: Registered
Posts: 26
Hello all,
Aim:
Set Stamp annotation width to fit the text.
Scenario:
A annotation file designed at xx height of rasterview using stamps.
These stamps assigned text like "Patient ID:"
Load this annotation file in rasterview having patient images and display the value of text assigned in stamps along with text like "Patient ID: 12345".
Problem:
After assigning the details I am able to set the width of stamp annotation exactly fit to text i.e no space left to both sides,
but for different rasterview sizes by height and different font sizes and fonts its not exactly fit to it.
For normal workaround I set the text to label setting its autosize property to true and then setting the width of label to stamp annotation
but still either the stamp cuts the text shown in it or either they get spread by width.
I am setting the width currently as :
RAnnFooter.AnnRectWidth(annObject) = ((lblPatientTagSetting.Width / Screen.TwipsPerPixelX) * 0.74) + 6
Here 0.74 and 6 are assumed constants by which the width is getting fit to for now for fixed height of rasterview,
having fixed font size and name.
Hoping for some workaround,
Regds,
#2
Posted
:
Thursday, August 12, 2010 3:37:29 AM(UTC)
Groups: Guests
Posts: 3,022
Was thanked: 2 time(s) in 2 post(s)
You might be able to make use of the DrawTextWidth method (Main OCX Control or ILEADRasterFXD if you're using the RasterCOM objects) to calculate the string width.
#3
Posted
:
Thursday, August 12, 2010 11:35:15 PM(UTC)
Groups: Registered
Posts: 26
Hello Adnan,
Thanks for reply, I tried the way you told me to use DrawTextWidth method of RasterFXD.
The Problem is still there are spaces to both sides of text, the stamp is not fit to text.
I am attaching a sample herewith, where you can see as the text grows the spaces to both sides of stamp grows. Also this is depend upon the font and font size. As if the font is set to bold, italic or setting different sizes. the spaces grows or cuts the text as per.
Waiting for reply,
Regds,
#4
Posted
:
Sunday, August 15, 2010 4:09:02 AM(UTC)
Groups: Guests
Posts: 3,022
Was thanked: 2 time(s) in 2 post(s)
There is a scale factor between the AnnFont size and the FXD, you can solve the problem change the code to use this line:
rasterFXD.Font.Size = 11 * 72 / (1440# / Screen.TwipsPerPixelX)
#5
Posted
:
Monday, August 16, 2010 4:37:10 AM(UTC)
Groups: Registered
Posts: 26
Hi Adnan,
Thanks for the reply and yes the solution you given working. Thanks again.
Just more thing I want to know is why we use 72 here as a scale factor.
Thanks,
#6
Posted
:
Monday, August 16, 2010 11:29:54 PM(UTC)
Groups: Guests
Posts: 3,022
Was thanked: 2 time(s) in 2 post(s)
72 is not a scale factor. It's from the definition of a font 'point' in typography, which is equal to 1/72 of an inch.
This means regardless of scaling or bitmap resolution, 1 inch in font measurements equals 72 points.
#7
Posted
:
Tuesday, August 17, 2010 4:05:24 AM(UTC)
Groups: Registered
Posts: 26
Hi,
Thanks for the reply.
It solved my problems.
Thanks again.
LEADTOOLS Support
Document
Document SDK Questions
(LT14 + VB6) Resize Stamp to fit the text set in it.
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.