Non-english text size too small in windows 7 - delphi

I am trying to display the current date in Nepali language. I have declared constant string for the caption. It renders the text pretty fine on windows 8.1 but the same text is displayed too small in windows 7. Adjusting the font size also doesn't help much as it should.
Things I tried
Installed Nepali language pack for windows 7
Installed several Unicode fonts like arial unicode ms, segoe ui, microsoft neo gothic and others
The source code has been saved as UTF-8 encoding
But the problem remains same.
Windows 8.1 output:
Windows 7 output:
There are two labels on the form. One is used to display the current temperature("segoe ui" font) which renders pretty fine on both the windows versions while the other one is used for displaying the date that has the actual problem.
Edit
How to create issue?
create a new vcl form application project
Drop a label and a button
On button click change the caption of the label
sample code
procedure TForm1.Button1Click(Sender: TObject);
const text = 'आइतबार कार्तिक २७ गते २०७२';
begin
Label1.Caption := text;
end;
The font property for label has been set to: #Microsoft NeoGothic,11,[B],ANSI_CHARSET,clWindowText
By the way, this font doesn't exist in windows 7, I installed it and other ones as well but this couldn't help.
SO the question is, "How to display the caption in similar fashion in windows 7"

Related

Wrong font although it is installed

I draw text on a canvas and set the font by:
Image3.Canvas.font.name := 'Arial Narrow';
Everything is right on my machine. But on another pc from my client the wrong font (bigger) is printed.
So I installed all Arial Narrow fonts on the clients machine. But I still have the wrong font.
Edit: Font seems to be right, but not scale:
This is the problem
Windows 7 has on its Control Panel, Appearance and Personalization, Display setting, an ability to Magnify the text and other items by 125% or 150%.
Any ideas how to get those settings?
At first you set the size of the image as bitmap,Because before using canvas, bitmap has to be created.
so that bitmap.canvas.font does have a default size,
so later it wont increase its size.So the original font will be produced.
Getting the DPI and adjusting the font size did it for me:
DC := GetDC(HWND_DESKTOP);
try
DPI:=GetDeviceCaps(DC,LOGPIXELSY);
finally
ReleaseDC(DC,HWND_DESKTOP);
end;
Image3.Canvas.font.size := round(myConstant*96/DPI);

Textbox shifting when printing [MS Word 2010]

I have a document in MS Word 2010 that contains several textboxes. The document looks completely fine in print preview; however, when printed the texboxes shift position. The strange thing is I've tried printing the document on another printer and it works just fine. It also works if I try to print it from Word 2007. I ran the compatability checker in Word and it came back with the following message: "Some text box positioning will change".
Anyone have a clue what's going on here?
According to this site, the message appears due to the following:
In text boxes, text that is centered vertically or aligned to the
bottom will be permanently aligned to the top even if you later
convert the document to Office Word 2007 format.
This site has similar text
In text boxes, text that is centered vertically or aligned to the
bottom will be permanently aligned to the top even if you later
convert the document to Word 2010 format.
Either way, if a different printer attached to the same system prints it correctly then you will want to see if the printer that fails has an updated (or alternate) print driver.
I had a similar problem when printing a .doc file in Word for Mac 2011. I saved it as a .docx file instead, and that fixed it!

Delphi 5 Form Caption Font Size

I am currently resizing my Delphi5 application from 800x600 to be scalable up to 1440x1080.
The only thing that still looks too small is the Form Caption and the ShowMessage/MessageDlg text.
Am I right in thinking the ShowMessage text is related to the Windows default size?
Is there any way to increase the Form Caption font size? It doesn't seem connected to the Form font size.
Thanks
The font size of the title bar is handled by windows and is system wide. If you want modify the font or other attibutes you must draw manually the non client area of the form(Windows).
Until Windows XP you can draw directly in the caption(title) bar modifying the font , color and text handling the WM_NCPAINT message, starting with windows vista and the DWM introduction you must use the DwmSetWindowAttribute function with the DWMWA_ALLOW_NCPAINT value in order to use this technique.

In Delphi, Is there a way to adjust the line spacing of a TMemo?

I'm working with a TMemo component to display some text in a limited space. Currently it's using a truetype font which doesn't ship with windows and is installed by the app when it runs.
On my PC (Running Windows XP), the spacing between each line of text seems to be about eight pixels. On a different PC running Windows 7, the line spacing seems to be about 14 pixels, which is pushing the bottom row of text out of visibility on the memo.
So, My question is really this:
Is this caused by the different versions of Windows? It's all I could think that was different.
Is there some way I can adjust this value so it would be consistent across all instances of the application, wherever it was running?
Alternatatively, is there a different component I could use which might let me tweak this value?
TMemo is a descendent of Windows Common controls and it's behavior depends on current Windows configuration so it is natural to get different results with it.
If you just want to display some information it's better to use components which let you set texts positions and their style precisely like TRichView. This component is not free but it has it's own text rendering engine and let you style texts with CSS like selectors which look the same in different versions of windows.
In addition to Mohsen's answer I'd like to mention LMD ElPack and it's ElEdit component which also has it's own text rendering engine. Unlike TRichView ElEdit is a plain text edit / memo component, so it's a drop-in replacement for TEdit / TMemo. And line height is configurable there

How to display Greek symbols in a TMenuOption

In Delphi 2010, I want to display the Greek symbols (alpha, beta, etc.) in TMenuOption and other types of VCL controls.
Assigning
TEdit.Text or TMenuItem.Caption := 'Hydrogen ' + chr(945) + ' More Text'
seems to work fine.
I'm worried that this might won't work on all machines. TEdit has a font property, TMenuItem doesn't, so I'm guessing it uses some default system font.
Should chr(945) always show as the Greek alpha character regardless of font? If not, is there some way for me to assure that the chr(945) always appears on the screen as the alpha character other than hard-wiring the font (which would be tough to do for the system font...)
TIA
You can also use constants. The source files are unicode too so you can add any kind of constant. Just remember to save the source as unicode.
const
alpha = 'α';
beta = 'β';
gamma = 'γ';
Since Delphi 2010 is unicode, chr(945) always point to the same character, in this case Greek Alpha. This character will display correctly if the font that is used to draw the menu item contains that character. There is no risk of another character being drawn, except maybe for the question mark, which is usually used by Windows if a font doesn't contain a specific character.
Most Windows fonts do contain common unicode characters (including Greek). The user might however be able to select a different font that doesn't. You can draw the menu yourself using a different font that is installed on the system, but this might be an awful lot of work for something that will normally work out of the box.

Resources