From: Andrew R. <and...@us...> - 2008-03-12 12:25:27
|
On Tue, Mar 11, 2008 at 05:26:49PM -0700, Alan Irwin wrote: > On 2008-03-11 22:12-0000 Andrew Ross wrote: > > > > >I like this idea. It might be more in keeping with other plplot > >functions to use the existing PL_FCI constants rather than strings. > >This still gives readable source code and is easier to parse. A negative > >value might mean "don't change this". > > I like your additional idea to use PL_FCI_SANS, etc., rather than strings. > Go for it. It is now implemented - there are new plsfont and plgfont functions which provide a more user friendly front end to plsfci / plgfci. Typical use might be plsfont(PL_FCI_SERIF,PL_FCI_ITALIC,PL_FCI_BOLD); PLINT family, style, weight; plgfont(&family, &style, &weight); A negative value in plsfont will ignore that particular feature so plsfont(PL_FCI_SANS,-1,-1); will just set the font family, and leave the style and weight unchanged. A NULL value in plgfont will not return that feature so plgfont(&family, NULL, NULL); will just return the current font family. I think this should meet our requirements. Note that the function have PLINT arguments even though internally these elements are stored as unsigned char. This seemed to make more sense when compared to other plplot functions and it makes some of the bindings easier to maintain if we don't use lots of different types. We are guaranteed that PLINT will always be big enough to store an unsigned char. The new plsfont function does appropriate range checking for valid values. Also using PLINT allows us to use negative values for "ignore this parameter". Alan, if you are happy with this then perhaps you could add examples of their use into example 23. Andrew |