I've noticed that my wxWidgets application does not follow the native font sizes on OSX. They are typically too big and also the same font size is used for all widgets, which does not seem to be the case by native default.
I've tried to handle this myself by applying fonts to the top level windows. I've used TinkerTool to read the defaults (should be done automatically of course) and create corresponding fonts, for example using wxFont(wxFontInfo(12).FontName("Helvetica") but it does not render the same as other, native applications.
Does anyone know of a good method to handle this?
I don't know of any examples when wxWidgets controls don't use the same fonts as the native controls, please report any occurrences of this as bugs in the wxWidgets Trac, especially if this is using 2.9.4 (old 2.8 versions use Carbon and are hopeless on modern OS X anyhow). But without any concrete examples I can't really help with this.
As for the font sizes, I think you might be looking for wxWindow::SetWindowVariant() which allows to use smaller versions of the controls which is rather common in OS X UI.
Related
I was reviewing the NOV for Mac OS X development, in my way I found that they have Nevron Writer for Mac, which is built using their SDK (did any one find the Visio-like application for Mac?), and it seems there is a huge problem in performance and rendering. They mentioned that they are supporting native look and feel, but Writer UI rendering is for sure not native. Is it achieving portability by sacrificing native rendering?
Full Disclosure: I work for Nevron
The Nevron Draw product is about to be released in the next couple of weeks, but is currently not available for download although the version is already built. We are now updating the Nevron Office site (www.nevronoffice.com) and it will soon contain information and downloads for Nevron Draw.
Regarding performance and rendering. What machine are you running the program on? NOV UI for Mac is very fast and in many aspects I would even say faster than native Mac UI controls.
Regarding native look and feel. We do not use native controls in NOV – the look and feel is made to resemble Mac via CSS. We are going to release a new and updated Mac theme very soon. There are many reasons for which we do not use native controls, including:
Portability - native controls are not portable and we support a large set of integration platforms. Achieving 100% single code base for Windows, Mac and other platforms is impossible with AWT like toolkits that use native controls.
Common denominator problem – the more platforms that you support means that toolkits that use native controls will suffer features, as all controls are very different on each platform. NOV UI is on the other hand very feature rich and we provide identical functionality for all users on all platforms.
Right now, I am using wxpython to make a UI. But I find out that under windows invironment, the four corners are all angles.
Is it possible to change the form of the four corners and make them more smooth like this?
Short answer: no.
WxPython is based on WxWidgets and, as you can see on WxWidget's homepage:
Unlike other cross-platform toolkits, wxWidgets gives its applications a truly native look and feel because it uses the platform's native API rather than emulating the GUI
Basically this means that WxWidgets and, by extension, WxPython are great choices if you want to design cross platform GUIs that automatically conform to each platform's GUI style. The downside of this is that it is not the best choice of toolkits if you want to make custom GUI elements, like those rounded corners.
I'm not too familiar with Tkinter (another popular Python GUI toolkit) but this previous SO question seems to be exactly what you want. Perhaps you should experiment using Tkinnter instead of WxPython.
----EDIT----
It turns out I was wrong. There IS a way to do it in WxPython, as evidenced by this SO question. However, I maintain that WxPython is best suited to native-style windows and if you want to make completely custom UIs then you'll find better support working with another toolkit.
I'd like to develop a desktop app with Ruby. However, I'd like to have a native GUI on every platform (as opposed to a cross-platform GUI Toolkit that looks consistently awful across all platforms).
I expect to have to do different GUIs for each platform (as it's not just looks but also behaviors and idioms that are different), but I wonder what my options are? Especially wondering if there is a clean way to separate front and backend and bind the data properly?
Target Platforms are Windows (Vista & 7, XP is a Bonus), Mac OS X (Cocoa) and Linux (GTK? Qt? No idea).
The Ruby language has excellent Qt library bindings and your scripts will be cross-platform.
Two Kinds of Cross-Platform
It turns out there are two kinds of cross-platform UI toolkits.
One kind draws its own controls, and, like you said, looks equally bad on all platforms. Even worse: it looks out-of-place on all except one.
But there is another kind that just provides a harmonized interface to the native widgets. The best of example of this kind of toolkit is SWT1.. It looks, it is, approximately fully native on each platform, yet it has but a single API.
So you shouldn't simply rule-out all cross-platform toolkits, just rule out the ones that fake the native UI.
Develop the Wrapper Interface
There is a second way. If your program's interface with the user can be directed through a relatively narrow interface, you can simply develop to that interface and then implement the bottom part of it for each platform you want to support. Yes, you have to rewrite one module, but all the other modules stay exactly the same and you get native widgets. You also get the smallest possible executable without lots of bloat.
Perhaps most importantly, you don't have a complex and opaque software layer between your code and the native windowing system. You will probably save as much time debugging as you spend writing the extra module for your first port.
1. I know my Java examples won't help you much unless you are using jRuby, but SWT vs Swing is a really pure example of the right-vs-wrong (IMHO) UI toolkit divide.
The WxWidgets interface claims to use the native interface on Windows, OS X, Linux and UNIX through one API.
Coworkers who have used it in the past enjoyed it well enough, but I've not used it myself.
After a long evaluation period of mainstream toolkits Qt, WxWidget, GTK i came to the conclusion that it does not make sense to religiously equalize the different platform. Now more then ever before.
In the days before Java portability meant, that platform dependent code was located in known places and should be small but not none. No write once, run everywhere marketing.
Is there any GUI tookit - experimental or commerical (even outdated or dead projects) - that is going this way. It would need to give me native widgets of course. I would like to have a look at them before i start my own toolkit
If you think this is a stupid idea tell me why (cause everybody else is doing it differently there may be a reason i don't see)
As someone who zealously believes that GUIs should be drawn with native widgets, I must say I've been very impressed with wxWidgets, although you mention that at the beginning.
As far as I know, wxWidgets uses native widgets whenever possible, and indeed it does also include platform-specific features that are neither possible nor relevant on other platforms. A good example of this is how you can use the native Mac OS X menu, while on other systems it won't do squat. There are other and better examples.
I must mention wxPython in particular, in case you either don't want to or just don't have the time to write a C++ program. wxPython astonished me when I tried it out first, and I even managed to make a stand-alone .exe file from it that worked on a fresh install of Windows 2000 without any updates or particular runtime environments.
If wxWidgets doesn't suit your needs, I wonder what would. :) Hurray for wxWidgets!
AFAIK, wxWidgets uses the platform's native widgets whenever possible.
Have a look at SWT, it tries to use the widgets of the underlying platform as much as possible.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I love the way Mac OS beautifully renders fonts (not just browsers). I was wondering if we could somehow get the same rendering in browsers running on Windows?
Someone recommended sIFR but I guess that's useful when I need to use non-standard fonts?
Check out GDI++/FreeType (link, link). It's a highly configurable font-rendering replacement for Windows. With some configuration of hinting, anti-aliasing, etc, you should be able to approximate OSX style font rendering fairly close.
use mactype
https://github.com/snowie2000/mactype
Not sure if this is a setup, but of course, Safari on Windows renders using the OS X rendering algorithm.
Brad is right: use Safari if you want the Mac font rendering algorithm.
Jeff and Joel have both blogged about this before (not surprisingly, around the time that Safari was released for Windows), if you would like more details:
http://www.codinghorror.com/blog/archives/000885.html
I'm assuming you would like to be ablt to use if globally, or at least in IE/Firefox, not just be installing Safari as other have suggested.
Back in the days wen Mac OS X was still in development, there was a plan to release the Cocoa framework for windows, to allow applications written to it to run natively on Windows with a recompile. I suspect that set of Cocoa windows libraries (Yellow Box wasn't it?) would have given you Mac OS X style font rendering but I don't think it was ever released (though you may be able to get very old beta versions of it from somewhere, and I have a feeling some of it was somehow part of WebObjects or something like that).
I suspect the windows version of Safari is using an internal version of the Cocoa libraries for Windows, whcih is why it has Mac OS X font rendering (though I believe recent nightly builds at least have the option to use Windows' native font rendering for those who were complaining about it looking out of place).
Anyway, long store short, unless you're going to write your own font renderer, I don't think there's any easy way to do it (other than using Safari)
Someone recommended sIFR but I guess that's useful when I need to use non-standard fonts?
sIFR will not give you the intended effect. Like Windows's ClearType, Flash's anti-aliasing (which sIFR uses) optimizes towards the pixel grid, not towards accurate representation of the typeface.
You may be able to use Safari's bundled CoreGraphics library to do your font rendering, but you'd likely break Apple's license agreements (especially once you try to ship your app…).
I'm writing a Java application doing some interesting things with fonts and working with some graphic designers, and they want the same kind of font rendering you're talking about. I was able to get pretty close by turning on fractional metrics aka sub-pixel glyph placement accuracy, and anti-aliasing, which are the key differences between Mac and Windows font rendering. Looks pretty good for larger TrueType fonts.
Here's the Java code I used. It's all done with their native font rendering engine (which I believe may be FreeType, not sure exactly).
g.setFont(new Font("Century Schoolbook", Font.PLAIN, 36));
g.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS,
RenderingHints.VALUE_FRACTIONALMETRICS_ON);
g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
Now if only I could figure out how to make OpenType CFF fonts work.
Microsoft Powertoy Cleartype Tuner lets you tweak the way Cleartype works. It might help a little bit. Not sure it works on anything newer than Windows XP though.
You could wait until IE9, which apparently has much better text rendering, using DirectX: http://blogs.msdn.com/ie/archive/2009/11/18/an-early-look-at-ie9-for-developers.aspx
If you want mac osx rendering in firefox, you must use extension Anti-Aliasing Tuner:
https://addons.mozilla.org/firefox/addon/anti-aliasing-tuner/
Just set anti-aliasing mode as Default and rendering mode as Outline for small and large fonts and you're done.