//----------------------------------------------------------------------------- void CDrawContext::setFont (const CFontRef newFont, const CCoord& size, const int32_t& style) { if (newFont == 0) return; if ((size > 0 && newFont->getSize () != size) || (style != -1 && newFont->getStyle () != style)) { OwningPointer<CFontDesc> font = (CFontRef)newFont->newCopy (); currentState.font = font; if (size > 0) currentState.font->setSize (size); if (style != -1) currentState.font->setStyle (style); } else { currentState.font = newFont; } }
//----------------------------------------------------------------------------- void CTabView::setTabFontStyle (const CFontRef font, CCoord fontSize, CColor selectedColor, CColor deselectedColor) { CFontRef tabFont = (CFontRef)font->newCopy (); tabFont->setSize (fontSize); CTabChildView* v = firstChild; while (v) { CTabButton* button = dynamic_cast<CTabButton*>(v->button); if (button) { button->setTextFont (tabFont); button->setActiveTextColor (selectedColor); button->setInactiveTextColor (deselectedColor); } v = v->next; } tabFont->forget (); }
//----------------------------------------------------------------------------- void CDrawContext::setFont (const CFontRef newFont, const CCoord& size, const int32_t& style) { if (newFont == 0) return; if (currentState.font) currentState.font->forget (); if ((size > 0 && newFont->getSize () != size) || (style != -1 && newFont->getStyle () != style)) { currentState.font = (CFontRef)newFont->newCopy (); if (size > 0) currentState.font->setSize (size); if (style != -1) currentState.font->setStyle (style); } else { currentState.font = newFont; currentState.font->remember (); } }