bug-lilypond
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Garbage copied from PDF when using certain fonts


From: Masamichi Hosoda
Subject: Re: Garbage copied from PDF when using certain fonts
Date: Sat, 14 Aug 2021 19:36:46 +0900 (JST)

>> When using certain fonts (in my case, Noto CJK, both pan-CJK and
>> subset versions), the output looks right but when copied from the
>> generated PDF file, everything becomes garbage.  [...]
> 
> Confirmed.
> 
>> It seems to be all about CID. Maybe related to Issue #6058?
> 
> Yes and no.  The fix for #6058 was to make CID fonts display correctly
> at all.  AFAICS, to make copy and paste work for CID fonts it is
> necessary to add a ToUnicode map.  We don't do that currently.  [This
> is probably worth an entry in our issues database.]  Masamichi-san,
> please correct me if I am wrong.

Yes, you need ToUnicode CMap to copy and paste characters
from Adobe-Identity-0 (AI0) fonts.
Current LilyPond does not embed the ToUnicode CMap.
Noto CJK is an AI0 font. 
Therefore, you cannot copy and paste.

If the font is not AI0, but Adobe-GB1 (AG1), Adobe-Japan1 (AJ1), etc.,
you do not necessarily need the ToUnicode CMap for copy and paste.

To copy and paste, you can use HaranoAji fonts, which are AG1 or AJ1 fonts.

HaranoAjiFontsCN (AG1 for Simplified Chinese)
https://github.com/trueroad/HaranoAjiFontsCN

HaranoAjiFonts (AJ1 for Japanese)
https://github.com/trueroad/HaranoAjiFonts

Here is a sample.

```
\version "2.22.0"
\markup {
  \override #'(font-name . "HaranoAjiMincho")
  {English}
  \override #'(font-name . "HaranoAjiMinchoCN") % For Simplified Chinese
  {中文}
  \override #'(font-name . "HaranoAjiMincho") % For Japanese
  {にほんご}
}
```

reply via email to

[Prev in Thread] Current Thread [Next in Thread]