Pending Review
Last Updated: 03 May 2019 14:31 by ADMIN
Anders
Created on: 27 Apr 2019 13:13
Type: Bug Report
0
Chinese font simsun isn't usable in docker

In my report, I use font SimSun to display Chinese, when preview it's OK, but after click print, an exception is thrown.

Internal Server Error
Font data for font "SimSun" cannot be obtained. Possible reasons are: The font is not installed in . The font is not found in the directories specified by the "FontLocations" configuration entries. The font is not declared in "" configuration section

In my docker image, run command -list, is there.


C:\Users\Anders> docker exec -it 3485 bash
root@3485bbdabbb3:/app# fc-list
/usr/share/fonts/truetype/dejavu/DejaVuSerif-Bold.ttf: DejaVu Serif:style=Bold
/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf: DejaVu Sans Mono:style=Book
/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf: DejaVu Sans:style=Book
/usr/share/fonts/simsun.ttf: SimSun,宋体:style=Regular
/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf: DejaVu Sans:style=Bold
/usr/share/fonts/truetype/dejavu/DejaVuSansMono-Bold.ttf: DejaVu Sans Mono:style=Bold
/usr/share/fonts/truetype/dejavu/DejaVuSerif.ttf: DejaVu Serif:style=Book
My report is very simple, just a textbox contains several Chinese Fonts.
My  is below.
FROM /2.2- AS builder
WORKDIR /app

# caches restore result by copying  file separately
COPY * config/
RUN  restore

COPY .
RUN  publish --output /app/ --configuration Release
RUN  -n 's:.*<AssemblyName>\(.*\)</AssemblyName>.*:\1:p' * > __assemblyname
RUN if [ - __assemblyname; then filename=$ *); echo $filename%*} > __assemblyname; 

# Stage 2
FROM /2.2--runtime

ENV PORT 80
EXPOSE 80

COPY simsun.ttf /usr/share/fonts/simsun.ttf

RUN apt-get update \ 
    && apt-get install -y \ 
        libc6-dev \ 
         \ 
        libx11-dev \ 
		 \
    && rm -rf /var/lib/apt/lists/*

RUN fc-cache -f -v

WORKDIR /app
COPY --from=builder /app

ENTRYPOINT  $cat /app/__assemblyname)
Attached Files:
1 comment
ADMIN
Ivan Hristov
Posted on: 03 May 2019 14:31
Hello Anders,

When printing a report in HTML5 report viewer, the report gets exported to PDF and then sent to the browser. In this case the PDF export fails, and I believe the reason is because the font resolver cannot locate the SimSun font. The font resolver by default searches in /usr/share/fonts/truetype/ and /usr/local/share/fonts directories of the current machine. I noticed that the simsun.ttf is placed in the /usr/share/fonts folder, which means it won't be included in the font library.

There are two ways to resolve the problem:
1) Copy the simsun.ttf in the /truetype subfolder.
2) Configure the fontLibrary element of the configuration file to include the /usr/share/fonts/ folder in the directories, searched by the font resolver. This approach is not recommended if the folder contains thousands of font files, because the font library processor will read the font information from each file and might result in a poor performance.

Hope this helps.

Regards,
Ivan Hristov
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items