View Issue Details

IDProjectCategoryView StatusLast Update
0030970CommunityOCCT:Visualizationpublic2020-10-07 11:01
ReporterVico Liang Assigned ToVico Liang  
PrioritynormalSeverityminor 
Status closedResolutionnot fixable 
Summary0030970: Visualization - Font Name don't support Unicode (such as Chinese)
Descriptionvoid Font_FontMgr::GetAvailableFontsNames(TColStd_SequenceOfHAsciiString& theFontsNames) const;
The font names from above method is not readable for Unicode font name such as Chinese.
TagsNo tags attached.
Test case number

Attached Files

  • 印章繁体方篆.ttf (2,504,748 bytes)

Relationships

child of 0023457 closedkgv Slow text rendering 

Activities

kgv

2019-09-17 10:51

developer   ~0087189

Please provide some steps to reproduce / test data / output.

pload VISUALIZATION
#vfont -add pathToSomeFont.ttf
vfont

Vico Liang

2019-09-17 12:57

developer  

印章繁体方篆.ttf (2,504,748 bytes)

Vico Liang

2019-09-17 12:58

developer   ~0087197

uploaded a font file 印章繁体方篆.ttf

kgv

2019-09-17 15:20

developer   ~0087203

Last edited: 2019-09-17 15:24

This is not an OCCT bug, but FreeType limitation.

FreeType documentation states, that it relies solely on fopen() for being portable, without any wfopen() alternatives on Windows in any way (via dedicated API or via fallback for UTF-8 names).

For instance, FreeImage duplicates all file-related APIs with wchar_t variants for handling WinAPI UNICODE issue (FreeImage_GetFileTypeU+FreeImage_GetFileType, FreeImage_LoadU+FreeImage_Load, etc.),
FFmpeg follows "utf-8 everywhere" conception, similar to OCCT, so that it expects file names given in UTF-8 and calls wfopen() implicitly on Windows.

FreeType is currently different.

Alternatives:
- Rename font file.
  Obviously, can be done only if font comes with application.
- Using short DOS names as fallback.
  Side effect: this obsolete file system feature can be disabled on modern Windows systems.
- Pre-loading entire file in memory and using FT_New_Memory_Face() instead of FT_New_Face().
  Side effect: entire file has to be loaded into memory.
- Using FT_Open_Face() instead of FT_New_Face() with custom stream wrapper.
  Side effect: extra dirty mess-up and complication of OCCT code base.

I would say, pushing FreeType project in more Windows-friendly direction would be perfect solution rather than messing up in OCCT, as long, as this is not a blocking issue.
FreeType patch, which would handle UTF-8 filenames on Windows, has chances to be integrated - at least it should not contradict to project's philosophy.

Vico Liang

2019-09-17 17:22

developer   ~0087210

Last edited: 2019-09-17 17:26

It's not the font file name problem, it works well to load the font file with method CheckFont:
Handle(Font_SystemFont) Font_FontMgr::CheckFont (const Standard_CString theFontPath) const.

The problem is that the name of the font returned from CheckFont is not readable with character "??????".

The test system is android.
the file path is utf8 character.

kgv

2019-09-17 17:43

developer   ~0087211

> The problem is that the name of the font returned from CheckFont
> is not readable with character "??????".
This is another problem, but still relevant to FreeType library - the name is returned from FT_Face::family_name.

Issue History

Date Modified Username Field Change
2019-09-17 09:50 Vico Liang New Issue
2019-09-17 09:50 Vico Liang Assigned To => msv
2019-09-17 10:12 Vico Liang Assigned To msv => kgv
2019-09-17 10:12 Vico Liang Category OCCT:Modeling Data => OCCT:Visualization
2019-09-17 10:51 kgv Note Added: 0087189
2019-09-17 10:51 kgv Assigned To kgv => Vico Liang
2019-09-17 10:51 kgv Status new => feedback
2019-09-17 12:57 Vico Liang File Added: 印章繁体方篆.ttf
2019-09-17 12:58 Vico Liang Note Added: 0087197
2019-09-17 12:58 Vico Liang Assigned To Vico Liang => kgv
2019-09-17 12:59 Vico Liang Status feedback => assigned
2019-09-17 15:20 kgv Note Added: 0087203
2019-09-17 15:20 kgv Target Version 7.4.0 => Unscheduled
2019-09-17 15:21 kgv Summary Font Name don't support Unicode (such as Chinese) => Visualization - Font Name don't support Unicode (such as Chinese)
2019-09-17 15:21 kgv Note Edited: 0087203
2019-09-17 15:22 kgv Note Edited: 0087203
2019-09-17 15:23 kgv Note Edited: 0087203
2019-09-17 15:24 kgv Note Edited: 0087203
2019-09-17 15:25 kgv Relationship added child of 0023457
2019-09-17 17:22 Vico Liang Note Added: 0087210
2019-09-17 17:26 Vico Liang Note Edited: 0087210
2019-09-17 17:43 kgv Note Added: 0087211
2019-09-18 10:21 kgv Assigned To kgv => Vico Liang
2019-09-18 10:21 kgv Status assigned => feedback
2019-09-18 10:21 kgv Resolution open => not fixable
2020-10-07 11:01 abv Status feedback => closed
2020-10-07 11:01 abv Target Version Unscheduled =>