Auto-sizing of text

Post your wish lists for new versions of the software.

We cannot do everything but if we know what people want it make life easier.

Moderators: webmaster, Christian, Kuok-Tim, ChrisClark, Forum Support

Auto-sizing of text

Postby onefff » Mon Aug 16, 2004 4:04 pm

The 'single word' word wrap that Zionworx gives can look a bit naff sometimes. I was wondering if you could do something clever with font size.

I actually started writing some display software in MS Access and did something like this looking at the number of lines to display and the maximum number of characters per line:

Function fontsizer(mystring As String) As Integer
'works out the optimum font size based on the number of lines and the maximum line width
Dim font1
Dim font2

font1 = 40
font2 = 40
If lines(mystring) > 8 Then font1 = Int(40 - ((lines(mystring) - 8) * 3))
If maxwidth(mystring) > 40 Then font2 = Int(40 - (((maxwidth(mystring) - 40) * 0.55)))
If font2 > font1 Then
fontsizer = font1
Else
fontsizer = font2
End If
End Function

Function maxwidth(mystring As String) As Integer
'finds the maximum width of a multi line text string
Dim position As Integer
Dim position2 As Integer
Dim lastpos As Integer

position = 0
position2 = 1
maxwidth = 0

position = InStr(1, mystring, Chr(10), vbBinaryCompare)

If position = 0 Then maxwidth = Len(mystring)

While position > 0 'I have found another new line character
If position - position2 > maxwidth Then
maxwidth = position - position2
End If
position2 = position + 1
lastpos = position
position = InStr(position2, mystring, Chr(10), vbBinaryCompare)
Wend

If Len(mystring) - lastpos > maxwidth Then maxwidth = Len(mystring) - lastpos

End Function

Function lines(mystring As String) As Integer
'finds the number of lines in a multi line text stringDim position
Dim position As Integer
Dim position2 As Integer

position = 0
position2 = 1
lines = 1

position = InStr(1, mystring, Chr(10), vbBinaryCompare)

While position > 0 'I have found another new line character
lines = lines + 1
position2 = position + 1
position = InStr(position2, mystring, Chr(10), vbBinaryCompare)
Wend

End Function

I guess that the number of lines is not too critical but if a font size reduction of 5% would fit in that last offending word then an automatic option (in preferences) might be really nice.

By the way guys, keep up the good work. This is a fantastic product.

God Bless.

Geof H
Brent Methodist Church, Dartford.
To err is human, to really foul things up requires a computer!
onefff
Junior
 
Posts: 5
Joined: Mon Aug 16, 2004 3:58 pm

Postby intuitas » Thu Oct 14, 2004 11:01 am

This is a suggestion akin to the one regarding widow and orphan control elsewhere.
Are you suggesting an adjustment on a verse by verse basis, or would you be happy with an adjustment for the current song that gave the least number of verses with single word lines.

I haven't tried fractional font sizes when changing the font for a particular song but I suspect the API limits this to unitary changes: Christian will no doubt correct me on this if I am wrong.

God Bless
intuitas
Senior
 
Posts: 60
Joined: Wed Oct 01, 2003 4:02 pm
Location: Tasmania Australia


Return to Zionworx Wish List

Who is online

Users browsing this forum: No registered users and 6 guests

cron