Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » Draw, Display, Images, Bitmaps, Icons » Is there a way to get all character supported in a font with Font? (how to get all character supported by a font using Font?)
icon3.gif  Is there a way to get all character supported in a font with Font? [message #58308] Fri, 15 April 2022 21:54 Go to next message
Mountacir is currently offline  Mountacir
Messages: 45
Registered: November 2021
Member
Hi,

I've been trying to get all code points in a font so i can preview them, but i couldn't do it with the Font Class.
I tried something like this but no luck.

char c;
String s;
for(int i = 1; i<1000;i++){
	if(fnt.HasChar(i)){
		
		c = i;
		s << c;
		
	}else {
		break;
	}
	
}
LOG(s);


In freetype.h this solutions was given

FT_ULong  charcode;                                              
FT_UInt   gindex;                                                

charcode = FT_Get_First_Char( face, &gindex );                   
while ( gindex != 0 )                                            
{                                                                
  //... do something with (charcode,gindex) pair ...               

  charcode = FT_Get_Next_Char( face, charcode, &gindex );        
}                                                                


Is it possible to add FT_Get_Next_Char and FT_Get_First_Char to Font class?

Thank you.
Re: Is there a way to get all character supported in a font with Font? [message #58316 is a reply to message #58308] Wed, 20 April 2022 01:04 Go to previous messageGo to next message
Mountacir is currently offline  Mountacir
Messages: 45
Registered: November 2021
Member
Hi,

I found a solution in Ultimatepp's github (uppbox), and i made a simple Char Map with it (Package attached). (I hade to upgrade from 16098 to latest)
Fonts like ms serif (raster typeface) don't work.

https://i.imgur.com/8LpM7sV.png
  • Attachment: CharMap.zip
    (Size: 4.02KB, Downloaded 78 times)

[Updated on: Wed, 20 April 2022 01:09]

Report message to a moderator

Re: Is there a way to get all character supported in a font with Font? [message #58317 is a reply to message #58308] Wed, 20 April 2022 01:15 Go to previous messageGo to next message
Mountacir is currently offline  Mountacir
Messages: 45
Registered: November 2021
Member
Added this

	if(char_list.GetCount()<=0){
		return;
	}
  • Attachment: CharMap2.zip
    (Size: 4.03KB, Downloaded 75 times)
Re: Is there a way to get all character supported in a font with Font? [message #58319 is a reply to message #58317] Wed, 20 April 2022 16:49 Go to previous messageGo to next message
deep is currently offline  deep
Messages: 263
Registered: July 2011
Location: Bangalore
Experienced Member
index.php?t=getfile&id=6588&private=0I was checking your CharMap code.

In Indian Unicode scripts there is Extended char set. Which Unicode values are beyond 0xFFFF.

I am enclosing one font from Noto ttf. This has Glyphs from many langs.

Extended chars from 0x10000 to 0x10663

Can you give some hints on how to display Extended chars.


Warm Regards

Deepak
Re: Is there a way to get all character supported in a font with Font? [message #58322 is a reply to message #58308] Thu, 21 April 2022 00:13 Go to previous messageGo to next message
Mountacir is currently offline  Mountacir
Messages: 45
Registered: November 2021
Member
Hi deep,

The solution I used in my code "TypeReader.cpp/h" is from Uppbox (Emoji example), I shamelessly copied it as it is and still learning how it works.

As for the font you attached, I tried it with multiple CharMap viewers on Windows and online, it doesn't seem to go beyond 0xFFFF. But using Photoshop's Glyphs viewer i noticed that it shows Glyphs beyond 0xFFFF, but they don't have a Unicode or a name just a GID (GlyphID?) number. So I think a solution to preview non-Unicode glyphs is needed.
I also tried to loop over 0x10000 to 0x10663, but all characters got replaced.

In the other hand "NotoSansEgyptianHieroglyphs-Regular.ttf" does go beyond 0xFFFF:

index.php?t=getfile&id=6590&private=0
  • Attachment: egy.png
    (Size: 13.88KB, Downloaded 240 times)

[Updated on: Thu, 21 April 2022 00:14]

Report message to a moderator

Re: Is there a way to get all character supported in a font with Font? [message #58411 is a reply to message #58308] Wed, 18 May 2022 10:44 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
[quote title=Mountacir wrote on Fri, 15 April 2022 21:54]Hi,

I've been trying to get all code points in a font so i can preview them, but i couldn't do it with the Font Class.
I tried something like this but no luck.

char c;
String s;
for(int i = 1; i<1000;i++){
	if(fnt.HasChar(i)){
		
		c = i;
		s << c;
		
	}else {
		break;
	}
	
}
LOG(s);


Have you tried to remove break? Smile

Other than that, I think what you really need is IsNormal - that means that unicode codepoint is really in given font. HasChar will return true even if codepoint is rendered using multiple glyphs from the font or even being replaced by some glyph from some other font.
Previous Topic: It can't dispay chinese characters properly
Next Topic: Clickable SetImage in Button
Goto Forum:
  


Current Time: Fri Mar 29 09:46:35 CET 2024

Total time taken to generate the page: 0.01779 seconds