GDIPlus font size

Hello!

When I have a text rendered by GDIPlus, the font appears smaller than 
with GDI.
Does anybody know why and how I can make it so that GDIPlus renders the 
text in the same size as with GDI?

Thanks
Dimi
0
Dimitri
12/7/2009 5:16:46 AM
vb.general.discussion 1016 articles. 0 followers. Follow

4 Replies
1150 Views

Similar Articles

[PageSpeed] 3

"Dimitri Kowaletschew" <dimi.k@yahoo.com> wrote in message 
news:eVfRKyvdKHA.5156@TK2MSFTNGP04.phx.gbl...

> When I have a text rendered by GDIPlus, the font appears
> smaller than with GDI. Does anybody know why and how
> I can make it so that GDIPlus renders the text in the same
> size as with GDI?

How much smaller? I don't actually use GDI+ myself but I suspect that there 
are bound to be some differences in the size and spacing of the output 
because of the different rendering system, although I wouldn't expect the 
difference to be a lot. Are you sure you are not passing the GDI+ function a 
point size but specifying pixels rather than points as the measuring units?

Mike



0
Mike
12/7/2009 9:24:08 AM
"Dimitri Kowaletschew" <dimi.k@yahoo.com> wrote in message 
news:eVfRKyvdKHA.5156@TK2MSFTNGP04.phx.gbl...
> Hello!
>
> When I have a text rendered by GDIPlus, the font appears smaller than with 
> GDI.
> Does anybody know why and how I can make it so that GDIPlus renders the 
> text in the same size as with GDI?

Besides Mike's suggestion, maybe it's the same size, but Anti-aliasing was 
used which makes it look smaller.


0
Nobody
12/7/2009 11:32:26 AM
Thanks, yes, I was using points...

> "Dimitri Kowaletschew" <dimi.k@yahoo.com> wrote in message 
> news:eVfRKyvdKHA.5156@TK2MSFTNGP04.phx.gbl...
> 
>> When I have a text rendered by GDIPlus, the font appears
>> smaller than with GDI. Does anybody know why and how
>> I can make it so that GDIPlus renders the text in the same
>> size as with GDI?
> 
> How much smaller? I don't actually use GDI+ myself but I suspect that 
> there are bound to be some differences in the size and spacing of the 
> output because of the different rendering system, although I wouldn't 
> expect the difference to be a lot. Are you sure you are not passing the 
> GDI+ function a point size but specifying pixels rather than points as 
> the measuring units?
> 
> Mike
> 
> 
> 
0
Dimitri
12/7/2009 12:13:55 PM
I seem to be stuck... There are several places in my code where I could 
set the size, but the one function that actually does set the size 
doesn't want any parameters that define the Unit of the font size...
Does anybody see where else I should define UnitPixel?

Thank you
Dimi

    ' Initializations
    GdipCreateFromHDC lhdc, graphics   ' Initialize the graphics class - 
required for all drawing

       borderCount = 2

       GdipSetSmoothingMode graphics, SmoothingModeAntiAlias

    ' Set the Text Rendering Quality
    'GdipSetTextRenderingHint graphics, TextRenderingHint

    ' Create a font family object to allow us to create a font
    ' We have no font collection here, so pass a NULL for that parameter

    GdipCreateFontFamilyFromName obj.FontName, 0, fontFam
    GdipIsStyleAvailable fontFam, FS, IsAvailable

    If IsAvailable = 0 Then
       Dim Msg              As String
       Msg = "Font family " & _
          obj.FontName & _
          " NOT available under GDI+"
       MsgBox Msg
       Exit Sub
    End If
    ' Create the font from the specified font family name
    ' >> Note that we have changed the drawing Unit from pixels to points!!
    FS = FontStyleRegular 'not really needed since it's zero
    If obj.FontBold Then FS = FS + FontStyleBold
    If obj.FontItalic Then FS = FS + FontStyleItalic
    If obj.FontStrikethru Then FS = FS + FontStyleStrikeout
    If obj.FontUnderline Then FS = FS + FontStyleUnderline

    GdipCreateFont fontFam, 0, FS, GpUnit.UnitPixel, curFont
    ' Create the StringFormat object
    ' We can pass NULL for the flags and language id if we want
    GdipCreateStringFormat 0, LocaleID, strFormat


    ' Justify each line of text
    GdipSetStringFormatAlign strFormat, Alignment Mod 3

    ' Justify the block of text (top to bottom) in the rectangle.
    GdipSetStringFormatLineAlign strFormat, Int(Alignment \ 3)

    GdipCreatePath FillModeWinding, path

    GdipAddPathString path, _
       sText, -1, _
       fontFam, _
       FS, _
       24, _
       rct, _
       strFormat

     LSet box = rct

     rct2 = SetGradientRectF(box, 
LinearGradientMode.LinearGradientModeVertical, 1, True)
     GdipCreateLineBrushFromRect rct2, _
        StartColor(3), _
        EndColor(3), _
        GradientMode(3), _
        WrapModeTileFlipX, brush
     GdipSetLineGammaCorrection brush, Gamma(3)

    If brush Then
       GdipFillPath graphics, brush, path
       GdipDeleteBrush brush
    End If
0
Dimitri
12/7/2009 5:13:03 PM
Reply:

Similar Artilces:

CDHtmlDialog and large fonts: Am I in hell?
Howdy, I'm writing an app which uses html hosted by CMultiPageDHtmlDialog. My problem is that the html (given to me by designers using Front Page 2003) breaks when the user selects large fonts. I note that in standard 96dpi mode that the base dialog units are 8 and 16, while with 120dpi large fonts they are, as you'd expect, 10 and 20 (i.e. 20% larger). Is there a way to force my dialog to use the same base units for both font size settings? For reference, here is the dialog resource from my rc file which describes my dialog box: IDD_ABOUTBOX DIALOGEX 0, 0, 235, 55 STYLE DS_SETF...

Format fonts (ie, initial cap) in Excel like you can in Word.
Why is the formatting of fonts in Excel limited compared to Word? I have a document that has "descriptions" and we want to initial cap the verbiage. The only way that I know to do it is to go in and either delete and re-type the letter or use the Insert feature. It would be nice to be able to click an entire column, click Format, Font, Change Case, Initial Cap like you can in Word. Talk about saving keystrokes!!!! Thank you. ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion,...

size of device context limit ?
Hi I am developping the HID KMDF minidriver. It need to have many parameters in device context. But I do not know the limitation of device context. Tell me about the size limitation. > I am developping the HID KMDF minidriver. > It need to have many parameters in device context. But I do not know = the=20 > limitation of device context. Tell me about the size limitation. I don't think it is limited except by the total OS's nonpaged memory. --=20 Maxim S. Shatskih Windows DDK MVP maxim@storagecraft.com http://www.storagecraft.com Thanks Maxim. I unde...

After disk cleanup Microsoft Word has no fonts
I did a disk cleanup yesterday due to a small amount of space on my hard drive. However I have been trying to open word doc and adobe doc and they are blank saying something along the lines of "fonts not available". So i opened the control panel>fonts and clicked right clicked on one saying 'open'. Then word opens with a box saying "File Conversion - BOD_B.TTF". then it says "select the encoding that makes your document readable: Text encoding- Windows default or MS_DOS or Other encoding I click windows default and a whole lot of jibberish comes up on...

Create a Table with uniformed sized cells?
I am making a calendar withy calendars inside it. I need to lock the size of the cells in the table and can't seem to figure out how.... You can't lock the cells. You could place the main calendar on the Master Page... Or adjust the cells how you want them, copy the table, paste special as an image. -- Mary Sauer MSFT MVP http://office.microsoft.com/ http://msauer.mvps.org/ news://msnews.microsoft.com http://officebeta.iponet.net/en-us/publisher/FX100649111033.aspx "ATG Maggie" <ATG Maggie@discussions.microsoft.com> wrote in message news:832802C9-0CC9-459A-A9E6...

Continuous Form Scrollbar Thumb Wrong Size
I have created a continuous form in Access 2003. When I use it as a subform and update it with new query results, the scrollbar thumb is initially the wrong size (too small). Dragging it eventually fixes the problem, but is there a way to do this programmatically instead? Someone suggested I use Form.Refresh and/or Form.Repaint upon Form Load, Update, etc. but that's not helping. Clues welcome/appreciated! - Joe Joe D'Andrea wrote: >I have created a continuous form in Access 2003. When I use it as a >subform and update it with new query results, the scrollbar thumb is >i...

gdi+ and postscript opentype fonts (.otf)
it looks like some gdi functions(ex. Font->GetFamily) just don't work with postscript opentype fonts. And I read an article on the internet that says gdi+ doesn't work with postscript opentype fonts at all...:( is there anyway I could use gdi+ and postscript opentype fonts? (so I could display postscript opentype fonts on the screen) thanks ...

The 'sizing handles' on the axis titles don't work!!
I'm working with a column chart in Excel - I'm trying to resize the title box of the y-axis, but I can't. When I double-click, I see the thick line and the dark boxes of the sizing handles. However, when I try to use these, I get no double-headed arrow and can't resize the box. I can move it around, but that's all. I can't resize the chart title and x-axis titles either. Weirdly, I CAN resize the legend box. Anyone know how I can fix this? Nicole, Unfortunately the only way that you can resize the title box is to change the font size. You still get the borders...

Web preview changes font size
In Publisher 2002, web preview displays text box about 10% smaller than in normal Publisher view. Clearly shows when text box has a border. I fill the text box with text (or change text box size just to fit text) but in Web preview, the box remains the same size but text box now is not full. and gaps appear on page between the text box and items below it. Only height is affected suggesting either character height or line spacing has changed. Autofit is set to NONE but setting seems to have no effect This problem does NOT occur when creating with Publisher 2000 but problem and gaps occ...

Font Size
Hi all, How to set text size to 64*64 pixel? Thanks. Peter You can change the font by using SetFont. Give whatever size you want to the font and make sure it is valid as long as it is being used. Typically you will make it member of the window/parent window in which its being used. -- Ajay Kalra [MVP - VC++] ajaykalra@yahoo.com "WANGYM" <wangym@sytux.sh.cn> wrote in message news:OxiEJOhZDHA.2284@TK2MSFTNGP12.phx.gbl... > Hi all, > > How to set text size to 64*64 pixel? > Thanks. > > Peter > > This is a multi-part message in MIME format. -----...

Word/Excel 2003 Decorative Fonts
Hi, For a while I've been using Word 2002 to produce a report from a linked Excel 2002 spreadsheet. This involves a couple of tables using the tick and cross symbols from Wingdings 2. I've just moved the system to a new computer running Office 2003. The data still updates perfectly but whenever I format with a decorative font (ie Wingdings 2) I just get a table full of seemingly random symbols (usually the NULL symbol). It works fine if I use ANY non-decorative font. If anyone has any ideas I'd be extremely grateful! Cheers, Laurence Pawling ...

Formatting
I received a pub doc from a third party. It was formatted as a 11x16 size. Once I decreased it to 8.5x11 and view the doc under 'print preview' the entirety of the image did not view. Basically, the image didn't shrink with the size. Any input? Patty wrote: > I received a pub doc from a third party. It was formatted as a 11x16 size. > Once I decreased it to 8.5x11 and view the doc under 'print preview' the > entirety of the image did not view. Basically, the image didn't shrink with > the size. Any input? Publisher doesn't resize the contents o...

How do I increase the size of my Query
The default number of columns on my Access database is 24. Can this be expanded to 40? Thanks The number of columns can be increased up to 255, but I don't believe the default can be changed. You can select multiple columns at one time and then use the insert Columns menu item to add that number of columns. == Click on the narrow gray bar at the top of the column and while holding down the mouse button drag left or right to select multiple columns == Select Insert Columns from the menu John Spencer Access MVP 2002-2005, 2007-2010 The Hilltop Institute University of Mar...

2007 Pub Printing Custom Paper Size
When setting paper size to 5.75 wide by 8 high (for invitation stock), the content of the page prints too low, whether existing pub file or create from scratch. Same problem on every PC in school. Latest HP4200 driver. To print had to drag content up page past the top edge of the paper. Any ideas why and how to fix? -- Paul J Do you have both Publisher and the printer set for that size paper? -- JoAnn Paules MVP Microsoft [Publisher] Tech Editor for "Microsoft Publisher 2007 For Dummies" "Paul" <Paul@discussions.microsoft.com> wrote in message news:74...

Wrong Email Size
Hi, I am using Outlook 2003 with Exchange 2003 (service pack 2). I have noticed that the size of emails with attachments are being displayed incorrectly. For example, there is an email with a pdf document (3MB) and a word document (800kb) and 4 lines of text in the body of the message - total size of 4MB. However, outlook 2003 is displaying the email size as 11MB. When I copy or move this email to a new folder the email size is displayed correctly as 4MB. Service Pack 2 for Exchange 2003 was installed last week on the exchange server. Is this a bug in SP2? Is there a fix available for this ...

Times New Roman font problem
OS: Vista Home Premium 64-bit with Office 2003 When a client asked me to do a document using Times New Roman 12, I discovered that Vista did not have that font (it didn't appear in my font list nor was it available in Word), so I downloaded and installed it from a file called Times32.exe. I had to manually extract the TTF files from the archive because running the exe didn't install the font, even though the installer said it had. When I used Vista's Add New Font and specified the actual TTF files, Vista said they were already installed, and THEN Times New Roman appeared ...

Outlook .pst file
It appears that the .pst file keeps growing and growing and growing. Even after "emptying" my deleted items folder (which had about 400 messages in it) the size of my .pst file stayed the same. Can anyone tell me how I can reduce the size of it...without archiving? Again, you'd think that if you got rid of mail, it would get smaller, but that's not the case. Thanks, Greg PSTs do not reclaim space properly on their own. Right click the top level folder and choose properties. Click the Advanced button. Click the Compact Now button. Do this three times. Som,etimes the ...

Script font "Rose Round"
To all who answered my request for "Rose Round", very many thanks. Through the good offices of some of them I now have the font. My apologies to those who I inadvertently upset. John. =================================== ...

Print scaling with GDIPlus
Hi, After lots of experimentation I finally got printing working as expected under GDIPlus. However, I had to use a fixed value for printing to a real printer which I didn't have to use for normal display or print preview: Gdiplus::Graphics graphics(pDC->m_hDC); double dpix = pDC->GetDeviceCaps(LOGPIXELSX); double dpiy = pDC->GetDeviceCaps(LOGPIXELSY); int test_1 = ::GetDeviceCaps(pDC->m_hDC,LOGPIXELSY); int test_2 = ::GetDeviceCaps(pDC->m_hAttribDC,LOGPIXELSY); if (test_1 == test_2) { graphics.ScaleTransform(100/dpix,100/dpiy); } Can anyone explain wh...

Getting Mailbox Sizes in 5.5
This is a multi-part message in MIME format. ------=_NextPart_000_000C_01C66CFC.93298CD0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Working on an Exchange 5.5 to 2K3 migration. Is there any easy way to = get a list of mailboxes with their sizes from the Exchange 5.5 = directory? I know I can use System Admin to see each server and then = export the list, but is there a way to this, maybe with a script so I = don't have to export the list from each server separately? Thanks. Jerry ------=_NextPart_000_000C_01C66CFC.93298CD0 Co...

file size
I just converted from Quicken, Q2003 to Mny2004. I have data going back to 1994 insofar as investment transactions and to 1999 insofar as my check register. The size of my Money is 41 MB. Quicken usally runs about 5-6 MB for a file normal file this size. I have no problem with the large file but I just wondered if it was more or less normal. I converted a quicken file that was somehow messed up and had started growing and reached 140 MB. It was impossible to fix it with Quickens antiquated Qif file export/import setup so I converted to Money and it converted without a hitch and was reduc...

how to change font on printed copy of outlook calendar week view
When I print out my calendar by the week the font is too small. I can't find how to increase the size of the font so it PRINTS larger. I could change it on the view of the calendar but it doesn't change on the print preview. Randi Steiger;110316 Wrote: > When I print out my calendar by the week the font is too small. I can't > find > how to increase the size of the font so it PRINTS larger. I could > change it > on the view of the calendar but it doesn't change on the print preview. Which version of Outlook? Did you check the page setup options w...

How do I create an A3 size document using Windows 7
A3 is not listed in the pre-set schedule of document sizes in Windows 7 (unlike previous versions of Windows). How do I create such a document using Windows 7? Does your printer support A3? Word/Windows will display the paper sizes supported by the default (or currently active) printer. -- Suzanne S. Barnhill Microsoft MVP (Word) Words into Type Fairhope, Alabama USA http://word.mvps.org "A3 documents in Windows 7" <A3 documents in Windows 7@discussions.microsoft.com> wrote in message news:F2647F06-5560-41A6-9C2F-462E6198C989@microsoft.com... > A3 is ...

.xls changes sizes from one computer to another
An excel worksheet that we use prints out nicely on one computer; however, when another user accesses it off of the network and does a print preview, the columns of the worksheet squash together in the middle of the worksheet into and only by reducing the view by 99% is the second user able to print correctly. I don't know the circumstances regarding this but I am told this is the way it has always been. Any input would be greatly appreciated. ...

Default font comes out white in Outlook 2003
The font color in my signature and text in my email comes out white even though all is set to black. How can I correct this? ...