• Welcome to Valhalla Legends Archive.
 

Windows Rich Text Control Development

Started by MyndFyre, November 18, 2004, 12:42 AM

Previous topic - Next topic

Kp

It may be preferable for memory-usage reasons not to store the font name within the control, but rather to save an object which holds a reference count and a font handle.  Then all the segments drawn in a single font share one FontContainer, which is freed when they're all erased.  For example:

class FontContainer {
    HANDLE hFont;
    unsigned count;
    LPWSTR wszName;
  public:
    static FontContainer *getFont(LPWSTR font_name); // return an existing FontContainer if one is available, otherwise load the named font and return it in a new container
};

With regard to selection support, it looks like your present scheme has a selection granularity of one text segment.  This could be annoying if you wanted to select part of a line, as could happen if you were selecting a URL from someone saying "This site rocks: protocol://someplace.net/".
[19:20:23] (BotNet) <[vL]Kp> Any idiot can make a bot with CSB, and many do!

MyndFyre

#16
Quote from: Kp on December 16, 2004, 04:10 PM
With regard to selection support, it looks like your present scheme has a selection granularity of one text segment.  This could be annoying if you wanted to select part of a line, as could happen if you were selecting a URL from someone saying "This site rocks: protocol://someplace.net/".

Yes, I've considered that much.  We can create two integral values that have the beginning and ending of the selection text for zero-based indices; it shouldn't be too much trouble.  What I was going for in this case was more the general idea behind the way I think the library should work, more than the general object set.

As far as font objects -- good idea!  I hadn't thought of that.

[edit]Skywing: I found an MSDN article describing the process of laying out and drawing text using Uniscribe.  Wow.  Yes, you were definitely right: it looks like a major pain in the behind.  Thanks for the heads-up.
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.