How to increase label/axis font in WaveletComp's wc.image? - wavelet

The default font size is extremely small (too small for publication), and I read the manual looking for this feature with no luck.

You can set the font size using cex and cex.lab within par()

Related

How to efficiently and correctly resize ID3DXFont

I am looking to resize a DirectX font object in a for loop. See below for an example:
for ( int i = 1; i < 20; i++ ) {
// font size should be i
}
It would be inefficient to create a font for every single possible size so I was wondering if I could create some sort of wrapper or my own font renderer that allows me to do so with good performance?
If I don't make much sense, then see the another example below:
// DirectX9
// calling D3DXCreateFont every loop would be incredibly inefficient.
ID3DXFont *example_font;
D3DXCreateFont( device, 14 /* font size - we want this to change */, ..., &example_font );
How can I achieve this? I tried using scale/rotate/transform to simply change the size but the font becomes blurry so I'm looking for a more "correct" solution.
Thank you.
The problem you are encountering is a fundamental limitation of 'raster bitmap' fonts as opposed to 'vector' fonts like TrueType. D3DXFont is a 'raster bitmap' solution that captures a TrueType font into a bitmap at a specific size. This can be scaled/rotated somewhat and still holds up, but you get artifacts if you change the size a lot as you have seen.
It is extremely fast, however, because it's just drawing textures. You can also capture fonts at a few different sizes and pick one based on the resolution.
D3DXFont is part of D3DX9 which means it is deprecated. Of course Direct3D 9 is legacy too, so you should look at Direct3D 11 and SpriteFont/SpriteBatch in the DirectX Tool Kit for a modern 'raster bitmap' font solution.
The correct solution for high-quality, highly scalable text drawing is to use a 'vector font' drawing system like DirectWrite.

Font size from screen resolution ? portable C++?

I have a C++ application and I use ImGUI for building my UI !
The problem is that on my laptop the default font size is good (default is 13 pixels), but on another computer (with bigger resolution), the text is so small that I can't read it !
I notice that other applications have a "bigger" font in this situation.
So, is there a way to compute a "scale factor" for my font depending of the monitor resolution ?
I'm looking for a portable C++ solution !
Thanks for your help

What size of ImageList icons do I need to make & load for my app (considering higher DPI)?

I have a CListCtrl control (or a ListView in Win32) that is created with LVS_REPORT style.
I am intending to display icons in its items as such:
But the question is what size of icons do I need to make and load?
Let me explain. From the old Win32 samples, I can see that everyone creates image lists with 15x15 pixel icons. But the issue with those is that it looks horribly pixelated on any modern PC with higher DPI settings. Thus I was looking for a dynamic way to determine the appropriate size of image lists for the CListCtrl.
And also the first part of the question, what icon size should I make originally?
EDIT
PS: Since DPI scaling came up, how do you find it out? I'm currently using the following approach:
//No error handling for brevity
HDC hDC = ::GetDC(hAppsMainWindowHandle);
int nCx = ::GetDeviceCaps(hDC, LOGPIXELSX);
int nCy = ::GetDeviceCaps(hDC, LOGPIXELSY);
::ReleaseDC(hAppsMainWindowHandle, hDC);
//I technically get horizontal & vertical scaling --
//can those be different?
double scalingCx = (double)nCx / 96.0; //1.0 = 100%
double scalingCy = (double)nCy / 96.0;
Is font scaling something different?
A list view uses a "small" or "large" image list depending on its mode. In report mode, it uses the "small" image list. You can use GetSystemMetrics() to get the dimensions of "small" images using the SM_CXSMICON and SM_CYSMICON metrics (use SM_CXICON and SM_CYICON for "large" images).
Note that the returned values will be virtual/scaled if your app is not DPI-aware, so to get accurate values, make sure it is DPI-aware via SetProcessDPIAware(), SetProcessDpiAwareness(), or a DPI manifest.
Update: I just ran across this function, might be useful for you when writing a DPI-aware app:
LoadIconWithScaleDown()
Make larger images and let the API scale them down to smaller sizes.
The report style list view wants small icons, that is icons with SM_CXSMICON by SM_CYSMICON metrics. Assuming your app is high DPI aware, then the actual value of these metrics depends on the user's chosen font scaling or DPI setting. So up front you cannot know what size icons should be used. You have to query the system metrics at runtime, and use appropriately sized icons.
Now, what size icons you include in your executable depend on what DPI settings you wish to support. Back in XP days you could reasonably expect to encounter 100% and 125% font scaling. These days, high density display panels are common and you really need to support larger ratios. At least 150% and 200%, and quite probably 175%.
The closest I can find to guidelines is in this MSDN article: http://msdn.microsoft.com/en-US/library/windows/desktop/dn742485.aspx
This article was written around the Vista time frame and already shows its age. I think you have to use these articles as a guide and adapt to the hardware of the day.
You will also find that people run their machines at font scaling values in between the round numbers listed above, and in the article I link to. One of my colleagues runs at 120%. Interestingly this has highlighted various bugs in our code so it's always useful to have someone dog-fooding your program.
When you build your image lists at runtime, size them according to system metrics. And try to avoid scaling icons. For instance, if system metrics suggest an 18px icons, and you only have 16px and 20px icons, then make a new 18px icons. Fill the image with transparent pixels, and blit the 16px icon into the middle of this 18px image. Make the icon out of that. This approach will avoid aliasing problems.

Detect if MFC control has insufficient width to hold text (and text will be truncated)

MFC doesn't have layouts, so controls have to be fixed size and position.
When localizing for a new language, I edit the .rc files directly, but if the text for the new language is longer than the control's width will allow, it gets truncated.
This requires me to do manual inspection of each control to see if it has sufficient width, which is both time-consuming and error-prone.
Right now I'm thinking about adding some code to enumerate all controls, get their text, and see what its width would be, and compare that to the control's width.
Is there a better way?
Actually you can handle this by using following example of layout,
Layout Manager for Dialogs, Formviews, DialogBars and PropertyPages.Check the size of max text and re-arrange controls according to control.Hope it will work.

How to scale font sizes based on current DPI settings in VC++/MFC applications?

How to scale font sizes based on current DPI settings in VC++/MFC applications ?
As of now when I change the DPI from 100% yo 150% the font sizes remain the same, although the icons will scale down based on the current dpi ..
Please suggest the best way for above problem.
In Windows Vista and 7, the OS tries to hide the DPI from your program and does adjustments behind the scenes. If you want your program to react properly to DPI changes you must follow the guidelines from Microsoft titled Creating a DPI-Aware Application.
By specifying the text and control sizes in DLU's. That happens by default though, so I assume you are generating dialogs dynamically or from a memory-based DLGTEMPLATE. If you, you're (pardon my French) screwed, because you'll have to muck about with converting DLU's to pixels, a very painful and tedious process. Read the following KB articles:
http://support.microsoft.com/default.aspx?scid=kb;en-us;125681
http://support.microsoft.com/default.aspx?scid=kb;en-us;145994
Don't use DPI for font scaling. Instead, use the settings the user has configured in the "Appearance" section of Control Panel.
You might also want to consider making the font size configurable for just your application.