[PB 6.10 beta 2] PdfVectorOutput() and CJK characters
Posted: Sun Jan 14, 2024 1:20 pm
In the code below, Chinese, Japanese, and Korean characters are not displayed correctly. (Viewed in MS Edge browser and SumatraPDF.)
They all appear as squares, as if they don't have fonts.
Using certain fonts causes a "Division by zero" error on Windows 10 Korean.
However, on English Windows, it shows the same result as the above code without any errors.
Some fonts generate a very small empty file(705 bytes) with no errors. This issue also does not occur on English Windows.
(There is some binary content in the PDF file, but when the document is opened in Edge browser or something, no characters display.)
They all appear as squares, as if they don't have fonts.
Code: Select all
LoadFont(0, "Arial", 20)
If StartVectorDrawing(PdfVectorOutput("z:\test.pdf", 595, 842))
VectorFont(FontID(0), 25)
MovePathCursor(20, 20)
DrawVectorText("한글, ひらがな, カタカナ, 简体中文")
StopVectorDrawing()
EndIf
Using certain fonts causes a "Division by zero" error on Windows 10 Korean.
However, on English Windows, it shows the same result as the above code without any errors.
Code: Select all
;"Division by zero" error in all of the fonts below.
Debug LoadFont(0, "MS Sans Serif", 20)
;Debug LoadFont(0, "맑은고딕", 20)
;Debug LoadFont(0, "굴림", 20)
If StartVectorDrawing(PdfVectorOutput("z:\test.pdf", 595, 842))
;Debug FontID(0)
VectorFont(FontID(0), 25)
MovePathCursor(20, 20)
DrawVectorText("한글, ひらがな, カタカナ, 简体中文") ; Division by zero.
StopVectorDrawing()
EndIf
(There is some binary content in the PDF file, but when the document is opened in Edge browser or something, no characters display.)
Code: Select all
Debug LoadFont(0, "굴림체", 20)
;Debug LoadFont(0, "돋움체", 20)
If StartVectorDrawing(PdfVectorOutput("z:\test.pdf", 595, 842))
;Debug FontID(0)
VectorFont(FontID(0), 25)
MovePathCursor(20, 20)
DrawVectorText("한글, ひらがな, カタカナ, 简体中文")
StopVectorDrawing()
EndIf
%PDF-1.3
%����
1 0 obj
<<
/Type /Catalog
/Pages 2 0 R
>>
endobj
2 0 obj
<<
/Type /Pages
/Kids [ 4 0 R ]
/Count 1
>>
endobj
3 0 obj
<<
/Producer (Haru Free PDF Library 2.4.4)
>>
endobj
4 0 obj
<<
/Type /Page
/MediaBox [ 0 0 595 842 ]
/Contents 5 0 R
/Resources <<
/ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ]
>>
/Parent 2 0 R
>>
endobj
5 0 obj
<<
/Length 6 0 R
/Filter [ /FlateDecode ]
>>
stream
x�3T0 B]C aab����U���e�6P��2rL�LL--�BR�\C�� V��
endstream
endobj
6 0 obj
55
endobj
xref
0 7
0000000000 65535 f
0000000015 00000 n
0000000064 00000 n
0000000123 00000 n
0000000184 00000 n
0000000338 00000 n
0000000472 00000 n
trailer
<<
/Root 1 0 R
/Info 3 0 R
/Size 7
>>
startxref
490
%%EOF