fisharebest / webtrees

Online genealogy
https://webtrees.net
GNU General Public License v3.0
487 stars 301 forks source link

DejuVu font does not contain Chinese or Thai characters - affects Fan Chart and PDF reports #1479

Open melizaa opened 7 years ago

melizaa commented 7 years ago

I see Thai name for instance in Wife Duangruthai Janmo ‘Jo’ ดวงฤทย จนทรโม ‘โจ’ in pdf reports as boxes in pdf reports. 2017-11-16_13-29-46

fisharebest commented 6 years ago

PDF reports use the DejaVu sans font, which does not currently contain Thai letters.

See the section on coverage in https://en.wikipedia.org/wiki/DejaVu_fonts

fisharebest commented 6 years ago

Noto sans offers wider coverage - but not in a single .ttf file.

We could attempt to merge various noto files, but there are limits such as the maximum number of glyphs in a file, and different line-heights, etc. for different scripts. More info at https://github.com/googlei18n/noto-fonts/issues/13

fisharebest commented 6 years ago

Also, noto was designed for screen use (i.e. android phones), rather than print and PDF is aimed at print media.

vytux-com commented 6 years ago

In the above linked issue they mention that Ariel unicode MS has all charts in 1 font file. Why not use that?

fisharebest commented 6 years ago

Arial is a proprietory font, owned by Microsoft.

We are not allowed to include it in an open-source project. See https://en.wikipedia.org/wiki/Arial#Distribution

ghost commented 3 years ago

You might try this one: https://github.com/klokantech/klokantech-gl-fonts

You might also read this: http://unifont.org/fontguide/ https://www.freedesktop.org/wiki/Software/fontconfig/

ghost commented 3 years ago

@fisharebest How are the pdf's created? Can this be changed to use multiple fonts with e.g. fontconfig? Especially as the dejavu-project seems to be not taken care of anymore.

melizaa commented 3 years ago

Not only Chinese and Thai languages print undefined characters or undefined offsets in PDF and HTML reports. I look now at a Family report in different webtrees languages.

iyoua commented 2 years ago

@melizaa The Chinese characters in the PDF report are not displayed. Have you solved this problem? I uploaded several font files and modified the file name, but still failed.

iyoua commented 2 years ago

I downloaded a font and copied it to tcpdf\fonts folder. After modifying the report code, the body of the report is displayed in Chinese, but the report header is always not displayed. I can't find the reason. Even if I change the style to the style of the body, it won't work. Why? `

<!-- Header -->
<Style name="header" font="$fonts" size="16" style="b" />
<!-- Page numbers text -->
<Style name="pagenum" font="$fonts" size="8"/>
<!-- Standard text -->
<Style name="text" font="$fonts" size="9"/>
<!-- Column labels -->
<Style name="label" font="$fonts" size="10" style="b"/>
<!-- Generated by style - required style name by the generator -->
<Style name="genby" font="$fonts" size="8" />
<!-- Date text -->
<Style name="date" font="$fonts" size="8"/>
<Style name="header2" font="$fonts" size="12" style="b" />

<if condition="$pageorient=='landscape'">
    <!-- landscape orientation -->
    <SetVar name="namewidth" value="270"/>
    <SetVar name="datewidth" value="300"/>
</if>

<if condition="$pageorient=='portrait'">
    <!-- portrait orientation -->
    <SetVar name="namewidth" value="210"/>
    <SetVar name="datewidth" value="190"/>
</if>

<Doc pageSize="$pageSize" orientation="$pageorient" >
    <Header>
        <Cell align="center" height="20" newline="1" style="text"><var var="I18N::translate('Changes')" /></Cell>
        <Cell align="rightrtl" newline="1" style="pagenum"><var var="I18N::translate('Page')" /> <PageNum /> <var var="I18N::translate('of')" /> <TotalPages /></Cell>
    </Header>

    <Body>

        <!-- Pending changes section Header -->
        <if condition="$pending=='yes'">
            <Cell align="center" height="20" newline="1" style="header2"><var var="I18N::translate('Pending changes')" /></Cell>
            <SetVar name="fill" value="" />
            <if condition="$sortby=='NAME'"><SetVar name="fill" value="#AAAAAA" /></if>
            <TextBox bgcolor="$fill" border="1" height="12" width="$namewidth">
                <Text style="label"><var var="I18N::translate('Name')" /></Text>
            </TextBox>

            <TextBox border="1" height="12" width="$datewidth">
                <Text style="label"><var var="I18N::translate('Differences')" /></Text>
            </TextBox>

            <SetVar name="fill" value="" />
            <if condition="$sortby=='CHAN'"><SetVar name="fill" value="#AAAAAA" /></if>
            <TextBox bgcolor="$fill" border="1" height="12" newline="1">
                <Text style="label"><var var="I18N::translate('Last change')" /></Text>
            </TextBox>

            <!-- Pending Changes Section Data -->
            <List list="pending" sortby="$sortby">
                <TextBox height="12" width="$namewidth">
                    <Text style="text"><GetPersonName id="" /></Text>
                </TextBox>
                <TextBox height="12" width="$datewidth">
                    <Facts ignore="CHAN" families="0" diff="true">
                        <Text style="text">
                            <var var="@fact" /> <GedcomValue tag="@fact:DATE" /><br />
                        </Text>
                    </Facts>
                </TextBox>
                <TextBox height="12" newline="1">
                    <Text style="text"><GedcomValue tag="CHAN:DATE" /> <GedcomValue tag="CHAN:DATE:TIME" /> - <GedcomValue tag="CHAN:_WT_USER" /></Text>
                </TextBox>

            </List>
            <Cell align="rightrtl" height="25" newline="1" style="label">
                <var var="I18N::translate('Total pending changes: ')" /><ListTotal /><br />
            </Cell>
        </if>

        <!-- Recent Changes Section Header -->
        <Cell align="center" height="20" newline="1" style="header2"><var var="I18N::translate('Recent changes')" /> <var var="changeRangeStart" date="1" /> - <var var="changeRangeEnd" date="1" /></Cell>
        <SetVar name="fill" value="" />
        <if condition="$sortby=='NAME'"><SetVar name="fill" value="#AAAAAA" /></if>
        <TextBox bgcolor="$fill" border="1" height="12" width="$namewidth">
            <Text style="label"><var var="I18N::translate('Name')" /></Text>
        </TextBox>

        <SetVar name="fill" value="" />
        <if condition="$sortby=='BIRT:DATE'"><SetVar name="fill" value="#AAAAAA" /></if>
        <TextBox bgcolor="$fill" border="1" height="12" width="$datewidth">
            <Text style="label"><var var="I18N::translate('Birth')" /> - <var var="I18N::translate('Death')" /></Text>
        </TextBox>

        <SetVar name="fill" value="" />
        <if condition="$sortby=='CHAN'"><SetVar name="fill" value="#AAAAAA" /></if>
        <TextBox bgcolor="$fill" border="1" height="12" newline="1">
            <Text style="label"><var var="I18N::translate('Last change')" /></Text>
        </TextBox>

        <!-- Recent Changes Section Data -->
        <List list="individual" filter1="CHAN:DATE LTE $changeRangeEnd" filter2="CHAN:DATE GTE $changeRangeStart" sortby="$sortby">
            <TextBox height="12" width="$namewidth">
                <Text style="text"><GetPersonName id="" /></Text>
            </TextBox>

            <TextBox height="12" width="$datewidth">
                <Text style="text"><var var="I18N::translate('Birth')" />: <GedcomValue tag="BIRT:DATE" />---<var var="I18N::translate('Death')" />: <GedcomValue tag="DEAT:DATE" /></Text>
            </TextBox>

            <TextBox height="12" newline="1">
                <Text style="text"><GedcomValue tag="CHAN:DATE" /> <GedcomValue tag="CHAN:DATE:TIME" /> - <GedcomValue tag="CHAN:_WT_USER" /></Text>
            </TextBox>
        </List>

        <Cell align="rightrtl" height="25" newline="1" style="label">
            <var var="I18N::translate('Total accepted changes: ')" /><ListTotal />
        </Cell>
    </Body>
    <Footer>
        <Cell align="rightrtl" newline="1" style="date"><Now /></Cell>
    </Footer>`

20220610093539