Ejemplo n.º 1
0
void InitializeOneFont (LKFont& theFont, LOGFONT logfont) {

  theFont.Release();

  ApplyClearType(&logfont);
  ApplyFontSize(&logfont);
  theFont.Create(&logfont);
}
Ejemplo n.º 2
0
static void RedrawSampleFont(void)
{
  if (!IsInitialized) {  
    return;
  }

  WndProperty* wp;

  wp = (WndProperty*)wf->FindByName(TEXT("prpFontName"));
  if(wp) {
    LK_tcsncpy(NewLogFont.lfFaceName,wp->GetDataField()->GetAsString(), LF_FACESIZE-1); 
  }
  wp = (WndProperty*)wf->FindByName(TEXT("prpFontHeight"));
  if(wp) {
    NewLogFont.lfHeight = wp->GetDataField()->GetAsInteger();
  }
  wp = (WndProperty*)wf->FindByName(TEXT("prpFontWeight"));
  if(wp) {
    NewLogFont.lfWeight= wp->GetDataField()->GetAsInteger();
  }

  wp = (WndProperty*)wf->FindByName(TEXT("prpFontItalic"));
  if(wp) {
    if ( wp->GetDataField()->GetAsInteger() ) {
      NewLogFont.lfItalic=1;
    }
    else {
      NewLogFont.lfItalic=0;
    }
  }
  wp = (WndProperty*)wf->FindByName(TEXT("prpFontPitchAndFamily"));
  if (wp) {
    NewLogFont.lfPitchAndFamily=wp->GetDataField()->GetAsInteger();
  }

/* UNUSED
  //KT
  wp = (WndProperty*)wf->FindByName(TEXT("prpFontTrueType"));
  if(wp) {
    if ( wp->GetDataField()->GetAsBoolean() ) 
    {
      wp = (WndProperty*)wf->FindByName(TEXT("prpFontRenderer"));
      if(wp) 
      { 
        if ( wp->GetDataField()->GetAsInteger() ) 
        {
          NewLogFont.lfQuality = CLEARTYPE_COMPAT_QUALITY;
        }
        else 
        {
          NewLogFont.lfQuality = ANTIALIASED_QUALITY;
        }
      }
    }
    else {
      NewLogFont.lfQuality = NONANTIALIASED_QUALITY;
    }
  }
*/
  
  NewFont.Create(&NewLogFont);

  wp = (WndProperty*)wf->FindByName(TEXT("prpFontSample"));

  if(wp) {
    if (GetObjectType(NewFont) == OBJ_FONT) {
      wp->SetFont(NewFont);
      wp->SetCaption(TEXT("<AbCdEfGh1234>"));
      wp->SetVisible(false);
      wp->SetVisible(true);
      wp->RefreshDisplay();
    }
    else {
      wp->SetCaption(TEXT("Error Creating Font!"));
      wp->RefreshDisplay();
    }
  }
}