criawips-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[devel] The next level format handling code


From: Sven Herzberg
Subject: [devel] The next level format handling code
Date: Tue, 29 Mar 2005 23:40:37 +0200

Hi there,

  after the discussion of the attribute handling code (which took not
completely place in this list but also in some chats), here's my
proposal for a new API:

We are using format strings like the one we know from CSS, eg:

  "font-family: Bitstream Vera Sans; font-size: 9px"

This way we get the following:
 * it's quite easy to figure out which attributes are set for this
   instance and which attributes are inherited
 * we don't store plain numbers as sizes and positions, but we store
   them with units (so for saving we can remember which unit the user
   set)

To implement this efficiently I propose the CriaLepton [1] API (to
remind of XAtoms and GQuarks):

 * the main idea is to store an integer instead of a string
 * this integer is returned by cria_lepton_ref() (so we basically have
   an API similar to GQuarks, but as we've got ref-counting we can
   easily free unused strings and their associated indices)
 * we add stuff like cria_lepton_set() which takes an index and a 
   parameter description (eg. "font-weight: bold")
 * if the ref-count of a string is one, modifications take place on
   the string itself (so the methods the return the old index) if not
   cria_lepton_add() returns a new index.
 * for storage i think we should have an array with index numbers being
   the same as font numbers, a list of unreffed strings and a binary
   tree that delivers the index for a string

So we basically get something like GQuarks, but we have the possibility
to clean up unused stuff (which i good for people with few memory and
for people with notebook uptimes of about a month - like i have).

Comments, Questions, More Information requested? Just mail.

Regards,
  Sven

[1] http://en.wikipedia.org/wiki/Lepton

PS: While we discuss this I implement basic font and paragraph
formatting functions in CVS so people can actually do things with
criawips.

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

[Prev in Thread] Current Thread [Next in Thread]