This is a migrated thread and some comments may be shown as answers.

TextBox's line wrap position is incorrect in docker

3 Answers 200 Views
Report Designer (standalone)
This is a migrated thread and some comments may be shown as answers.
Anders
Top achievements
Rank 1
Anders asked on 27 Jul 2020, 09:03 AM

When there are both ascii characters and non-ascii characters (such as Chinese) in the text box, the position of line wrapping in Docker is incorrect.And some data lost.

The code: 

<?xml version="1.0" encoding="utf-8"?>
<Report Width="17cm" Name="Report2" xmlns="http://schemas.telerik.com/reporting/2020/2.0">
  <Items>
    <PageHeaderSection Height="2cm" Name="pageHeaderSection1" />
    <DetailSection Height="5cm" Name="detailSection1">
      <Items>
        <TextBox Width="2.9cm" Height="1.3cm" Left="0cm" Top="0cm" Value="textbox1113333333测试测试测试123456789" Name="textBox1" />
      </Items>
    </DetailSection>
    <PageFooterSection Height="2cm" Name="pageFooterSection1" />
  </Items>
  <PageSettings PaperKind="A4" Landscape="False">
    <Margins>
      <MarginsU Left="2cm" Right="2cm" Top="2cm" Bottom="2cm" />
    </Margins>
  </PageSettings>
  <StyleSheet>
    <StyleRule>
      <Style>
        <Padding Left="2pt" Right="2pt" />
      </Style>
      <Selectors>
        <TypeSelector Type="TextItemBase" />
        <TypeSelector Type="HtmlTextBox" />
      </Selectors>
    </StyleRule>
  </StyleSheet>
</Report>

3 Answers, 1 is accepted

Sort by
0
Todor
Telerik team
answered on 30 Jul 2020, 09:34 AM

Hi Anders,

Do you use a Linux docker container? If so, the observed behavior may be explained with the different libraries we use for rendering the reports under Windows and Linux. For Windows, we use GDI+, whereas under Linux we utilize libgdiplus. They slightly differ in measuring the text, which may result in different wrapping and other discrepancies.

Regards,
Todor
Progress Telerik

0
Anders
Top achievements
Rank 1
answered on 03 Aug 2020, 07:10 AM

The docker image is a Linux image, and running in k8s, and some data disappeared, that is unacceptable.
My docker file.

FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 as base
RUN sed -i -r "s@http://(deb|security).debian.org@http://mirrors.aliyun.com@g" /etc/apt/sources.list \
    && apt-get update \
    && apt-get install -y \
        libc6-dev \
        libgdiplus \
        libx11-dev \
        fontconfig \
        ttf-wqy-zenhei \
    && rm -rf /var/lib/apt/lists/* \
    && fc-cache -f -v
 
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS builder
WORKDIR /app
# caches restore result by copying csproj file separately
RUN dotnet restore
COPY . .
RUN dotnet publish --output /output/ --configuration Release
RUN sed -n 's:.*<AssemblyName>\(.*\)</AssemblyName>.*:\1:p' *.csproj > __assemblyname
RUN if [ ! -s __assemblyname ]; then filename=$(ls *.csproj); echo ${filename%.*} > __assemblyname; fi
 
# Stage 2
FROM base AS final
WORKDIR /app
COPY --from=builder /output/ /app/
COPY --from=builder /app/__assemblyname /app/
ENV TZ="Asia/Shanghai"
ENTRYPOINT dotnet $(cat /app/__assemblyname).dll
0
Todor
Telerik team
answered on 06 Aug 2020, 08:18 AM

Hello Anders,

Indeed, it is strange that some of the characters disappear under Linux. We haven't observed such a problem until now and will investigate it. For that reason, I have logged a public bug on your behalf - Some of the text disappears from a TextBox when the Report is rendered under Linux and contains both ASCII and non-ASCII characters.

Unfortunately, I'm unable to provide a workaround for this scenario, because, we're using a 3rd party library as Graphics replacement and we do not maintain its code. In the libgdiplus Github repo, there are a few bugs related to incorrect string measurement and I hope this issue will also be fixed in a future release of the package. I would still suggest to try updating it to some of the latest releases and see if the measurement problem will be resolved.

You may test with another font with characters from the Chinese Unicode Range. Here is a list of fonts that cover all or most of the Chinese characters - you can try some of them and see if the issue will be resolved.

Regards,
Todor
Progress Telerik

Tags
Report Designer (standalone)
Asked by
Anders
Top achievements
Rank 1
Answers by
Todor
Telerik team
Anders
Top achievements
Rank 1
Share this question
or