Menu

#1482 \caps and \smallCaps don't work with \fromproperty

Accepted
nobody
None
Defect
2015-07-23
2011-01-19
Anonymous
No

Originally created by: *anonymous

Originally created by: RalphBug...@gmail.com

In the example below, \caps and \smallCaps work with simple text
strings, but not with text fields accessed with \fromproperty.
For some reason, this is not a problem with \sans, \italic, and
\bold; they all work with both text strings and \fromproperty
fields.

This is not the expected behavior.  Users should be allowed to use
\caps and \smallCaps with \fromproperty in the definitions of
bookTitleMarkup et. al.

\version "2.13.44"

\paper {
line-width = 80\mm
bookTitleMarkup = \markup {
   \column {
     \fill-line {
       \line { \sans "Sans" }
       \line { \caps "Caps" }
       \line { \smallCaps "SmallCaps" }
       \line { \italic "Italic" }
       \line { \bold "Bold" }
     }
     \fill-line {
       \line { \sans \fromproperty #'header:title }
       \line { \caps \fromproperty #'header:title }
       \line { \smallCaps \fromproperty #'header:title }
       \line { \italic \fromproperty #'header:title }
       \line { \bold \fromproperty #'header:title }
     }
   }
}
}

\header {
title = "Title"
tagline = ##f
}

\markup \null

Discussion

  • Google Importer

    Google Importer - 2011-07-09

    Originally posted by: elliot.w...@gmail.com

    I just ran into this bug (using version 2.15.4). Until it gets fixed, is there a workaround (other than changing \title to a \markup and then moving the \smallCaps or \caps inside of it)?

     
  • Google Importer

    Google Importer - 2011-07-10

    Originally posted by: mts...@gmail.com

    This problem comes from the font you are using in your markups.  There are currently no native small-caps capabilities in the default font for markups (Century Schoolbook from the PS font suite), which means that LilyPond can't typeset it from \fromproperty.  If you choose a font that has small caps, then you should use the command \fontCaps instead of \smallCaps and you'll get the result you're after.

    Alternatively, you can make a slightly more involved function to get the result you're after with the default font:

    #(define-markup-command (frompropertysmallcaps layout props symbol smallcaps)
      (symbol? boolean?)
      (let ((m (chain-assoc-get symbol props)))
        (if (markup? m)
            (interpret-markup layout props (if smallcaps (markup #:smallCaps m) m))
            empty-stencil)))

    \paper {
    line-width = 80\mm
    bookTitleMarkup = \markup {
       \column {
         \fill-line {
           \line { \sans "Sans" }
           \line { \caps "Caps" }
           \line { \smallCaps "SmallCaps" }
           \line { \italic "Italic" }
           \line { \bold "Bold" }
         }
         \fill-line {
           \line { \sans \frompropertysmallcaps #'header:title ##f }
           \line { \caps \frompropertysmallcaps #'header:title ##t }
           \line { \fontCaps \frompropertysmallcaps #'header:title ##t }
           \line { \italic \frompropertysmallcaps #'header:title ##f }
           \line { \bold \frompropertysmallcaps #'header:title ##f }
         }
       }
    }
    }

    \header {
    title = "Title"
    tagline = ##f
    }

    \markup \null

     
  • Google Importer

    Google Importer - 2011-07-10

    Originally posted by: n.putt...@gmail.com

    Here's a possible workaround using redefined \fromproperty and \caps commands:

    #(define-markup-command (fromproperty layout props symbol)
       (symbol?)
       (let ((m (chain-assoc-get symbol props))
             (caps? (chain-assoc-get 'caps props)))
         (if (markup? m)
             (interpret-markup layout props
                               (if caps?
                                   (make-smallCaps-markup m)
                                   m))
             empty-stencil)))

    #(define-markup-command (caps layout props arg) (markup?)
       (interpret-markup layout (prepend-alist-chain 'caps #t props)
                         (make-smallCaps-markup arg)))

     
  • Google Importer

    Google Importer - 2011-07-10

    Originally posted by: n.putt...@gmail.com

    > This problem comes from the font you are using in your markups.

    It's nothing to do with this, since \caps and \smallCaps are "poor man's caps", i.e., they work by changing individual letters in a string rather than switching font.  The problem is that \fromproperty, like all markup commands, returns a markup object; even if the accessed property is a bare string, it's inaccessible since it's wrapped in a fromproperty-markup object.

     
  • Google Importer

    Google Importer - 2015-07-23

    Originally posted by: simon.al...@mail.de

    (No comment was entered for this change.)

    Labels: -Priority-Low

     
MongoDB Logo MongoDB