caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Multi-keyed lookup table?
@ 2003-08-07 19:41 Matt Gushee
  2003-08-07 20:16 ` Brian Hurt
  2003-08-07 22:19 ` John Max Skaller
  0 siblings, 2 replies; 23+ messages in thread
From: Matt Gushee @ 2003-08-07 19:41 UTC (permalink / raw)
  To: caml-list

Hello, all--

I am trying to decide on a data structure that allows efficient lookup
of fonts according to various font properties. I am thinking that the
data structures describing fonts will be something like this:


  type font_weight =
    | Medium
    | Bold
    | Light
  type font_style =
    | Roman
    | Italic
    | Oblique
  type font_width =
    | Normal
    | Expanded
    | Condensed
  type encoding = string * int     (* e.g. : ("iso8859",15))
  type font_ref = string       (* reference to the font file *)
  
  type font_family =
    ((font_weight * font_style * font_width * encoding) * font_ref) 
    list

  (* Example font family *)
  let arial = [
    ((Medium, Roman, Normal, ("iso10646",1)), "arial.ttf");
    ((Bold, Roman, Normal, ("iso10646",1)), "arialb.ttf");
    ...
    ];;

  (* based on the 5 types used in CSS and other Web standards *)
  type font_class =
    | Serif           
    | SansSerif
    | Monospaced
    | Cursive
    | Fantasy


What I would like to have is a data structure that contains descriptions
of all fonts available on a particular system, such that an application
can do something like:

  get_font_by_class ~weight:Bold ~style:Italic ~encoding:("iso8859",1) SansSerif

or

  get_font_by_family  ~weight:Bold "Helvetica"

And obtain the font file name that matches the specified
characteristics. As I mentioned above, efficient lookup is important;
efficient creation of the data structure is probably not important; and
since there are no large objects involved, and the data refers to font
collections that may have hundreds of members, but probably not
thousands, I don't think memory usage is really an issue.

So, does anyone have an idea what sort of data structure would work
best?

TIA for your suggestions.
    

-- 
Matt Gushee                 When a nation follows the Way,
Englewood, Colorado, USA    Horses bear manure through
mgushee@havenrock.com           its fields;
http://www.havenrock.com/   When a nation ignores the Way,
                            Horses bear soldiers through
                                its streets.
                                
                            --Lao Tzu (Peter Merel, trans.)

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2003-08-12  9:58 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-07 19:41 [Caml-list] Multi-keyed lookup table? Matt Gushee
2003-08-07 20:16 ` Brian Hurt
2003-08-07 21:49   ` Yaron Minsky
2003-08-07 22:26     ` John Max Skaller
     [not found]       ` <D4DBD8568F05D511A1C20002A55C008C11AC05E6@uswaumsx03medge.med.ge.com>
2003-08-08 21:30         ` Matt Gushee
2003-08-08 22:13           ` Brian Hurt
     [not found]           ` <005d01c35e51$7c927200$6628f9c1@zofo>
2003-08-09 16:57             ` [Caml-list] Array.filter (was Multi-keyed lookup table?) Matt Gushee
2003-08-09 18:48               ` ijtrotts
2003-08-10 19:53                 ` Michal Moskal
2003-08-10  2:34                   ` ijtrotts
2003-08-11  5:48                     ` David Brown
2003-08-10 18:53                       ` ijtrotts
2003-08-10 20:23                   ` Marcin 'Qrczak' Kowalczyk
2003-08-10  2:37                     ` ijtrotts
     [not found]                   ` <200308102222.16369.qrczak@knm.org.pl>
2003-08-10 20:43                     ` Michal Moskal
2003-08-10 21:59                       ` Ville-Pertti Keinonen
2003-08-10 20:55                 ` [Caml-list] Array.filter Jean-Baptiste Rouquier
2003-08-11  9:46                   ` Michal Moskal
2003-08-10 22:29                 ` [Caml-list] Array.filter (was Multi-keyed lookup table?) Shawn Wagner
2003-08-11 11:51           ` [Caml-list] Multi-keyed lookup table? Remi Vanicat
2003-08-07 22:19 ` John Max Skaller
2003-08-12  6:34   ` Florian Hars
2003-08-12  9:58     ` Michael Wohlwend

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).