#include <cdrfiltr.h>
Inheritance diagram for CDRFontnameStore:
Public Member Functions | |
virtual BOOL | AddChunkToStore (RIFFFile *RIFF, CDRVersion Version) |
Stores fontname chunks for the CDRFilter class and caches the name. | |
virtual BOOL | AddFontToStore (DWORD Reference, TCHAR *Fontname) |
Adds another fontname to the list. | |
virtual WORD | GetHandleForReference (DWORD Reference) |
To get a handle for use in an attribute given a CDR reference. | |
Private Member Functions | |
CC_DECLARE_MEMDUMP (CDRFontnameStore) |
Definition at line 193 of file cdrfiltr.h.
|
Stores fontname chunks for the CDRFilter class and caches the name.
Definition at line 1824 of file cdrtext.cpp. 01825 { 01826 if(RIFF->GetObjType() != RIFFOBJECTTYPE_CHUNK) 01827 { 01828 ERROR2(FALSE, "CDRAttributeStore::AddChunkToStore called without a chunk in the RIFFFile"); 01829 } 01830 01831 // get a new item obect 01832 CDRFontnameStoredItem *Item = new CDRFontnameStoredItem; 01833 01834 if(Item == 0) 01835 return FALSE; 01836 01837 // get the data of the RIFF chunk 01838 if(!Item->Aquire(RIFF)) 01839 { 01840 delete Item; 01841 return FALSE; 01842 } 01843 01844 Item->Size = RIFF->GetObjSize(); 01845 01846 // and add the new item to the list 01847 AddTail(Item); 01848 01849 // cache the font name 01850 DWORD Reference; 01851 TCHAR *Name = 0; 01852 if(Version == CDRVERSION_5) 01853 { 01854 cdrfFontDefn *FD = (cdrfFontDefn *)Item->Block; 01855 01856 if(FD == 0) 01857 return FALSE; 01858 01859 Reference = FD->Reference; 01860 Name = FD->Name; 01861 } 01862 else if(Version == CDRVERSION_4) 01863 { 01864 cdrfFontDefnV4 *FD = (cdrfFontDefnV4 *)Item->Block; 01865 01866 if(FD == 0) 01867 return FALSE; 01868 01869 Reference = FD->Reference; 01870 Name = FD->Name; 01871 } 01872 01873 // if(Name != 0) 01874 // FONTMANAGER->CacheNamedFont(&String_64(Name)); 01875 01876 // get the item ready... 01877 return Item->GetTypefaceForUse(Reference, Name); 01878 }
|
|
Adds another fontname to the list.
Definition at line 1893 of file cdrtext.cpp. 01894 { 01895 TRACEUSER( "Ben", _T("**** attempting to add %s\n"), Fontname); 01896 // get a new item obect 01897 CDRFontnameStoredItem *Item = new CDRFontnameStoredItem; 01898 01899 if(Item == 0) 01900 return FALSE; 01901 01902 // and add the new item to the list 01903 AddTail(Item); 01904 01905 // get the item ready... 01906 return Item->GetTypefaceForUse(Reference, Fontname); 01907 }
|
|
|
|
To get a handle for use in an attribute given a CDR reference.
Definition at line 1922 of file cdrtext.cpp. 01923 { 01924 // scan the list comparing references with the stored items. 01925 CDRFontnameStoredItem *Item; 01926 01927 if(IsEmpty()) 01928 return 0; // no items in the list 01929 01930 Item = (CDRFontnameStoredItem *)GetHead(); 01931 01932 // scan though the list looking for the reference 01933 while(Item != 0) 01934 { 01935 if(Item->Reference == Reference) 01936 { 01937 return Item->hTypeface; 01938 } 01939 01940 Item = (CDRFontnameStoredItem *)GetNext(Item); 01941 } 01942 01943 01944 // nothing helpful found - return the default font handle 01945 return FONTMANAGER->GetFont()->GetFontHandle(); 01946 }
|