webtrees icon indicating copy to clipboard operation
webtrees copied to clipboard

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

Open melizaa opened this issue 7 years ago • 10 comments

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

melizaa avatar Nov 16 '17 11:11 melizaa

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 avatar Dec 06 '17 07:12 fisharebest

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 avatar Dec 06 '17 07:12 fisharebest

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

fisharebest avatar Dec 06 '17 07:12 fisharebest

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

vytux-com avatar Dec 06 '17 07:12 vytux-com

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

fisharebest avatar Dec 06 '17 09:12 fisharebest

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 avatar Jun 05 '21 09:06 ghost

@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.

ghost avatar Jun 05 '21 10:06 ghost

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.

melizaa avatar Oct 05 '21 19:10 melizaa

@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 avatar Jun 09 '22 04:06 iyoua

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? ` <SetVar name="fonts" value="droidsansfallback" />

<!-- 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

iyoua avatar Jun 10 '22 01:06 iyoua