/*! \return true - there was a match<br> false - there was no match ******************************************************************************/ bool PrinterProxy::ModelMatchQuery ( const char* szModelString //!< model or family string ) const { TRACE("PP::ModelMatchQuery(%s)\n", szModelString); bool bFound = false; // check to see if they passed in the family name TRACE("PP::MMQ - searching for %s(family) in %s\n",GetFamilyName(), szModelString); if (!strcmp(szModelString, GetFamilyName())) { TRACE("PP::MMQ - found family name match (%s)!\n", GetFamilyName()); bFound = true; } else { const char* szNextModel = m_szModelNames; while(*szNextModel) { TRACE("PP::MMQ - searching for %s in %s\n", szNextModel, szModelString); // do a simple substring on what was passed in with what is in the model list if (strstr(szModelString, szNextModel)) { // we found a match TRACE("PP:MMQ - found a model name match (%s)!\n", szNextModel); bFound = true; break; } szNextModel += strlen(szNextModel)+1; } } return bFound; } //DeviceQueryMatch
APDK_BEGIN_NAMESPACE //PrinterProxy //! Constructor for PrinterProxy /*! ******************************************************************************/ PrinterProxy::PrinterProxy ( const char* szFamilyName, const char* szModelNames ) : m_szFamilyName(szFamilyName), m_szModelNames(szModelNames) { unsigned int uCount = 0; char* tPtr = const_cast<char*>(m_szModelNames); while (*tPtr) { tPtr += strlen(tPtr)+1; uCount++; } m_uModelCount = uCount; PrinterFactory::Register(this); TRACE("PP::PP family is %s and supports %d models\n", GetFamilyName(), GetModelCount()); } //PrinterProxy
CFX_ByteString CFX_Font::GetFaceName() const { if (!m_Face && !m_pSubstFont) { return CFX_ByteString(); } if (m_Face) { CFX_ByteString facename; CFX_ByteString style = CFX_ByteString(FXFT_Get_Face_Style_Name(m_Face)); facename = GetFamilyName(); if (facename.IsEmpty()) { facename = "Untitled"; } if (!style.IsEmpty() && style != "Regular") { facename += " " + style; } return facename; } return m_pSubstFont->m_Family; }
int32_t CFX_GEFont::GetGlyphIndex(FX_WCHAR wUnicode, FX_BOOL bRecursive, IFX_Font** ppFont, FX_BOOL bCharCode) { FXSYS_assert(m_pFontEncoding != NULL); int32_t iGlyphIndex = m_pFontEncoding->GlyphFromCharCode(wUnicode); if (iGlyphIndex > 0) { if (ppFont != NULL) { *ppFont = (IFX_Font*)this; } return iGlyphIndex; } FGAS_LPCFONTUSB pFontUSB = FGAS_GetUnicodeBitField(wUnicode); if (pFontUSB == NULL) { return 0xFFFF; } FX_WORD wBitField = pFontUSB->wBitField; if (wBitField >= 128) { return 0xFFFF; } IFX_Font* pFont = NULL; m_FontMapper.Lookup((void*)(uintptr_t)wUnicode, (void*&)pFont); if (pFont != NULL && pFont != (IFX_Font*)this) { iGlyphIndex = ((CFX_GEFont*)pFont)->GetGlyphIndex(wUnicode, FALSE, NULL, bCharCode); if (iGlyphIndex != 0xFFFF) { int32_t i = m_SubstFonts.Find(pFont); if (i > -1) { iGlyphIndex |= ((i + 1) << 24); if (ppFont != NULL) { *ppFont = pFont; } return iGlyphIndex; } } } if (m_pFontMgr != NULL && bRecursive) { CFX_WideString wsFamily; GetFamilyName(wsFamily); #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ IFX_Font* pFont = m_pFontMgr->GetDefFontByUnicode( wUnicode, GetFontStyles(), (const FX_WCHAR*)wsFamily); #else IFX_Font* pFont = m_pFontMgr->GetFontByUnicode(wUnicode, GetFontStyles(), (const FX_WCHAR*)wsFamily); if (NULL == pFont) { pFont = m_pFontMgr->GetFontByUnicode(wUnicode, GetFontStyles(), NULL); } #endif if (pFont != NULL) { if (pFont == (IFX_Font*)this) { pFont->Release(); return 0xFFFF; } m_FontMapper.SetAt((void*)(uintptr_t)wUnicode, (void*)pFont); int32_t i = m_SubstFonts.GetSize(); m_SubstFonts.Add(pFont); iGlyphIndex = ((CFX_GEFont*)pFont)->GetGlyphIndex(wUnicode, FALSE, NULL, bCharCode); if (iGlyphIndex != 0xFFFF) { iGlyphIndex |= ((i + 1) << 24); if (ppFont != NULL) { *ppFont = pFont; } return iGlyphIndex; } } } return 0xFFFF; }
/*! ******************************************************************************/ PrinterProxy::~PrinterProxy() { TRACE("PP::~PP<%s> destructing\n", GetFamilyName()); PrinterFactory::UnRegister(this); } //~PrinterProxy
int32_t CFGAS_GEFont::GetGlyphIndex(FX_WCHAR wUnicode, FX_BOOL bRecursive, CFGAS_GEFont** ppFont, FX_BOOL bCharCode) { ASSERT(m_pFontEncoding); int32_t iGlyphIndex = m_pFontEncoding->GlyphFromCharCode(wUnicode); if (iGlyphIndex > 0) { if (ppFont) { *ppFont = this; } return iGlyphIndex; } const FGAS_FONTUSB* pFontUSB = FGAS_GetUnicodeBitField(wUnicode); if (!pFontUSB) { return 0xFFFF; } uint16_t wBitField = pFontUSB->wBitField; if (wBitField >= 128) { return 0xFFFF; } auto it = m_FontMapper.find(wUnicode); CFGAS_GEFont* pFont = it != m_FontMapper.end() ? it->second : nullptr; if (pFont && pFont != this) { iGlyphIndex = pFont->GetGlyphIndex(wUnicode, FALSE, nullptr, bCharCode); if (iGlyphIndex != 0xFFFF) { int32_t i = m_SubstFonts.Find(pFont); if (i > -1) { iGlyphIndex |= ((i + 1) << 24); if (ppFont) *ppFont = pFont; return iGlyphIndex; } } } if (m_pFontMgr && bRecursive) { CFX_WideString wsFamily; GetFamilyName(wsFamily); #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ CFGAS_GEFont* pFont = m_pFontMgr->GetDefFontByUnicode( wUnicode, GetFontStyles(), wsFamily.c_str()); #else CFGAS_GEFont* pFont = m_pFontMgr->GetFontByUnicode( wUnicode, GetFontStyles(), wsFamily.c_str()); if (!pFont) pFont = m_pFontMgr->GetFontByUnicode(wUnicode, GetFontStyles(), nullptr); #endif if (pFont) { if (pFont == this) { pFont->Release(); return 0xFFFF; } m_FontMapper[wUnicode] = pFont; int32_t i = m_SubstFonts.GetSize(); m_SubstFonts.Add(pFont); iGlyphIndex = pFont->GetGlyphIndex(wUnicode, FALSE, nullptr, bCharCode); if (iGlyphIndex != 0xFFFF) { iGlyphIndex |= ((i + 1) << 24); if (ppFont) *ppFont = pFont; return iGlyphIndex; } } } return 0xFFFF; }