Skip to content

Commit

Permalink
Remove dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
dpiparo committed Dec 5, 2024
1 parent 06037db commit 793caef
Showing 1 changed file with 1 addition and 37 deletions.
38 changes: 1 addition & 37 deletions graf2d/cocoa/src/FontCache.mm
Original file line number Diff line number Diff line change
Expand Up @@ -120,29 +120,6 @@ bool GetFamilyName(CTFontDescriptorRef fontDescriptor, std::vector<char> &name)
return false;
}

#ifdef MAC_OS_X_VERSION_10_9

//______________________________________________________________________________
bool GetPostscriptName(CTFontDescriptorRef fontDescriptor, std::vector<char> &name)
{
//If success, this function returns a null-terminated string in a vector.
assert(fontDescriptor != 0 && "GetPostscriptName, parameter 'fontDescriptor' is null");

name.clear();

Util::CFScopeGuard<CFStringRef> cfFamilyName((CFStringRef)CTFontDescriptorCopyAttribute(fontDescriptor, kCTFontNameAttribute));

if (const CFIndex cfLen = CFStringGetLength(cfFamilyName.Get())) {
name.resize(cfLen + 1);//+ 1 for '\0'.
if (CFStringGetCString(cfFamilyName.Get(), &name[0], name.size(), kCFStringEncodingMacRoman))
return true;
}

return false;
}

#endif

//______________________________________________________________________________
void GetWeightAndSlant(CTFontDescriptorRef fontDescriptor, X11::XLFDName &newXLFD)
{
Expand Down Expand Up @@ -306,7 +283,7 @@ void CreateXLFDString(const X11::XLFDName &xlfd, std::string &xlfdString)
//To extract font names, I have to: create CFString, create font descriptor, create
//CFArray, create CTFontCollection, that's a mess!!!
//It's good I have my small and ugly RAII classes, otherwise the code will be
//total trash and sodomy because of all possible cleanup actions.
//messy because of all possible cleanup actions.

//First, create a font collection.
const Util::CFScopeGuard<CTFontCollectionRef> collectionGuard(CreateFontCollection(xlfd));
Expand Down Expand Up @@ -358,19 +335,6 @@ void CreateXLFDString(const X11::XLFDName &xlfd, std::string &xlfdString)
newXLFD.fPixelSize = xlfd.fPixelSize;
}

#ifdef MAC_OS_X_VERSION_10_9
//To avoid a warning from Core Text, save a mapping from a name seen by ROOT (family)
//to a right postscript name (required by Core Text).

//It's a null-terminated string:
std::vector<char> postscriptName;
if (GetPostscriptName(font, postscriptName)) {
if (fXLFDtoPostscriptNames.find(&familyName[0]) == fXLFDtoPostscriptNames.end())
fXLFDtoPostscriptNames[&familyName[0]] = &postscriptName[0];
}
#endif


//Ok, now lets create XLFD name, and place into list.
CreateXLFDString(newXLFD, xlfdString);
//
Expand Down

0 comments on commit 793caef

Please sign in to comment.