On 2008-03-11 12:29-0000 Andrew Ross wrote:

>
> I've been looking at implementing an example which uses plgfci / plsfci.
> The most logical seems to be to replace calls to plfont in one or more
> of the existing examples with the new functions. Comments in the source
> suggest that is what users should do.
>
> Unfortunately the way they are set up is somewhat complicated for the
> end user to use. If you look at the examples in the library source (e.g.
> in plsym.c) they all do something like
>
>    PLUNICODE fci = PL_FCI_MARK;
>    plP_hex2fci(PL_FCI_SANS, PL_FCI_FAMILY, &fci);
>    plsfci(fci);
>
> The plP_hex2fci helper function does the dirty working of translating
> the encoding. If plgfci / plsfci are in the CAPI then we should also
> have versions of plP_hex2fci / plP_fci2hex in order to deal with the
> conversions. Alternatively we need user friendly versions of plgfci /
> plsfci which deal with the conversion. Personally I think the latter
> would be better. The user should never need to deal directly with the
> internal FCI representation. The only advantage of keeping the fci
> visible is that it allows the user to set up several and quickly switch
> between them.
>
> I would propose something like
>
> void plsfnt(unsigned char characterstic, unsigned char value);
>
> unsigned char plgfnt(unsigned char characteristic);
>
> e.g.
>
>   plsfnt(PL_FCI_FAMILY,PL_FCI_SANS);
>   if (plgfnt(PL_FCI_STYLE) == PL_FCI_ITALIC) {
>      printf("Italic text\n");
>   }
>
> Any thoughts? Anyway, we need to do something here as plgfci / plsfci
> are currently not very useable.

For others interested in this thread, the chief reference on our font
characterization system is
http://plplot.sourceforge.net/docbook-manual/plplot-html-5.9.0/characters.html#fci

I agree that that higher-level forms of plsfci/plgfic are worth
implementing., but I think an even more useful API would be three arguments
in the order font family, style, and weight with a typical call being, e.g.,

plsfnt("serif", "italic", "bold");

etc.  If any of those three arguments is the empty string, e.g.,

plsfnt("serif", "", "");

then the corresponding family, style, and/or weight of the font should
remain unchanged.  Similarly, plgfnt should return three character string
arguments corresponding to the current font family, style, and weight.

I also think it is worth keeping plsfci/plgfci undeprecated since those in
the know can benefit from those short forms.  Similarly, our scheme for
changing the font in the middle of a string has the
#<0x8nnnnnnn> form of specifying the entire FCI, the #<0xmn> form for changing
just one attribute of the FCI, and the higher-level #<FCI COMMAND STRING/>
form as well.

I agree we need examples of how to change fonts. Today I will add a page to
example 23 to do this using plsfci, and some pages illustrating how to do
the same thing with the in-string font-changing commands documented in the
above URL.  I plan to add a corresponding plsfnt page to the example if you
will kindly implement that API when we come to consensus on it.

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of
Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__________________________

Linux-powered Science
__________________________

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel

Reply via email to