Getting font properties

I have a LOGFONT - complete with all desired properties including face name.

I use CFont::CreateFontIndirect() to create a font.

If the font I have specified is not available on my machine then it uses the 
nearest available in some appropriate sense.

So far so good.

But CFont::GetLogfont() just returns me the LOGFONT which I used to create 
the font, and not the one it actually adopted - in particular as regards 
face name.

Is there an easy way to get the face name of the font it actually used?

Dave
-- 
David Webber
Author MOZART the music processor for Windows -
http://www.mozart.co.uk
For discussion/support see
http://www.mozart.co.uk/mzusers/mailinglist.htm


0
dave1 (356)
11/1/2006 8:38:30 AM
vc.mfc 33608 articles. 0 followers. Follow

4 Replies
804 Views

Similar Articles

[PageSpeed] 29

"David Webber" <dave@musical.demon.co.uk> wrote in message 
news:emo1mEZ$GHA.4568@TK2MSFTNGP04.phx.gbl...
> Is there an easy way to get the face name of the font it actually used?
>

David, try this:

// Get LOGFONT of hFont
LOGFONT lf;
GetObject (hFont, sizeof(lf), &lf);


-- David
http://www.dcsoft.com



0
dc2983 (3206)
11/1/2006 1:21:24 PM
"David Ching" <dc@remove-this.dcsoft.com> wrote in message 
news:ob12h.18829$TV3.2973@newssvr21.news.prodigy.com...


> David, try this:
>
> // Get LOGFONT of hFont
> LOGFONT lf;
> GetObject (hFont, sizeof(lf), &lf);

My guess was that CFont::GetLogFont() would be a thin wrapper around that 
one.  I haven't checked but MFC is usually like that.

In the end selecting it into a DC and using

GetOutlineTextMetrics()

does the trick.   I'm starting to wonder if creating the font doesn't make 
all the final decisions and that you have to load it into a DC for those to 
be made?

Dave
-- 
David Webber
Author MOZART the music processor for Windows -
http://www.mozart.co.uk
For discussion/support see
http://www.mozart.co.uk/mzusers/mailinglist.htm 


0
dave1 (356)
11/1/2006 3:45:14 PM
"David Webber" <dave@musical.demon.co.uk> wrote in message 
news:OzMc7zc$GHA.2328@TK2MSFTNGP02.phx.gbl...
>
> My guess was that CFont::GetLogFont() would be a thin wrapper around that 
> one.  I haven't checked but MFC is usually like that.
>

You're right, it is.


> In the end selecting it into a DC and using
>
> GetOutlineTextMetrics()
>
> does the trick.   I'm starting to wonder if creating the font doesn't make 
> all the final decisions and that you have to load it into a DC for those 
> to be made?
>

Apparently so... see http://www.kbalertz.com/kb_230342.aspx

Learn something new every day!  :-)

-- David


0
dc2983 (3206)
11/1/2006 5:50:02 PM
"David Ching" <dc@remove-this.dcsoft.com> wrote in message 
news:e752h.24217$e66.2521@newssvr13.news.prodigy.com...

>>...   I'm starting to wonder if creating the font doesn't make all the 
>>final decisions and that you have to load it into a DC for those to be 
>>made?
>>
>
> Apparently so... see http://www.kbalertz.com/kb_230342.aspx
>
> Learn something new every day!  :-)

Thanks - it's nice to have the confirmation!

Dave
-- 
David Webber
Author MOZART the music processor for Windows -
http://www.mozart.co.uk
For discussion/support see
http://www.mozart.co.uk/mzusers/mailinglist.htm


0
dave1 (356)
11/1/2006 6:04:17 PM
Reply:

Similar Artilces:

Why is font so small in the autofilter dropdown
I activate autofilter in excel. The font in the drop down is too small to read. What's the fix? These are spreadsheets I receive from other people. But, not all spreadsheets from others. The common fix is to change the zoom to something bigger. gary2582 wrote: > > I activate autofilter in excel. The font in the drop down is too small to > read. What's the fix? These are spreadsheets I receive from other people. > But, not all spreadsheets from others. -- Dave Peterson ...

CRichEditCtrl
Hello I need a control that shows plain text and active links. CRichEditCtrl seems ideal for the tasks. The links are detected after calling SetAutoURLDetect. But there is one thing I can't master: the pasted text preserves the original character attributes. I would like to have text shown in one format (one font family, height). I could change attributes of the entire text after each paste operation but I can't find the way to catch the paste event inside the control. I tried with ON_CONTROL_REFLECT with WM_PASTE and ID_EDIT_PASTE with no effect. I also found a way to implement ...

PiVot Table Formatting
I have a PiVot Table like this: Product ID Factory Sales 100 A 500 B 500 S 200 100 Total 1200 101 A 500 B 500 S 200 101 Total 1200 I want the the raws with total are in bold font. How can I do it? Thanks in advance. To enable selection -- On the Pivot toolbar, choose PivotTable>Select Click on Enable Selection To format the subtotals -- Move the pointer to the left edge of a subtotal heading in the pivot table. When the black arrow appears (like the one that appears when the pointer is over a row button), click to select all the subtotal rows for that field in the pivot table...

Failed to get language error...
but I only get it on weekends. It seems to be tied to the warmup script I am running for SharePoint/Project 2007. The script hits these pages: /Pages/default.aspx /project/default.aspx /project/_layouts/pwa/admin/admin.aspx /10887/ every 10 minutes. This seems to be the timing of the errors on the weekend. What I don't understand is why it only happens on the weekend. The servers are under virtually no load during the weekends. ...

How does money get its data?
I bank with Navy Federal Credit Union and I am *trying* to adapt to MS Money plus (demo right now) from scattered use of Quicken. I'd like to learn how money gets my bank information so I can make an educated call/complaint to the credit unions technical group about the data I am getting. I am currently testing two mny files, one automated and one manual. Today with NFCU, when I do their recommended manual method by signing on to the website, selecting a date period then importing a QIF file, all the transactions show up as "POS Debit Visa - Acct#last4" and no other in...

Publisher 2003 does not show all fonts
Greetings All, I have a problem that I think is related to the "Font Schemes" of MS Publisher 2003. The facts: Have MS publisher 2003 installed. Have many, mnay truetype fonts installed on the system All my truetype fonts show up in fonts list under MS Word, Excel, etc. I have a web site that I created using one of the MS Publisher templates. The problem: When I open the web site that I created (opne the .pub file) to edit it, only a few fonts show up in the drop-down list. I think the Font Scheme of the templat ethat I chose is limiting the fonts that are displayed, but fo...

getting rid of parenthesis
What would be the easiest way to get rid of parenthesis surroundin words in a specific column. I have a column that contains about 1000 rows and each word or words i the column is surround by parenthesis. If there is more than one wor in the column - the parenthesis is before the first word and after th last word - not around each word. I want to get rid of the parenthesis without having to manually go t each row in the column and delete them. Is this possible -- Message posted from http://www.ExcelForum.com Use Replace. Select Column Press Crtl+h In the replace field type in a parenth...

Reply font color, Outlook 2000
A user just asked me if I could set her Outlook 2000 to use the default blue color when replying. When I checked, it was already set to use blue when replying & forwarding. I tested the feature on any number of messages in her inbox, and when replying to any of them, the font was blue, which is correct. But one particular message, it will not use blue...it uses black every time. It does not appear that stationary is used in that message, but just in case, I set the option to *always* use her font settings. Her reply text still shows in black. In this particular case, the reply color ...

getting the pictures from the example databases
hi, I just started to use the new access 2007 and downloaded the example databases from microsoft. they all have pictures in pictureboxes and in the controls so that the design looks great. But how the hell do I get these icons, bmp's, png's so I can use them. thanks ...

I can't seem to get Outlook 2007 working
I am running Office 2007 with Vista. I have recently tried to get Outlook 2007 working but when I use the wizard to set it up with POP3 etc and the usual incoming server details (which are all correct) it won't accept my password/login for my mail server. I know it is all correct but it just won't go on to set up. Any ideas? In article <A6D9D38F-2CC7-4B6B-82B4-D186D8761C3F@microsoft.com>, Richard@discussions.microsoft.com says... > > I am running Office 2007 with Vista. I have recently tried to get Outlook > 2007 working but when I use the wizard to set ...

Table of contents font problems
Using word 2007, I have been trying to change the font of my table of contents. It is set at times new roman but the TOC displays arial (and in a different size). I have tried to modify the style via the TOC style in the style gallery and also by references>table of contents>insert table of contents>modify and it is set at times new roman but still inserts it as arial. I have not directly formatted my headings but used the default heading styles. I don't know what else to try? Check that the headings that are being collected by the TOC, i.e. Heading 1, Heading 2, e...

Updating a field property
This is probably simple, but I'm stuck. On a form..... ......Fields "A", "B", and "C" all have a green backcolor ......A value is entered into field "A" ......Field "B" is updated via a DLookup ......If field "B" contains a certain string, I would like to set the Backcolor of field "C" to white (16777215) I set the backcolor of field "B" to white using Conditional Formatting, but that won't allow me to use multiple fields (to check the value of a different field than the one selected). I've tri...

Default font
A Visio stencil full of shapes has a default font associated with each shape that follows it into a drawing. E.g. Flowchart forms carry Ariel 8. Is there a way to change this default to a different font and have it stick to everything in the stencil? I dont believe so as each shape has its own font type/size -- -ronnie [MS] This posting is provided "AS IS" with no warranties, and confers no rights. "Ray Alden" <rmalden_2000@yahoo.com> wrote in message news:090101c350cf$da8dbc00$a101280a@phx.gbl... > A Visio stencil full of shapes has a default font > ...

RE: How do I get my new dialog box to invoke when I press New Menu Item
Hi All, 1. Machine and OS specifications I have Windows XP running Office XP Standard Edition. These software packages are installed on my dell Inspiron laptop. I have 128 MB RAM with a 40 GB HardDrive. 2. Problem In excel, when I pressed the New menu item, a dialog box would appear displaying all of the known templates. Now, only a new worksheet appears. I would like for the dialog to appear again. Can someone tell me how to get the dialog box back displaying all of my templates? d, The default New button has always generated a new workbook, no dialog box. There's ano...

Columns now numbers rather than letters how do i get letters back
Somehow I have managed to accidentally change the column references to numbers rather than letters. How do I get these back? Not sure of the correct terminology but I am referring to where the rows are usually numbers and the columns usually letters. My columns are now also numbers! In EXCEL 2007:- Office Button (top left hand corner) Excel Options (lower right hand corner) Formulas - make sure that there is no tick in the box called:- R1C1 reference style EXCEL 2003 Tools / Options / General tab – remove tick from R1C1 Reference style. If my comments have he...

print property
Is there anyway to put code behind the print button. I want the program to auto select ranges and print off that area when the print button is pressed without having to go in a set the , print area, page setup, fit to one page for four different parts of a worksheet. Is this possible? Thanks, Right-click the excel LOGO near the File menu, select View Code, on the left dropdown select Workbook, in the right dropdown, select Before Print, and enter whatever code you want there. The stub is: Private Sub Workbook_BeforePrint(Cancel As Boolean) End Sub Bob Umlas Excel MVP "cww...

Accessing Custom Properties of a master without creating an instance
Hi, Is it possible to access the custome properties of a Master shape without creating an instance of it in the drawing? i.e. is there an equivalent to Shape.Get_CellsU(cellName) for Masters? thanks Neil You just need to set Shape = Master.Shapes(1) <neilbirtles@hotmail.com> wrote in message news:1171276151.569309.112460@m58g2000cwm.googlegroups.com... > Hi, > > Is it possible to access the custome properties of a Master shape > without creating an instance of it in the drawing? i.e. is there an > equivalent to Shape.Get_CellsU(cellName) for Masters? > > than...

I'm getting my e-mail 1 day late?
Microsoft Outlook seems to be filtering the date that it will download my e-mail. On Thurday I received my Wednesday e-mail. On Friday I'll recive my Thurday e-mail etc. Does anyone know what I can do to fix this problem? I've checked the Outlook filter and can see no filter that would cause this problem. I'm using Microsoft Office Outlook 2003 Hoping for a reply Regards Brian Yes, fix your system time. You are posting one day from the future ;-) -- Robert Sparnaaij [MVP-Outlook] www.howto-outlook.com Tips of the month: -What do the Outlook Icons Mean? -Create an Office 2003...

Properties for this information service must be defined prior to use #3
I have a user running Outlook 2000 with 3 email profiles. This user stores email encrypted via PKI in a PST under one of these profiles. The certificate is valid and has not expired. The user had a problem recently where the tech that helped him uninstalled and reloaded his certs. After this happened the user was not able to access his PST. He gets the error message "Properties for this information service must be defined prior to use" followed by an access denied message on the PST I have verified that the file is not checked as Read Only. I have verified that the user has full ...

Save font output as bitmap
Hello. I'd like to be able to print some arbitrary text using a font of my choosing, but instead of just having the text display on say a CStatic object, I'd actually like to render the output to a bitmap. I imagine it should be possible, but since I'm new to MFC I'm not sure what direction would be good to first start looking in. If anyone could offer some advice, I'd appreciate it. Thanks. jeff Jeff W. wrote: > Hello. I'd like to be able to print some arbitrary text using a font of my > choosing, but instead of just having the text display on say a CStatic ...

Getting a textvalue in A1 after filtering
I have about 15 columns of data such data as Patients name birthday, Albumin value, natrium value, weight value and more. Every i put in new values for the same patients but keep the old records(rows) Its not so nice having the same name about 40 times in a row(after filtering), so i would like to only show the filtered name in ex "A1", and the rest of the values in rows under that name. So far i havent found an easy way to fix that. anyone got an idea on how to fix it? (sorry my english isnt so good) --- Message posted from http://www.ExcelForum.com/ How about just showing the f...

Is ANYONE successfully getting an NNTP news feed into Public Folders on Exchange 2003?
I've been beating my head against the wall trying to make NNTP news work with Public Folders on Exchange 2003. I really like the idea of having news articles appear in Public Folders as well as via port 119, but I can't seem to make it work. I've got a fully-up-to-date Windows Server 2003 system running fully-up-to-date Exchange 2003. The Exchange mail, Public Folders, IIS bits, etc have all been working properly for some time. I enabled the NNTP service and set up a newsfeed to point to a known good source (it happens to be another system that I manage). I know 100% that the s...

Print>Properties>Layout>Pages per sheet: this function/property .
In Excel, when I select multiple pages per sheet and the multiple pages are different sheets, then sometimes my hardcopies do have multiple shrunken sheets printed to one page. Othertimes excel and my printer seem to ignore my "multiple pages to one page" request. Why? I've been having the same problem. If you activate multiple sheets, then tell it to print multiple pages per sheet, Excel only prints the first page in the multiple sheet format (i.e., one small page in the upper left of the page.) The rest of the pages come out full size on separate sheets. Does any...

Email - Outbox
Does anyone know how to stop outlook annoyingly not sending things in the Outbox when they are highlighted / selected? If they are displayed in an italic font then they will be sent, but if the focus / cursor / pointer / selection / whatever you call the highlighted (normally blue) bar that highlights a selected message is on the message then it jumps from italic to normal font and then just sits there. If a message doesn't send for whatever reason and you reopen it, to Resend it, then with Outlook 2002 / XP you had a few seconds to click another folder or message before this dem...

Customer Statements print bold large font every 2 pages. Unreadabl
Any Ideas as to what could cause the Customer Statements to print very bold large font on every other page? it seems all the odd numbered pages print correctly. But all the even numbered pages print with a very large bold font that doesnt fit the page. I have a snapshot of what the pages look like. I can forward via email if you'd prefer to see a picture. All help is appreciated. This is a multi-part message in MIME format. ------=_NextPart_000_05B3_01C77605.F0DA2250 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Andy, Do you hav...