Here’s a curious thing: When I print out a line of text in 12-point, Times New Roman, from Microsoft Word, the printed text is bigger than when the same thing is printed from a Xojo TextArea control (using a StyledTextPrinter).
What can I do to the TextArea print process to make it match the Microsoft Word output?
by “printed” do you mean on paper?
or do you mean side by side on the screen?
if on the screen, I’d say WORD was using a “virtual piece of paper” that is not 1:1 scale with the screen, where the TextArea IS 1:1 with the screen.
If you mean on an actual printed piece of paper, then look at the mechanism you used to “print” the textarea
I have no idea if this is your problem or not; but, Microsoft is great at adding duplicates of the same font to your system. On my Macs there is a Microsoft folder in the /Library/Fonts/ folder and it contains a Times New Roman font and there is a Times New Roman font outside of the Microsoft folder. This is true of several other fonts in the Microsoft folder.
A long time back I used Apples Font Book app to find all duplicate fonts. I then checked the info for each font and turned off the one with the older date, regardless of which folder it was in, the main /Library/Fonts/ folder or the Microsoft folder within that folder.
Like I say, I have no idea if this may be a part of your problem or not as I am not fully aware of how a particular font gets chosen when there are duplicates and whether this could lead to your problem.
[quote=216143:@Christopher Lester]Dave, the “printed on paper” results are different. The mechanism I used was a StyledTextPrinter to a Graphics object obtained from OpenPrinterDialog(). Is that enough info to make a diagnosis?
Thank you for the help![/quote]
It might also be possible that the issue might be directly related to the use (or non-use) of MaxHorizontalResolution and MaxVerticalResolution when printing from XOJO. If Word uses the printers BEST quality and XOJO were instructed to use something different (Default is 72dpi) the visual perception of what should be identical would look vastly different. But then it also depends on the defintion of “bigger”.
First and foremost, make sure no scaling is done on either side, which could explain the size difference. Like shrink to fit on the Xojo side and no scaling on the Windows one.
Xojo and Word use different strategies for printing. Word is particurly strange when it comes to printing. Though the years, I discovered it manages the space character itself to better tune line space, as well as replace fonts, and has its own line space. Xojo does not do that. So having an identical rendition is very difficult.
What can probably be done is to create a new TextArea off window (using a control set) and with the use of StyleRun change the font size in that shadow TA before printing from it.
The trick will be some amount of experimentation to find out the percentage of size increase to have the exact same size. It usually can be done with a simple ruler by measuring the size of a long word. Not a sentence, because of Word variable spacing.
I think Word’s printout is accurate and Xojo’s is not, and here’s why I think that:
With Xojo, I drew a 12-point high box, a 16-point high box, and a 72-point high box on the printout. The 72-point high box is exactly one inch. So that’s calibrated perfectly. Xojo is at least getting DrawRect() sizes perfect.
The Word printout of 16 pt, Times New Roman, makes use of the entire vertical space of the 16-point box. In other words, printing a “pT” on the page, the bottom tip of the “p” and the top tip of the “T” cover the available space 16-point space. This indicates to me that Word is printing a 16-point font correctly (at 72 points per inch at exactly). The Xojo printout of the same text is slightly reduced for some reason, by about 4-6 points.
I will look into the options for scaling (but if you have any additional ideas, let me know now!). I’m hoping that 100% scaling in Xojo means a 16-point font will come out at 16-points (or, the 72-point font will be one inch high).
I don’t mind adding scaling, but that’s obviously a work-around and certainly not expected behavior.
I think Word’s printing of the letters is still the correct size, as the leading would be affected by the line-spacing settings, not the font-size settings. So, whether I’m printing lines of 16-point text at 16-pt or 24-pt line-spacing, the text itself still has to conform to 16-point size.
Xojo’s approach produces the results you would get from a dot-matrix printer. 12-point text looks good at 6 lines per inch. It sounds like 6 lines of 12-point text from Word would take more than one inch of paper. Since what I want/expect is the same result as my old dot matrix (a must in the world of office forms), I consider Xojo to be correct. You may have a different expectation/desired result.
Xojo’s font metrics include leading. Specifically, TextHeight is the line height. If you increment your Y coordinate by that amount, it will look good on paper. If Word functions differently, then I guess the results will look different.
12-point text doesn’t determine the line-spacing in Word. The line-spacing setting determines that. Spacing depends on the leading (or line-spacing) that is set. This is true of Xojo. Print 12-point text at 12-point leading, and you should get six lines per inch. Print it at 120% and it will look better/proper.
That’s too bad if that’s true, because nowhere else does font size indicate leading. Font-size has nothing to do with leading. Leading is the space between lines. Font-size is the maximum height of the font. I can print 12-point font with 120% leading (which is the standard), or with 90% leading (squished together) or with 200% leading (very widely spaced). They are two different metrics. :-/
I hope this isn’t the case for Xojo, because it would make printing somewhat cludgy if we have to accommodate this. If I want to print a 12-point font, I expect it to come out 12-point size.
I’ll continue looking into it. If you guys have any more input, I’d be grateful.
ADD: I wonder if there’s any scaling being done between TextArea and printout. I’ll continue looking at possible scaling issues…
Sorry, but as you wear your Word glasses, you miss on the fact that fonts are designed with precise metrics that fix width and height of characters. “Leading” is a precise terminology that is not equivalent to “Line spacing”.
Word is just an app. Seems to me you WANT everything to work like Word because that is what you are accustomed to, so you reject outright any attempt to explain to you that other software may work otherwise. Tim is trying to help here. If you really want some assistance, what is the point in arguing against everything he says ?
Much before Word even existed, font technology already has set forth standards still used today.
If you really want everything to work like Word, the best way is to use Word. Second best option would be to use OLE, if that is possible. But then, how does one detect when Word is installed on the machine, and what does one do when it is not here ?
Finally, you can try to emulate what Word does with Xojo, but that requires work. And an open mind…
I just tried printing a 12-point font-size with OpenOffice. Guess how it printed? 12-points. Just like Word. That’s because when you specify a 12-point font size, you should get a 12-point font size printed out.
I think what Tim is saying is that “font-size” in Xojo’s TextArea doesn’t mean “font-size.” It means “line-height” (or leading). @Tim Hare , would that be accurate?
I thought Tim was throwing out ideas, so I wasn’t sure if he was claiming facts or opinions/guesses. My apologies if it seems argumentative, but I have to be precise in my understanding here. When I need to print 12-point font size text, it has to be 12-point font size text. If Xojo’s printing capabilities are not standard, I need to know how to work around it. So, if I’m arguing, I’m just arguing to make sure I know exactly what’s going on- to clarify, confirm, etc.
ADDED: I work with the government. When they specify 12-points for their printed forms, you MUST use 12-points. It’s a law sometimes.
If it’s as simple as “font-size in Xojo TextArea actually means leading,” then I can work with that. I just need confirmation of that from Xojo devs I guess…
I just did a test with Bob Keeney’s FTC. It prints 12-point font-size text at 12-points, just like Word. Just like OpenOffice.
In other words, FTC prints font-sizes properly.
So, I just need to figure out why Xojo’s TextArea’s 12-point font size does not actually print at 12-points. I think Tim is right about this one: the font-size doesn’t actually specify the font-size but the leading.
[quote=216889:@Christopher Lester]@Michel Bujardet …fonts are designed with precise metrics that fix width and height of characters. “Leading” is a precise terminology that is not equivalent to “Line spacing”.
Leading is more about line-spacing than font-size .[/quote]
Here you go again. The considerations of a Wikipedia author do not change the fact that within the font itself, there are instructions that fix the distance between lines. Without special printing routines such as what Word does and its clone Open Office, a font will naturally space, according to its internal coding. That is called leading by font designers. I should know a thing or two about it, since my business has been fonts since 1987…
I have been trying to tell you that the standard is not Word. It may be a usual app for Windows, that does not make it a standard. Fonts are subject to ISO standards.
Xojo engineers will chime in if they need to. As it stands, it seems they did not see the point in doing so. But Tim Hare is a very respected developer. You should trust him.
I have been trying to tell you precisely to live with the way Xojo works. In Xojo, internal instructions of the font are applied row. Which means indeed leading is proportional to the font size. Note that the font size is NOT the same as line space. Depending on the font design, leading can be quite different to the font size. For instance, with the same font size, Arial looks much higher than Times.
To summarize, and coming back to your original statement, if indeed a line printed in size 12 is wider in Word, that means either Word or Xojo do not comply with the same specs. This can be compensated as I described above. Line spacing in TextArea.Print being set by the font internal instructions, the result will indeed never be like Word, especially if you mix font size within a line and between lines. The solution is instead of using the easy, ready-made print routine, to elaborate your own.
I did it myself in the past. It is not so difficult to do, really.
[quote=216891:@Christopher Lester]So, I just need to figure out why Xojo’s TextArea’s 12-point font size does not actually print at 12-points. I think Tim is right about this one: the font-size doesn’t actually specify the font-size but the leading.
You are mixing all here. Font size sets the size of the character. In doing so, it sets line width, and well as leading, according to what is instructed into the font. For size 12, the height of the character should be the same. The width of a word should be the same.
Line spacing can be set by the software printing routine, or left to the font internal specifications. In Word, OpenOffice or FTC, that is fixed. You can have font sizes of 12 or 56, the line spacing does not vary. In Xojo, it depends on the fonts. If there is a 56 point size part in a line, spacing will be increased proportionally.
That’s what I’ve been saying this whole time. The actual size of the character of a 12-point font should print 12-points high on a sheet of paper. The space from lines above/below is leading, and can be set independently, even if there is a “recommended leading” specified in the font definition.
Actually, in Xojo’s TextArea, it’s fixed. You cannot change the line spacing. In those other apps, you can change the line-spacing, so it’s not fixed in that sense.
I think they all work like that (Word and OO and FTC and Xojo). If you put 12-point and 72-point on the same line, the leading will conform to the largest font size. It’s just that in these other apps, you can actually change the line-spacing. In Xojo, you cannot. And, in those other apps, if you specify a 12-point font, you get a 12-point font. In Xojo, you get 12-point leading.
[quote=cklester]When I print a font from a TextArea to a StyledTextPrinter, it comes out scaled down. For example, a 12-point font does not get printed at 12-points. It looks like it’s printing at around 8pt.
Is there a scaling factor that happens somewhere? I was told on the forums that the TextArea font-size is actually the leading, but that can’t possibly be true.
[quote=Xojo, Inc.]No, it should just be the font size. It should not have anything to do with interline spacing.
Are you taking into account that the printer dpi is higher and Word may be taking that into account. Drawrect does that but DrawString doesnt. So, you have to scale the font when you draw the string so it draws at the right size.
It might be worth contacting Bob about this since FTC does this the right way.