I have started posting what I call "Mini-Tutorials" about the Icetips Utilities. The first one is up and is about the String class.
There is a lot of powerful stuff in the Icetips Utilities and we are far enough ahead into this product now that we can start showing people really how they can be used. The tutorials are not about how the classes work, but how you can use them. They demonstrate with simple code how to accomplish certain tasks, in this case for example how to quickly read and write text files without using the Clarion ASCII driver. Also how to export data to comma separated files and even XML.
We will be posting one tutorial every Monday so make sure that you check them out!
-- Arnor Baldvinsson
We have made build 2352 available for download. This build includes mostly updates to the documentation - several more templates have been documented - and it also includes minor fixes to the ReadFileToString and WriteStringToFile methods that would report errors on the wrong api in some circumstances.
We are trying to get into a schedul or releasing something new every Monday but we hit an unexpected problem yesterday so we delayed the release until this morning!
-- Arnor Baldvinsson
Two months ago I implemented the Clarion PDF generation templates in a client project. I was pretty horrified by the results as characters were chopped and spaced very strangely. After posting about this on the Clarion newsgroups, Lee White suggested that this was because I was running Large Fonts on my system.
Since I have had to deal with Large Font issues before simply because I use high resolution and need to be able to see
I decided to take a closer look at this and see what was going on.
Sure enough the problem stems from code in the ABPRPDF.CLW file where the width of the characters is calculated. To fix this I made some changes to the files.
This involves adding a single method to the PDFGeneratorClass class in ABPRPDF.INC and ABPRPDF.CLW:
Add to class declaration in ABPRPDF.INC (I put it in at the top of the
method list, around line 195):
AdjustDPIValues PROCEDURE(Long pValue),Long !! AB 2009-02-19 Adjusts DPI values
In the classfile, ABPRPDF.clw, I added this:
PDFGeneratorClass.AdjustDPIValues PROCEDURE(Long pValue)!!,Long !! AB 2009-02-19 Adjusts DPI values HDcScreen UNSIGNED IDPI Long R Real L Long Code R = 1 HDcScreen = GetDC(0) If HDcScreen <> 0 IDPI = GetDeviceCaps(HDcScreen, 88) L = ReleaseDC(0, HDcScreen) R = IDPI/96 End Return (pValue / R)
In PDFGeneratorClass.AddFontDescriptor method, you have code like this:
!SET the fonts Width
LOOP LOC:I=SELF.FontsNames.FirstChar TO SELF.FontsNames.LastChar
LOC:CharToTest=CHR(LOC:I)
IF GetTextExtentPoint32(LOC:DC,LOC:CharToTest, 1,LOC:CharSize)<>0 THEN
IF LOC:Subclasing THEN
IF SELF.FontsNames.CharWidth[LOC:I] THEN
SELF.FontsNames.CharWidth[LOC:I] = LOC:CharSize.eW
END
ELSE
SELF.FontsNames.CharWidth[LOC:I] = LOC:CharSize.eW
END
END
END
I changed both of the assignments to the CharWidth to:
SELF.FontsNames.CharWidth[LOC:I] = |
SELF.AdjustDPIValues(LOC:CharSize.eW)
In PDFGeneratorClass.GetTextWidth method, you have code like this:
IF SelectObject(LOC:DC, LOC:HFont) THEN
RV = GetTextExtentPoint32(LOC:DC,pText, LEN(pText),LOC:CharSize)
LOC:OLDMAPMODE=SetMapMode(LOC:DC,LOC:OLDMAPMODE)
DeleteObject(LOC:HFont)
RETURN LOC:CharSize.eW + (LOC:CharSize.eW/20)
END
I changed the RETURN to adjust the value:
RETURN SELF.AdjustDPIValues(LOC:CharSize.eW + (LOC:CharSize.eW/20))
This takes care of the font sizing problem in any DPI combination that I
threw at it![]()
Arnor Baldvinsson