Recent

Author Topic: linux uses fastreport to export Chinese PDF reports  (Read 1824 times)

jianwt

  • Jr. Member
  • **
  • Posts: 97
linux uses fastreport to export Chinese PDF reports
« on: May 11, 2024, 06:40:19 am »
在lazarus3.2(linux  deepin64)GTK2程序时,使用fastreport导出中文PDF报表时,报错提示为“Cant swap font"。
我已经将所用到的字体手动放在系统目录下了,但还是报错,有在linux系统导出中文PDF报表成功的群友,帮忙看看是什么问题导出报错??
英文不好,在线翻译的。
最后谢谢你们的帮助!

Symptom When I use fastreport to export Chinese PDF reports in lazarus3.2 (linux deepin64) GTK2 program, an error message "Cant swap font" is displayed.
I have manually placed the fonts used in the system directory , but there are still errors. Some friends have successfully exported Chinese PDF reports in linux system, help to see what is the problem?
English is not good, online translation.
Thank you for your help!
« Last Edit: May 13, 2024, 08:16:49 am by jianwt »

Handoko

  • Hero Member
  • *****
  • Posts: 5290
  • My goal: build my own game engine using Lazarus
Re: linux uses fastreport to export Chinese PDF reports
« Reply #1 on: May 11, 2024, 06:48:23 am »
Have you tried to install Chinese fonts provided by your Linux distributions? For example below is the screenshot running Synaptic Package Manager on my Ubuntu Mate.

Simply copy/pasting the fonts may not work correctly. You may need to run:
sudo fc-cache -fv
« Last Edit: May 11, 2024, 06:56:25 am by Handoko »

Thaddy

  • Hero Member
  • *****
  • Posts: 15526
  • Censorship about opinions does not belong here.
Re: linux uses fastreport to export Chinese PDF reports
« Reply #2 on: May 11, 2024, 07:16:20 am »
@Handoko
Selamat pagi, (UTF+1),

I wonder if FastReport can use x-fonts but it can handle open type font and ttf fonts.

if you have windows simply copy over the chinese ttf fonts from the \windows\fonts directory. Example are Microsoft JhengHei or the open source SimSun and family,
These fonts are known by me to work well in report engines.
Linux can handle Opentype and TrueType fonts.
- X-fonts are - legacy - bitmap fonts.
- OTF and TTF are usually vector fonts, although they can also handle bitmap fonts, but in the correct format. Most modern TTF fonts have internal OTF line out.
An example of this is JhengHei and FastReport supports it.
There are literally 1000ths of fonts which come with permissive licensing, like Creative Commons or M.I.T.
FastReport does not support X-fonts is my guess.
« Last Edit: May 11, 2024, 08:16:49 am by Thaddy »
My great hero has found the key to the highway. Rest in peace John Mayall.
Playing: "Broken Wings" in your honour. As well as taking out some mouth organs.

jianwt

  • Jr. Member
  • **
  • Posts: 97
Re: linux uses fastreport to export Chinese PDF reports
« Reply #3 on: May 11, 2024, 08:24:37 am »
@Handoko
I really copy and paste the Chinese font, I will use the computer to test the method you said tonight, thank you for your help!
Have you ever successfully exported Chinese PDF documents with FR in linux?

Handoko

  • Hero Member
  • *****
  • Posts: 5290
  • My goal: build my own game engine using Lazarus
Re: linux uses fastreport to export Chinese PDF reports
« Reply #4 on: May 11, 2024, 01:58:23 pm »
@Handoko
Selamat pagi, (UTF+1),

 :) Selamat pagi juga!
Good morning too.

Have you ever successfully exported Chinese PDF documents with FR in linux?

I can speak Chinese but I can't read nor write Chinese text. So I have no Chinese fonts in my computer.

You may also try Noto fonts. As far as I know most Ubuntu and its variants have Noto (no tofu) fonts installed by default. Perhaps your Linux has Noto fonts too.
« Last Edit: May 11, 2024, 02:11:38 pm by Handoko »

Thaddy

  • Hero Member
  • *****
  • Posts: 15526
  • Censorship about opinions does not belong here.
Re: linux uses fastreport to export Chinese PDF reports
« Reply #5 on: May 11, 2024, 03:58:12 pm »
I have Notomono-regular.ttf on my Debian boxes, indeed.
Note Linux also has two other font types that you can likely not use with FastReport,
T1 fonts and ps fonts (postscript). Comes from FastReport's Windows heritage.
« Last Edit: May 11, 2024, 04:01:08 pm by Thaddy »
My great hero has found the key to the highway. Rest in peace John Mayall.
Playing: "Broken Wings" in your honour. As well as taking out some mouth organs.

jianwt

  • Jr. Member
  • **
  • Posts: 97
Re: linux uses fastreport to export Chinese PDF reports
« Reply #6 on: May 13, 2024, 03:16:22 am »
After several tests, the export PDF error or because it is the Chinese font, the English font export will not report the error, which master can point to how to solve this problem. thank you

Handoko

  • Hero Member
  • *****
  • Posts: 5290
  • My goal: build my own game engine using Lazarus
Re: linux uses fastreport to export Chinese PDF reports
« Reply #7 on: May 13, 2024, 06:32:51 am »
Please provide a simplified demo code that can show the issue, so we can download, run and inspect the problem.

jianwt

  • Jr. Member
  • **
  • Posts: 97
Re: linux uses fastreport to export Chinese PDF reports
« Reply #8 on: May 13, 2024, 07:23:47 am »
@Handoko

In the window system, you can export PDF in both Chinese and English. In the linux system can export English, export Chinese will report an error!

ttf folder is Chinese font。
The Chinese font used cannot be uploaded due to the size limitation of the forum attachment

宋体  You can download the Chinese font file here   http://www.downcc.com/font/353318.html
« Last Edit: May 13, 2024, 07:35:26 am by jianwt »

PierceNg

  • Sr. Member
  • ****
  • Posts: 380
    • SamadhiWeb
Re: linux uses fastreport to export Chinese PDF reports
« Reply #9 on: May 13, 2024, 08:05:02 am »
Which version of Fast Report and where to download the source?

jianwt

  • Jr. Member
  • **
  • Posts: 97

paweld

  • Hero Member
  • *****
  • Posts: 1187
Re: linux uses fastreport to export Chinese PDF reports
« Reply #11 on: May 13, 2024, 10:55:31 am »
actually under linux there is a problem with Chinese font. In my case, although it does not report errors but after export in a pdf file instead of Chinese characters there are rectangles.
Have you tried contacting FastReport support? They usually solve problems in a fairly short time.
Best regards / Pozdrawiam
paweld

 

TinyPortal © 2005-2018