Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Programming and Hacking > Development

Reply
 
Thread Tools Display Modes
Old 27th March 2002, 15:15   #1  |  Link
guillep2k
MaestroSBT help
 
guillep2k's Avatar
 
Join Date: Oct 2001
Location: Buenos Aires, Argentina
Posts: 124
How can I improve GDI accuracy to expand/condense fonts?

Hi!

I'm trying to render fonts over a memory bitmap (not to be show on the screen) to be used for DVD subpictures. DVD subpictures are usually 720x480, but are supposed to display in a 4:3 aspect ratio, so I must expand fonts horizontally by 12.5% when using a 1:1 memory device context. My problems are two, as follows:

1) The main problem is the accuracy of the LOGFONT structure. Since I'm typically using -22 as the tmHeight, I'm obtaining AveCharWidths of about 12. A 12.5% increase should give me a new width of 13.5, but since tmWidth is integer, I can only use a value of 13 or 14, which gives me a bad aspect ratio correction. Is there a way of using more precise values (a smaller scale, like tenths of a logical unit) in the LOGFONT structure? I cannot use larger fonts, because then I would have to downscale the resulting bitmaps with a considerable loss of quality (I cannot use anti-alias since the targer is monochrome).

2) I'm using the CreateCompatibleDC function to get a DC to work with, but I have no warranty that the screen DC will give me square (1:1) pixels. How can I get a working DC with the desired pixel shape (aspect ratio)? (If I can do this, point 1 would be covered too).

Thanks in advance,
Guille
__________________
Thompson & Company was a very successful mining company of Wales, until one of the associates died: Henry Company.
guillep2k is offline   Reply With Quote
Old 28th March 2002, 11:28   #2  |  Link
maven
Registered User
 
maven's Avatar
 
Join Date: Oct 2001
Location: DE
Posts: 122
use BitBlt?

render onto an offscreen bitmap and stretch (BitBlt?) when putting them on the screen...
__________________
[maven] - Wavelet Image Compression Library
maven is offline   Reply With Quote
Old 28th March 2002, 14:33   #3  |  Link
guillep2k
MaestroSBT help
 
guillep2k's Avatar
 
Join Date: Oct 2001
Location: Buenos Aires, Argentina
Posts: 124
Well... thanks for your hint, but that's exactly what I should avoid because most of the font hints would be destroyed (I can't perform anti-alias!). However, I found a way:

mdc->SetMapMode( MM_ANISOTROPIC );
mdc->SetWindowExt( 64, 64 );
mdc->SetViewportExt( 1, 1 );

This way I can use font sizes 64 times larger, which gives me enough accuracy when changing the font width. However, this method produced silghtly (but very noriceable) different rendering results... font widths and heights were different for about one pixel, and I wonder why (as if the roundings where different). I'm worried about loosing quality by using this method.

Guille
__________________
Thompson & Company was a very successful mining company of Wales, until one of the associates died: Henry Company.
guillep2k is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:24.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.