[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Brian Hurt <bhurt@s...> |
| Subject: | Re: [Caml-list] Multi-keyed lookup table? |
On Fri, 8 Aug 2003, Matt Gushee wrote:
> On Thu, Aug 07, 2003 at 03:16:49PM -0500, Brian Hurt wrote:
> >
> > In the general case, this is hard. In this specific case, you might
> > consider just hard coding your levels. So you'd end up with a data
> > structure like:
> >
> > All font
> > / | \
> > / | \
> > medium bold light <-- pick the weight
> > / | \
> > [ ..... ]
>
> Interesting idea, and not one that I had considered at all. It seems
> quite efficient, too. On the other hand, it looks like the fixed search
> path would make it rather hard to implement fallback rules in case an
> exact match isn't found. It seems to me that that's fairly important for
> fonts: there are many situations where it is preferable to produce some
> output with some fonts not quite right rather than producing nothing.
You certainly can handle * rules by just concatenating results from the
different children. You could also do something like:
match weight with
"medium" ->
let t = get_style tree.medium ... in
match t with
_ :: _ -> (* we have at least one font *) t
| [] ->
(* try getting something in bold *)
let t = get_style tree.bold in
...
Brian
-------------------
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