David's Notes of Juce Library - help and solutions

[color=#008000]Juce is a great gui I ever seen!
Thank you, jules!

sorry for my poor English. :wink:

I am try to using Juce’s GUI and misc library, and in future maybe I will add some features on it.
audio library is not necessary for me, so I remove the audio relative files in the source tree.

I will make my notes in this post,such as questions, solutions,etc.
[/color]

Glad you like it!

Sounds like making life difficult for yourself. I’d say just ignore them - you can disable all the audio devices and formats with config flags, if you’re worried about it bloating your exe. (TBH I could probably add a config flag to disable audio code too, that might be useful for a lot of people)

help!
my first question is the font problem.
I want the components could support Chinese character display, but I couldn’t find a good place to modify the components’ font.

the button component:

/** This can be overridden to use different fonts than the default one.
        Note that you'll need to set the font's size appropriately, too.
    */
    virtual const Font getFont();

it seems I could modify the font here, I write a derived class TestTextButton override getFont and it works.
but when I check LookAndFeel::drawPopupMenuItem()method, the getPopupMenuFont() method is a member of LookAndFeel,
if I want to modify the font I could modify LookAndFeel, not derive a popupmenu class.

const Font LookAndFeel::getPopupMenuFont()
{
    return Font (17.0f);
}

I try to modify the Font class’s constructor, so the default typefacename will be other font that support Chinese, but I modify

const String Font::getDefaultSansSerifFontName() throw() { static const String name ("<Sans-Serif>");//modify here with "<宋体>" return name; }
but it doesn’t work.

so, is there a better method to modify the components’ font, or in a general way?
what can I do to change the font?
Thank you.
which is better?

A custom look+feel is the best way to do it.

Thank you!
I will do it in custom Look+Feel way…

I found that override

or modify

could change the default font, and so all the components could display Chinese character.this is the easiest way to support unicode character display
right?

Do not modify juce code. It might cause problems later. Instead over-ride the look and feel method.

just modify a little, I think this will be OK. 8)

I want to improve the text display effect on Win32 platform, maybe I will change the drawing code to native gdi/gdi+ api, currently the text performance is not as good as native api…

“improve” is a subjective term. Personally, I’ve always hated MS’s font renderer because it doesn’t use sub-pixel spacing. I think that may have changed with Direct2D, so when I add support for that, I’ll also try their font rendering, but I’d advise you to steer well clear of the piece of crap that is the GDI/GDI+.

I am sorry if I kind of ‘hurt’ you.
your code is great but I found that with MS’s Clear Type, the text rendering effect is greatly
improved.
[attachment=0]clear type juce.PNG[/attachment]
And I want to use Clear Type in Juce,may I ,how could I do?
Thank you, dear Jules. I just write a little and then get your reply, you are so good.

Don’t be silly!

Cleartype does look good, but it’s the non-subpixel spacing that I’ve always hated. (I think that might be sorted out now in Windows 7…?) Anyway, the only way to use it would be to create a Direct2D renderer like I did on the mac with CoreGraphics.

After a long time’s disappear, I am back again!
for some reason I didn’t came here for about a month, but now I have get my time, and I will continue to learn and develop juce library.

updated:
http://www.drdobbs.com/blog/archives/2010/09/jolt_awards_and.html
Congratulations!
Juce is a really very good very powerful library, and I love it!

Be glad to hear that juce 1.52 has been released.
I will check it out soon.