Menu

#4591 `Times New Roman' can not select by override fonts

Verified
Other
2015-10-03
2015-09-04
No

In Thomas Morley's report
http://lists.gnu.org/archive/html/bug-lilypond/2015-09/msg00007.html
seems to have two problems.

This issue is for `Times New Roman' can not select by override fonts.

Discussion

  • Masamichi Hosoda

    In my Windows environment, it has Times New Roman, I've tried following experiments.
    First, selecting Windows fonts by override fonts.

    % override-fonts.ly
    
    \version "2.19.26"
    
    \markup \override #'(font-name . "Times New Roman")
    "Times New Roman can not be selected by override fonts."
    
    \markup \override #'(font-name . "Arial")
    "Arial can be selected by override fonts."
    
    \markup \override #'(font-name . "Courier New")
    "Courier New can be selected by override fonts."
    

    Second, selecting Windows fonts by define fonts.

    % define-fonts.ly
    
    \version "2.19.26"
    
    % Font settings
    \paper {
      #(define fonts
        (set-global-fonts
         #:roman "Times New Roman"
         #:sans "Arial"
         #:typewriter "Courier New"
       ))
    }
    
    \markup \roman
    "Times New Roman can be selected by define fonts."
    
    \markup \sans
    "Arial can be selected by define fonts."
    
    \markup \typewriter
    "Courier New can be selected by define fonts."
    

    The results is interesting.

    `Times New Roman' can not be selected by override fonts.
    Other Windows fonts \'Arial' and `Courier New' can be selected.

    However, `Times New Roman' can be selected by define fonts.

     
  • Masamichi Hosoda

    If I understand correctly, for font family settings,
    overriding fonts uses pango_font_description_from_string(),
    defining fonts uses pango_font_description_set_family().

    Arguments of pango_font_description_from_string() is "FAMILY-LIST [STYLE-OPTIONS] [SIZE]".
    FAMILY-LIST is a comma separated list of families optionally terminated by a comma.
    STYLE_OPTIONS is a whitespace separated list of words where each word describes one of style, variant, weight, stretch, or gravity.

    So I think that "Times New Roman" is interpreted "Times New" font family and "Roman" style.

    On the other hand, arguments of pango_font_description_set_family() is only font family list.
    So I think that "Times New Roman" is interpreted "Times New Roman" font family.

    Then, I've tried following experiment that with extra comma.

    % override-fonts-comma.ly
    
    \version "2.19.26"
    
    \markup \override #'(font-name . "Times New Roman,")
    "Times New Roman with comma can be selected by override fonts."
    

    The results is that "Times New Roman" is selected.
    FAMILY-LIST is a comma separated list, so with comma, whole "Times New Roman" seems to interpreted font family.

     
  • Masamichi Hosoda

    I've found some regression tests use overriding font-name to "Times New Roman".

    input/regression/font-name.ly
    input/regression/metronome-mark-formatter.ly

    fontconfig has "Times New Roman"'s substitute settings for the environment which does not have "Times New Roman".
    Even if the environment does not have "Times New Roman", any serif fonts like "Liberation Serif" should be used.
    However, LilyPond website uploaded PDFs (compiled these .ly files) are used Sans Serif fonts for "Times New Roman".

    So I think that these .ly files should be fixed like following.

    Comma separated font family name list "Times New Roman" and "serif", explicitly terminated the list, whitespace separated style list "Normal"

    \override foo.bar.font-name = #"Times New Roman,serif, Normal"
    

    or
    Comma separated font family name list "Times New Roman", explicitly terminated the list, no style list"

    \override foo.bar.font-name = #"Times New Roman,"
    

    Which do you like?

    Overriding other fonts do not need above fix, but I prefer same fix to all overriding fonts.
    How do you think?

    I'll make a patch.

     
  • Masamichi Hosoda

    • status: Accepted --> Started
    • Patch: --> new
     
  • Masamichi Hosoda

    I've uploaded a patch to Rietveld.
    https://codereview.appspot.com/262330043

     
  • Anonymous

    Anonymous - 2015-09-07

    Passes make, make check and a full make doc

    reg test diff here:

    https://drive.google.com/open?id=0B9nZ5LHV2Ds6YmYxOGNKeDFIUjA

    I've also made some comments for suggestions for the English version of the text edits you suggested.

     
  • Anonymous

    Anonymous - 2015-09-07
    • Patch: new --> review
     
  • Masamichi Hosoda

    • Patch: review --> new
     
  • Masamichi Hosoda

    I've uploaded Patch Set 3 to Rietveld.
    https://codereview.appspot.com/262330043/

     
  • Anonymous

    Anonymous - 2015-09-09
    • Patch: new --> review
     
  • Anonymous

    Anonymous - 2015-09-09

    Passes make, make check and a full make doc

    reg test diff here (has not changed since):

    https://drive.google.com/open?id=0B9nZ5LHV2Ds6YmYxOGNKeDFIUjA

     
  • Masamichi Hosoda

    I've uploaded Patch Set 4.
    https://codereview.appspot.com/262330043

     

    Last edit: Masamichi Hosoda 2015-09-10
  • Masamichi Hosoda

    • Patch: review --> new
     
  • Anonymous

    Anonymous - 2015-09-12
    • Patch: new --> review
     
  • Anonymous

    Anonymous - 2015-09-12

    Passes make, make check and a full make doc.

    Reg test diff has changed slightly

    https://drive.google.com/file/d/0B9nZ5LHV2Ds6UHZsQWNocVpjUjA/view?usp=sharing

     
  • Anonymous

    Anonymous - 2015-09-14
    • Patch: review --> countdown
     
  • Anonymous

    Anonymous - 2015-09-14

    Patch on countdown for September 17th

     
  • Anonymous

    Anonymous - 2015-09-17

    Patch counted down - please push.

     
  • Anonymous

    Anonymous - 2015-09-17
    • Patch: countdown --> push
     
  • Masamichi Hosoda

    • labels: --> Fixed_2_19_28
    • status: Started --> Fixed
    • Patch: push -->
     
  • Masamichi Hosoda

    I've uploaded to staging.

    Issue 4591 / 1: Fix font-name overriding `Times New Roman'
    author Masamichi Hosoda trueroad@trueroad.jp
    Mon, 7 Sep 2015 11:04:50 +0000 (20:04 +0900)
    committer Masamichi Hosoda trueroad@trueroad.jp
    Thu, 17 Sep 2015 14:28:14 +0000 (23:28 +0900)
    commit 64d2c3f619587207c1dcd22f573b9ff4ff34d04f

    Issue 4591 / 2: Fix font-name overriding deprecated name
    author Masamichi Hosoda trueroad@trueroad.jp
    Mon, 7 Sep 2015 11:59:19 +0000 (20:59 +0900)
    committer Masamichi Hosoda trueroad@trueroad.jp
    Thu, 17 Sep 2015 14:28:14 +0000 (23:28 +0900)
    commit 1e8a9855c7b9455b6bb95c6894b79eead3f5f7b3

    Issue 4591 / 3: Fix font-name overriding wrong name
    author Masamichi Hosoda trueroad@trueroad.jp
    Mon, 7 Sep 2015 13:12:56 +0000 (22:12 +0900)
    committer Masamichi Hosoda trueroad@trueroad.jp
    Thu, 17 Sep 2015 14:28:15 +0000 (23:28 +0900)
    commit d0980c892d79010a9506aa5b7da504181ba5b632

    Issue 4591 / 4: NR: Enhance font-name overriding sample
    author Masamichi Hosoda trueroad@trueroad.jp
    Mon, 7 Sep 2015 13:30:23 +0000 (22:30 +0900)
    committer Masamichi Hosoda trueroad@trueroad.jp
    Thu, 17 Sep 2015 14:28:15 +0000 (23:28 +0900)
    commit 15c207fe1e0c7a70184ec82e9f060d3ae599326d

    Issue 4591 / 5: NR: Add font-name description
    author Masamichi Hosoda trueroad@trueroad.jp
    Mon, 7 Sep 2015 13:49:14 +0000 (22:49 +0900)
    committer Masamichi Hosoda trueroad@trueroad.jp
    Thu, 17 Sep 2015 14:28:16 +0000 (23:28 +0900)
    commit c6035c9f68d892a37855edf6acb5e9d0fbec7267

    Issue 4591 / 6: Clean up
    author Masamichi Hosoda trueroad@trueroad.jp
    Tue, 8 Sep 2015 12:57:06 +0000 (21:57 +0900)
    committer Masamichi Hosoda trueroad@trueroad.jp
    Thu, 17 Sep 2015 14:28:16 +0000 (23:28 +0900)
    commit 2a4c5137870acf1b1fd2f3307d98973a52cfc8b9

     
  • Trevor Daniels

    Trevor Daniels - 2015-10-03
    • status: Fixed --> Verified