Subject Re: Font Selection
From maurizio S. <mau@mau.it>
Date Fri, 6 Sep 2019 08:56:59 +0200
Newsgroups dbase.getting-started

Wooooww....... !!!
is this somewhere in dUFLP ?
great Ken


tks
Maurizio

Il 06/09/19 00:26, Ken Mayer ha scritto:

>
> This program can be used to do that, I just spent some time testing
> various fonts ... you could turn it into a function, or whatever you
> need, I leave that to you.
>
> /*
>     ParseGetFont.prg
>     Parse getFont() string
> */
> clear
>
> x = getFont( "Select Font and Attributes to Use" )
>
> nComma1 = x.indexOf( "," )
> nComma2 = x.indexOf( ",", nComma1+1 )
> nComma3 = x.indexOf( ",", nComma2+1 )
> if nComma3 = -1
>     nComma3 = 0
> endif
>
> // read to the comma, then back up one:
> cFontName = x.left( x.indexOf( "," ) )
>
> // font size is between the first two commas:
> nFontSize = x.substring( nComma1+1, nComma2 )
>
> // attribute is between comma 2 and comma 3
> // if nComma3 is zero we don't have a third comma
> if nComma3 > 0
>     cFontAttributes = x.substring( nComma2+1, nComma3 )
> else
>     cFontAttributes = x.right( x.length - nComma2-1 )
> endif
>
> // parse this out for individual attributes:
> lBold = iif( "B" $ cFontAttributes, true, false )
> lItalic = iif( "I" $ cFontAttributes, true, false )
> lUnderline = iif( "U" $ cFontAttributes, true, false )
> lStrikeout = iif( "S" $ cFontAttributes, true, false )
>
> // font family is the right of comma 3:
> if nComma3 > 0
>     cFontFamily = x.right( x.length - nComma3-1 )
> else
>     cFontFamily = ""
> endif
>
> // output:
> ? "Font Name:   " + cFontName
> ? "Font Size:   " + nFontSize
> ? "Bold:        " + lBold
> ? "Italic:      " + lItalic
> ? "Underline:   " + lUnderline
> ? "Strikeout:   " + lStrikeout
> ? "Font Family: " + cFontFamily
>
> // end of program: ParseGetFont.prg
> // ---------------
>
> All of that put together, now if you want to set the field lNA to bold
> (and it is a logical field -- if it's not you will have to do some other
> work here ...):
>
>
> form.NA1.rowset.fields["lNa"].value = lBold
> form.NA1.rowset.SAVE()
>
> Ken
>