Forum > LCL

[SOLVED] What is the meaning of TFont.CharSet? How to use it?

(1/3) > >>

Hartmut:
I'm a beginner to Fonts and type 'TFont' and I want to know, what is the meaning of TFont.CharSet? The Help only says: "The Character Set to be used by the current Font". But what is a "Character Set" as a part of a font? You can assign a value from 0..255 there.

Question1: what happens / should happen, if I assign an arbitrary value to TFont.CharSet (I tested some values and saw no difference)?

Question2: are all 256 values always allowed? Where from do I know, which numbers are "allowed"  for a specific font?

Some explanations are very welcome. Thanks in advance.

Josh:
have you looked at the examples in lazarus
lazarus\examples\fontenum
the mainunit.pas around line 200 where it poulates, may give you some idea


--- Code: ---Add(ANSI_CHARSET);
  Add(DEFAULT_CHARSET);
  Add(SYMBOL_CHARSET);
  Add(MAC_CHARSET);
  Add(SHIFTJIS_CHARSET);
  Add(HANGEUL_CHARSET);
  Add(JOHAB_CHARSET);
  Add(GB2312_CHARSET);
  Add(CHINESEBIG5_CHARSET);
  Add(GREEK_CHARSET);
  Add(TURKISH_CHARSET);
  Add(VIETNAMESE_CHARSET);
  Add(HEBREW_CHARSET);
  Add(ARABIC_CHARSET);
  Add(BALTIC_CHARSET);
  Add(RUSSIAN_CHARSET);
  Add(THAI_CHARSET);
  Add(EASTEUROPE_CHARSET);
  Add(OEM_CHARSET);
  Add(FCS_ISO_10646_1);
  Add(FCS_ISO_8859_1);
  Add(FCS_ISO_8859_2);
  Add(FCS_ISO_8859_3);
  Add(FCS_ISO_8859_4);
  Add(FCS_ISO_8859_5);
  Add(FCS_ISO_8859_6);
  Add(FCS_ISO_8859_7);
  Add(FCS_ISO_8859_8);
  Add(FCS_ISO_8859_9);
  Add(FCS_ISO_8859_10);
  Add(FCS_ISO_8859_15);
--- End code ---

there are no doubt others,

Hartmut:
Thanks Josh for your reply. I had already seen this list in lazarus example "fontenum". I played with this example, where you have a ComboBox and a ListBox with CharSets, but I see no difference, when I select something like "CHINESEBIG5_CHARSET" or "HEBREW_CHARSET" instead of "DEFAULT_CHARSET" or "ANSI_CHARSET" and press the "apply filter" Button, the displayed Sample Text does not change!

So my questions are still open:
 - What happens / should happen, if I assign an arbitrary value to TFont.CharSet (I tested some values and saw no difference)?
 - Are all 256 values always allowed? Where from do I know, which numbers do work (make a difference) for a specific font?
 - What is the "philosophy" behind TFont.CharSet?

kwyan:
A font file may support multiple character sets and hence determines which languages are supported. You may use font tools to view which character sets are supported.

Hartmut:
Thank you kwyan for your post.


--- Quote from: kwyan on November 29, 2023, 05:00:25 pm ---A font file may support multiple character sets and hence determines which languages are supported.

--- End quote ---

Does this mean: each font file contains the ASCII-Codes $20..$7F and optional may contain the UTF8-chars for 1 or more specific languages (e.g. Japanese or Arabic) and this additional languages are called charsets?

Is it possible with FPC/Lazarus/LCL to list those "additional charsets" of a certain font, when only the name of the font is given? How?


--- Quote ---You may use font tools to view which character sets are supported.

--- End quote ---

Is "font tools" the name of a certain program? I used google to find it but failed...

Can you/someone recommend a certain program, which can list those "additional charsets" of a certain font?

Sorry for so many questions... Thanks for any help.

Navigation

[0] Message Index

[#] Next page

Go to full version