Главная страница
    Top.Mail.Ru    Яндекс.Метрика
Форум: "KOL";
Текущий архив: 2007.01.21;
Скачать: [xml.tar.bz2];

Вниз

Font.Size or FontSize vs FontHeight   Найти похожие ветки 

 
L505   (2005-08-17 13:25) [0]

Hi,

What is an easy way of calculating FontSize from KOL"s FontHeight?

I beleive the FontHeight does not include the line "whitespace".

Lars


 
L505   (2005-08-17 14:17) [1]

p.s. this question is for KolEdit not KOLRichEdit


 
<Falcon>   (2005-08-17 16:19) [2]

EditBox.Canvas.TextWidth(EditBox.Text),
EditBox.Canvas.TextHeight(EditBox.Text)


 
Thaddy   (2005-08-17 18:36) [3]

Or for Richedit re_textsizeprecise


 
Lars   (2005-08-17 21:04) [4]

Bascically I still don"t know how exactly to get or set the font size equivilient to VCL style font.size (i.e. size 8, 9 10, etc.)
i.e. like notepad style font size.

Maybe there are some FontDialog examples that show what the calculation is to set up the font to standard sizes like 8, 10, 12, etc.

With richedit, I think I used division/multiplication to get the correct numbers. But it was in TWIPS.

It appears editbox.font.fontheight is bigger (14 is about size 12 font, so maybe it actually includes whitespace?).

I"m guessing I just have to calculate the whitespace and subtract it.

This is a lot of work just to chang the font size, I think a wrapper should be built at least once I figure it out ;-)


 
L505   (2005-08-18 01:51) [5]

I forgot that font height is in "POINTS" and height is in "PIXELS". Twips of course, are another story..

I think this below is one way it can be done?
So far I"m using this to calculate font height:

 pixelsperinch:= GetDeviceCaps (getdc(0), LOGPIXELSX);
 //calculate, for example the hieght of "point" size 10
 MyHeight := -10 * PixelsPerInch / 72;
 showmessage(int2str(round(MyHeight)));

GetDeviceCaps is the same as "pixelsperinch". GetDC(0) gets the pixels per inch of the screen.

To get desired size, just reverse the equation of course.

Would there be any reason not for KOL/MCK to include a font size calculation wrapper, as a published property? I think it would add compatibility.

I realize font.height is more precise.. but compatibility would be nice.


 
L505   (2005-08-18 01:52) [6]

sorry, that should read "font SIZE" is in POINTS.


 
McSimm ©   (2006-04-06 15:48) [7]

untrash



Страницы: 1 вся ветка

Форум: "KOL";
Текущий архив: 2007.01.21;
Скачать: [xml.tar.bz2];

Наверх




Память: 0.45 MB
Время: 0.039 c
2-1167341279
Vladimir1984
2006-12-29 00:27
2007.01.21
Как присвоить цвету текст(цифровое значение)...


4-1157308645
иван8511
2006-09-03 22:37
2007.01.21
Печать на матричном принтере.


2-1167426717
Adios
2006-12-30 00:11
2007.01.21
Не компилируются проекты!!!


2-1167831746
saili
2007-01-03 16:42
2007.01.21
синхронизация таймера с частотой обновления экрана монитора


15-1167410718
Gero
2006-12-29 19:45
2007.01.21
Песни в хорошем качестве





Afrikaans Albanian Arabic Armenian Azerbaijani Basque Belarusian Bulgarian Catalan Chinese (Simplified) Chinese (Traditional) Croatian Czech Danish Dutch English Estonian Filipino Finnish French
Galician Georgian German Greek Haitian Creole Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian
Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Thai Turkish Ukrainian Urdu Vietnamese Welsh Yiddish Bengali Bosnian
Cebuano Esperanto Gujarati Hausa Hmong Igbo Javanese Kannada Khmer Lao Latin Maori Marathi Mongolian Nepali Punjabi Somali Tamil Telugu Yoruba
Zulu
Английский Французский Немецкий Итальянский Португальский Русский Испанский