Jump to content

UTF-8: Difference between revisions

From LilyPond wiki
No edit summary
Update to 2.26
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
Various scripts may be used for texts (like titles and lyrics) by entering them in UTF-8 encoding, and using a Pango based backend. Depending on the fonts installed, this fragment will render Bulgarian (Cyrillic), Hebrew, Japanese and Portuguese.
Various scripts may be used for texts (like titles and lyrics) by entering them in UTF-8 encoding. Depending on the fonts installed, this fragment renders Bulgarian (Cyrillic), Hebrew, Japanese, and Portuguese.


<lilypond version="2.24">
<lilypond version="2.26">
%{
%{
You may have to install additional fonts.
You may have to install additional fonts.


Red Hat Fedora
Red Hat Fedora: linux-libertine-fonts (Latin, Cyrillic, Hebrew)
                google-noto-serif-jp-fonts (Japanese)


  linux-libertine-fonts (Latin, Cyrillic, Hebrew)
Debian GNU/Linux, Ubuntu: fonts-linuxlibertine (Latin, Cyrillic, Hebrew)
  google-noto-serif-jp-fonts (Japanese)
                          fonts-noto-cjk (Japanese)
 
Debian GNU/Linux, Ubuntu
 
  fonts-linuxlibertine (Latin, Cyrillic, Hebrew)
  fonts-noto-cjk (Japanese)
%}
%}


% 'Linux Libertine' fonts also contain Cyrillic and Hebrew glyphs.
% 'Linux Libertine' fonts also contain Cyrillic and Hebrew glyphs.
\paper {
\paper {
   #(define fonts
   property-defaults.fonts.serif = "Linux Libertine O, Noto Serif CJK JP, Noto Serif JP"
    (set-global-fonts
    #:roman "Linux Libertine O, Noto Serif CJK JP, Noto Serif JP"
  ))
}
}


Line 57: Line 50:


[[Category:Text]]
[[Category:Text]]
[[Category:Included in the official documentation]][[Category:Snippet]]
[[Category:Included in the official documentation]]
[[Category:Snippet]]

Latest revision as of 21:39, 5 August 2026

Various scripts may be used for texts (like titles and lyrics) by entering them in UTF-8 encoding. Depending on the fonts installed, this fragment renders Bulgarian (Cyrillic), Hebrew, Japanese, and Portuguese.

\version "2.26"

%{
You may have to install additional fonts.

Red Hat Fedora: linux-libertine-fonts (Latin, Cyrillic, Hebrew)
                google-noto-serif-jp-fonts (Japanese)

Debian GNU/Linux, Ubuntu: fonts-linuxlibertine (Latin, Cyrillic, Hebrew)
                          fonts-noto-cjk (Japanese)
%}

% 'Linux Libertine' fonts also contain Cyrillic and Hebrew glyphs.
\paper {
  property-defaults.fonts.serif = "Linux Libertine O, Noto Serif CJK JP, Noto Serif JP"
}

bulgarian = \lyricmode {
  Жълтата дюля беше щастлива, че пухът, който цъфна, замръзна като гьон.
}

hebrew = \lyricmode {
  זה כיף סתם לשמוע איך תנצח קרפד עץ טוב בגן.
}

japanese = \lyricmode {
  いろはにほへど ちりぬるを
  わがよたれぞ  つねならむ
  うゐのおくや  まけふこえて
  あさきゆめみじ ゑひもせず
}

% "a nice song for you"
portuguese = \lyricmode {
  à vo -- cê uma can -- ção le -- gal
}

\relative c' {
  c2 d
  e2 f
  g2 f
  e2 d
}
\addlyrics { \bulgarian }
\addlyrics { \hebrew }
\addlyrics { \japanese }
\addlyrics { \portuguese }