After inspecting the information of individual fields attached to the doc.Form I see the expected font settings. However, once Stamp() is called and the PDF rendering completes the font size is not retained, although the font itself and some relative sizing is.
Versions: 7 and 8
Additionally, despite having :
doc.Form.NeedAppearances
doc.Form.GenerateAppearances
doc.Form.FormatFields
set true, the system appears to ignore Adobe JavaScript such as:
getField('MyField').textSize = 12
Should anyone else encounter this error, you should start by checking the size of the fields on the PDF you are filling. If the field sizes are not deemed large enough to hold your selected font then ABCPDF scales the font to a size of its choosing. Once the fields are large enough to contain the font, by ABC's standards, then the font size will be limited by the settings you choose. In this case you should oversize your fields whenever possible.
Related
The Problem
I am loading the classic serife.fon file from Microsoft Windows using FreeType.
Here is how I set the size:
FT_Set_Pixel_Sizes(face, 0, fontHeight);
I use 0 for the fontWidth so that it will be auto-calculated based on the height.
How do I find the correct value for fontHeight such that the resulting font will be exactly 9 pixels tall?
Notes
Using trial and error, I know that the correct value is 32 - but I don't understand why.
I am not sure how relevant this is for bitmap fonts, but according to the docs:
pixel_size = point_size * resolution / 72
Substituting in the values:
point_size = 32
resolution = 96 (from FT_Get_WinFNT_Header)
gives:
pixel_size = 42.6666666
This is a long way from our target height of 9!
The docs do go on to say:
pixel_size computed in the above formula does not directly relate to the size of characters on the screen. It simply is the size of the EM square if it was to be displayed. Each font designer is free to place its glyphs as it pleases him within the square.
But again, I am not sure if this is relevant for bitmap fonts.
fon files are exe files with a fnt payload, where the fnt payload can be a vector or raster font. If this is a raster font (which is most likely) then the dfPixHeight value in the fnt header will tell you what size it's meant to be, which is exposed by FreeType2 as the pixel_height field of the FT_WinFNT_Header.
(And of course, note that using any size other than "the actual raster-size of the FNT" is going to lead to hilarious headaches because bitmap scaling is the kind of madness that's so bad, OpenType instead went with "just embed as many bitmaps as you need, at however many sizes you need, because that's the only way your bitmaps are going to look good")
The FNT-specific FT2 documentation can be found over on https://www.freetype.org/freetype2/docs/reference/ft2-winfnt_fonts.html but you may need to read it in conjunction with https://jeffpar.github.io/kbarchive/kb/065/Q65123 (or https://web.archive.org/web/20120215123301/http://support.microsoft.com/kb/65123) to find any further mappings that you might need between names/fields as defined in the FNT spec and FT2's naming conventions.
There are proportional fonts (i.e. not monospaced) that nevertheless provide monospaced numbers. E.g. see this Excel screenshot using Arial:
Note how the numbers are nicely aligned. How can I find out programmatically (probably WinAPI) if a font supports this feature?
You won't find an API for that because there isn't any specific metadata value within the font file to indicate "the glyphs for digits in this font have fixed width". Some fonts may support both proportional and fixed-width ("lining") digits, in which case the font is likely to support the 'lnum' OpenType Layout feature. You should pick a font that supports this feature and then explicitly activate that feature when drawing the text.
FreeType has font metrics for the underline position, but I can't seem to find any metrics for the strikethrough position. How do text engines usually compute this value? Should I just put it at 1/3*ascent or whatever looks good? I suppose that for Latin at least this should be 1/2*height of "m" but I'm looking for a more general solution.
This information is not provided for all the various font formats supported by Freetype; so it is not exposed on the "main" interface.
In the (common but not universal) case of TrueType or OpenType fonts it can be retrieved in the TT_OS2 table, fields yStrikeoutSize and yStrikeoutPosition; you should be prepared for the table to be lacking, or yStrikeoutSize to be null or negative thus unusable.
I do not remember of an equivalent for plain Postscript fonts (.pfb/.pfa, even in .afm.)
The various bitmap formats might have the information available; an example is strike_out in Windows FNT; notice this is the position, while the size defaults to be the same as underlining. Basically every format is alone here.
When i type 1960 characters in CKEditor and submit the form, my controller is getting around 2000 characters. I have checked through the data but still cant find out the exact reason why it is going like that
Length of data in UI : 1978
Length of data in Controller : 1991
so, additional 13 characters are added.
The data i am sending in UI is as follows --------------------------------------
Some older driver versions allowed you to select the “letter” size and adjust the margins to define the ticket size. This feature is still available in the new drivers to support old installations. When selecting a new font, Windows will default to the previous font size. This size will usually be incorrect. You must re-assign a valid font size to guarantee the proper font representation on your screen. "Tall" font in Word Pad does not display properly on the screen. Driver Use – Word Only (PCL and FGL) Before using Word, you must select the “use printer metrics to layout document” box in tools/options/compatibility. All of the previous “driver use” guidelines apply to Word. Word also provides you with the unique ability to define a custom page size within the application itself. We strongly recommend against the use of this feature. However, the following description will explain the use and limitations of this feature. While Word allows you to manipulate the page size in both portrait and landscape modes, the data sent to the printer only functions properly in portrait mode. You cannot print in landscape mode with a Word defined custom page size. In portrait mode, you can manually set the height for any ticket length up to 11 inches. For ticket lengths greater than 11 inches, you will need to add your own page size as described above in the “all applications” section. lengths greater than 11 inches, you will need to add your own page size as described above in the “all applications” section. lengths greater than 11 inches, you will need to add your own page size as described above in the “all applications” section. lengths greater than **
The data im receiving in controller is as follows --------------------------------------
Some older driver versions allowed you to select the “letter” size and adjust the margins to define the ticket size. This feature is still available in the new drivers to support old installations.
When selecting a new font, Windows will default to the previous font size. This size will usually be incorrect. You must re-assign a valid font size to guarantee the proper font representation on your screen. "Tall" font in Word Pad does not display properly on the screen.
Driver Use – Word Only (PCL and FGL)
Before using Word, you must select the “use printer metrics to layout document” box in tools/options/compatibility. All of the previous “driver use” guidelines apply to Word. Word also provides you with the unique ability to define a custom page size within the application itself. We strongly recommend against the use of this feature. However, the following description will explain the use and limitations of this feature.
While Word allows you to manipulate the page size in both portrait and landscape modes, the data sent to the printer only functions properly in portrait mode. You cannot print in landscape mode with a Word defined custom page size.
In portrait mode, you can manually set the height for any ticket length up to 11 inches. For ticket lengths greater than 11 inches, you will need to add your own page size as described above in the “all applications” section.
lengths greater than 11 inches, you will need to add your own page size as described above in the “all applications” section.
lengths greater than 11 inches, you will need to add your own page size as described above in the “all applications” section.
lengths greater than
I depends on the way you are requesting the output, but this can be spaces or this could also be some \n\r tags for all the that you have inserted.
Did you try already to see the differences in short texts, to find you what it is exactly?
I think it are some \n\r tags, you should see these tags when you request the data in you code.. If not i'm sure it are spaces.
I have a NSPopUpButton which contains either English or Japanese Strings read from a plist file according to the System's Language. Now when the Language is English I am able to change the font size by using code such as -
[auxStatePopup setFont: [NSFont fontWithName:#"Helvetica-BoldOblique" size:10.0]];
but Using such technique I am not able to change Japanese font size even if I tried by setting some Japanese font name which I googled and found out.
I want to do that because Japanese characters move slightly up when used. I intend to manipulate that upward movement by decreasing font size.
Thanks for any help..
OR
any way to move text in NSPopupButton downwards?
My impression is that the two samples are not using the same font. Please try to put a text with characters from both sets and see what happens.
Also try not to customize the font size and even the font face.
I also suspect that the text rendering engine may had overridden some of your changes due to the text length. iOS text rendering may try to change the font size of letter spacing if the text does not fit the control. So make some tests with shorter texts.
BTW, I think that you were mean to say that you want bigger font size for Japanese not smaller. In the screenshots the Japanese text is already too small to be properly read by anyone.