[scribus] Get the width of a piece of text in a Scribus script?

Gregory Pittman gpittman at iglou.com
Sat Aug 6 15:32:48 UTC 2016


On 08/06/2016 10:04 AM, John Culleton wrote:
> On Fri, 09 Aug 2013 15:43:52 -0700
> Adam <adam at photosynth.ca> wrote:
> 
>> Good day,
>> I'm working on a script for laying out a song
>> book that includes lyrics and chords. Chord
>> names need to be placed above each line of
>> lyrics, at the appropriate spot in the lyrics.
>> I've explored a variety of approaches to this
>> using typographic options to try to get the
>> chord letters bumped up above the lyrics line
>> using baseline shift and kerning adjustments,
>> but so far these have not proved effective.
>>
>> My present approach is to put each chord in a
>> small text box above the lyrics line. In order
>> to do this, I need to be able to determine the
>> horizontal position of that point in the
>> lyrics, as rendered in the relevant font and
>> type size. Does anyone know of a way to do this?
>>
>> Apparently the ImageFont python module (which
>> is a subset of PIL, or the Python Imaging
>> Library), can return the width of a text line
>> as rendered, but I so far have not been able to
>> get this module working properly (there's a C
>> library involved, which is malfunctioning in my
>> installation).
>>
>> Does anyone know of any other way to
>> programatically measure the rendered width of a
>> line of text?
>>
>> Thanks for your help!
>>
>> Adam
>>
> There are horses for courses, as my father use to
> say. Consider laying out the songs using the free
> program Mup. Each output will be a postscript file
> that you can import into Scribus. There is some
> learning involved of course but you will find
> that the alignment of notes to verses is elegantly
> handled. You can also output midi files to
> play the music.
> 
> 
There is also lilypond, which can be used inside of Scribus in a Render
frame. Although there is an expectation that one would be adding a
musical score, plus lyrics, and maybe chords, I would think that it
would be possible to skip the score and just have lyrics and chords.

Perhaps someone on the list familiar with lilypond might give some help.

Greg



More information about the scribus mailing list