dxf-viewer-example-src
                                
                                 dxf-viewer-example-src copied to clipboard
                                
                                    dxf-viewer-example-src copied to clipboard
                            
                            
                            
                        How to add fonts
How to add fonts
Hello, Do you know which language is it? Actually you need a font file (ttf) which contains glyphs for that language.
Seems it is from CJK Unified Ideographs unicode block. Font with these glyphs should be added here: https://github.com/vagran/dxf-viewer-example-src/blob/0b16e6fa5365b4896e0c03e26ed428fa27b4b91c/src/components/ViewerPage.vue#L19 https://github.com/vagran/dxf-viewer-example-src/blob/0b16e6fa5365b4896e0c03e26ed428fa27b4b91c/src/components/ViewerPage.vue#L68 I will add one in this example if I find one with permissive license.
After a bit more of investigation I have these points:
- I made one bug fix in font processing code. It might affect text rendering correctness for Unicode code points above BMP (not sure if any characters from this example are affected).
- I added HanMin font to this example, it should cover all CJK glyphs.
- I figured out that DXF file may have encoding other than UTF-8. Most of files created by a new software should have UTF-8 encoding, Versions of R2004 and prior may have ANSI encoding specified in $DWGCODEPAGE parameter. Unfortunately, such files currently are not supported (I added corresponding note in the readme). Your file does have such encoding (ANSI_936). However it can be trivially converted to UTF-8 in any text editor. Here is your file converted: ditu-utf-8.dxf.zip It seems to be displayed correctly on the updated demo page.
OK, thanks. I've solved the font problem. Now I want to ask that it doesn't support mobile mode. It can't be scaled when accessing in mobile mode
I will keep this issue open, until some kind of input file encoding handling is implemented. Proper processing of such files is not trivial with current parser implementation, but at least some warning message can be introduced.
I will look later at the problem with mobile browsers support.