X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=scm%2Fflag-styles.scm;h=01fe315da0daf7c97c6a83e2d957319c4835c025;hb=47db9a3883d726ca53e2133a3b2298f78dd6a32e;hp=c8fea1ae5d8e655ee5d61701f61b7b577072dc47;hpb=cf137655b7aee9988ef536d6fa5e38d279ee73cf;p=lilypond.git diff --git a/scm/flag-styles.scm b/scm/flag-styles.scm index c8fea1ae5d..01fe315da0 100644 --- a/scm/flag-styles.scm +++ b/scm/flag-styles.scm @@ -1,6 +1,6 @@ ;;;; This file is part of LilyPond, the GNU music typesetter. ;;;; -;;;; Copyright (C) 2008--2012 Reinhold Kainhofer +;;;; Copyright (C) 2008--2015 Reinhold Kainhofer ;;;; ;;;; LilyPond is free software: you can redistribute it and/or modify ;;;; it under the terms of the GNU General Public License as published by @@ -16,7 +16,8 @@ ;;;; along with LilyPond. If not, see . ;;;; This file implements different flag styles in Scheme / GUILE, most -;;;; notably the old-straight-flag and the modern-straight-flag styles. +;;;; notably the old-straight-flag, the modern-straight-flag and the flat-flag +;;;; styles. (define-public (no-flag grob) @@ -80,16 +81,22 @@ All lengths are scaled according to the font size of the note." (raw-length (if stem-up upflag-length downflag-length)) (angle (if stem-up upflag-angle downflag-angle)) (flag-length (+ (* raw-length factor) half-stem-thickness)) - (flag-end (polar->rectangular flag-length angle)) + ;; For flat flags the points to create the stencil using + ;; ly:round-filled-polygon need to be different concerning flag-end + (flag-end (if (= angle 0) + (cons flag-length (* half-stem-thickness dir)) + (polar->rectangular flag-length angle))) (thickness (* flag-thickness factor)) (thickness-offset (cons 0 (* -1 thickness dir))) (spacing (* -1 flag-spacing factor dir )) (start (cons (- half-stem-thickness) (* half-stem-thickness dir))) ;; The points of a round-filled-polygon need to be given in clockwise ;; order, otherwise the polygon will be enlarged by blot-size*2! - (points (if stem-up (list start flag-end - (offset-add flag-end thickness-offset) - (offset-add start thickness-offset)) + (points (if stem-up + (list start + flag-end + (offset-add flag-end thickness-offset) + (offset-add start thickness-offset)) (list start (offset-add start thickness-offset) (offset-add flag-end thickness-offset) @@ -118,6 +125,10 @@ of Bach, etc." flags are both 45 degrees." ((straight-flag 0.55 1 -45 1.2 45 1.4) grob)) +(define-public (flat-flag grob) + "Flat flag style. The angles of the flags are both 0 degrees" + ((straight-flag 0.55 1.0 0 1.0 0 1.0) grob)) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; Flags created from feta glyphs (normal and mensural flags) @@ -203,11 +214,12 @@ a flag always touches a staff line." -(define-public ((glyph-flag flag-style) grob) +(define ((glyph-flag flag-style) grob) "Simulatesthe default way of generating flags: Look up glyphs @code{flags.style[ud][1234]} from the feta font and use it for the flag stencil." (create-glyph-flag flag-style "" grob)) +(export glyph-flag)