コード例 #1
0
ファイル: xfont.cpp プロジェクト: neurodebian/iv-hines
const Font* FontImpl::lookup(Display* d, const String& name, float scale) {
    const Font* f;
    FontRep* r;
    KnownFonts* k = nil;
    UniqueString uname(name);
    if (fonts()->find(k, uname)) {
	for (ListItr(FontList) i(k->fonts); i.more(); i.next()) {
	    f = i.cur();
	    if (Math::equal(f->impl_->scale_, scale, float(0.0001))) {
		return f;
	    }
	}

	r = find_rep(k->fontreps, d, scale);
	if (r != nil) {
	    return new_font(uname, scale, k, r);
	}
    }

    r = create(d, uname, scale);
    if (r == nil) {
	return nil;
    }
    k = known(k, uname);
    f = new_font(uname, scale, k, r);
    f->impl_->new_rep(k, r);
    f->impl_->entry_ = k;
    return f;
}
コード例 #2
0
int createconsole(int argc, char *argv[])
{
  if (win != NULL)
    return 1;

  if (app != NULL)      /* delete existing partial data structures */
    deleteconsole();

  lines = malloc(NUM_LINES*NUM_COLUMNS*sizeof(TCHAR));
  if (lines == NULL)
    return 0;
  memset(lines, __T(' '), NUM_LINES * NUM_COLUMNS);

  app = new_app(argc, argv);
  if (app == NULL) {
    deleteconsole();
    return 0;
  } /* if */

  font = new_font(app, "unifont", PLAIN | PORTABLE_FONT, 16);
  if (font == NULL)
    font = new_font(app, "courier", PLAIN | NATIVE_FONT, 16);
  if (font == NULL)
    font = find_default_font(app);
  if (font == NULL) {
    deleteconsole();
    return 0;
  } /* if */

  win = new_window(app,
                   rect(0,0,
                        NUM_COLUMNS*font_width(font,"x",1),
                        NUM_LINES*font_height(font)),
                   "Pawn console",
                   TITLEBAR|CLOSEBOX|MAXIMIZE|MINIMIZE|CENTRED);
  on_window_redraw(win, window_redraw);
  on_window_close (win, window_close);
  on_window_key_down(win, window_key_action);     /* normal keys (including CR) */
  show_window(win);

  /* handle any pending events */
  while (do_event(app))
    /* nothing */;

  csrx = 0;
  csry = 0;
  autowrap = 0;
  attrib = 0x07;

  return 1;
}
コード例 #3
0
ファイル: texfont.c プロジェクト: luigiScarso/mflua
integer
copy_font (integer f) {
  int i;
  charinfo *ci , *co;
  integer k = new_font();
  memcpy(font_tables[k],font_tables[f],sizeof(texfont));

  set_font_cache_id(k,0);
  set_font_used(k,0);
  set_font_touched(k,0);
  
  font_tables[k]->_font_name = NULL;   
  font_tables[k]->_font_filename = NULL;   
  font_tables[k]->_font_fullname = NULL;   
  font_tables[k]->_font_encodingname = NULL;   
  font_tables[k]->_font_area = NULL;   
  font_tables[k]->_font_cidregistry = NULL;   
  font_tables[k]->_font_cidordering = NULL; 
  font_tables[k]->_left_boundary = NULL; 
  font_tables[k]->_right_boundary = NULL; 

  set_font_name(k,xstrdup(font_name(f)));
  if (font_filename(f)!= NULL)
    set_font_filename(k,xstrdup(font_filename(f)));
  if (font_fullname(f)!= NULL)
    set_font_fullname(k,xstrdup(font_fullname(f)));
  if (font_encodingname(f)!= NULL)
    set_font_encodingname(k,xstrdup(font_encodingname(f)));
  if (font_area(f)!= NULL)
    set_font_area(k,xstrdup(font_area(f)));
  if (font_cidregistry(f)!= NULL)
    set_font_cidregistry(k,xstrdup(font_cidregistry(f)));
  if (font_cidordering(f)!= NULL)
    set_font_cidordering(k,xstrdup(font_cidordering(f)));

  i = sizeof(*param_base(f))*font_params(f);  
  font_bytes += i;
  param_base(k) = xmalloc (i);
  memcpy(param_base(k),param_base(f), i);

  i = sizeof(charinfo)*(Charinfo_size(f)+1);  
  font_bytes += i;
  font_tables[k]->charinfo = xmalloc(i);
  memset(font_tables[k]->charinfo,0,i);
  for(i=0;i<=Charinfo_size(k);i++) {
	ci = copy_charinfo(&font_tables[f]->charinfo[i]);
	font_tables[k]->charinfo[i] = *ci;
  }

  if (left_boundary(f)!= NULL ) {
    ci = copy_charinfo(left_boundary(f));
    set_charinfo(k,left_boundarychar,ci);
  }

  if (right_boundary(f)!= NULL ) {
    ci = copy_charinfo(right_boundary(f));
    set_charinfo(k,right_boundarychar,ci);
  }
  return k;
}
コード例 #4
0
void EditTagDialog::UpdateFieldValue(const FieldData& field,
                                     const QModelIndexList& sel) {
  // Get the value from the field
  QVariant value;
  if (ExtendedEditor* editor = dynamic_cast<ExtendedEditor*>(field.editor_)) {
    value = editor->text();
  }

  // Did we get it?
  if (!value.isValid()) {
    return;
  }

  // Set it in each selected song
  for (const QModelIndex& i : sel) {
    data_[i.row()].set_value(field.id_, value);
  }

  // Update the boldness
  const bool modified = IsValueModified(sel, field.id_);

  QFont new_font(font());
  new_font.setBold(modified);
  field.label_->setFont(new_font);
  field.editor_->setFont(new_font);
}
コード例 #5
0
ファイル: dofont.c プロジェクト: luigiScarso/mflua
int 
read_font_info(pointer u,  strnumber nom, strnumber aire, scaled s,
               integer natural_dir) {
  integer f;
  char *cnom, *caire = NULL;
  char *msg;
  cnom  = xstrdup(makecstring(nom));
  if (aire != 0) 
    caire = xstrdup(makecstring(aire));

  f = new_font();
  if ((f = do_define_font(f, cnom,caire,s,natural_dir))) {
	if (caire != NULL) free(caire);
	free(cnom);
    return f;
  } else {
    char *help[] = {"I wasn't able to read the size data for this font,",
		    "so I will ignore the font specification.",
		    "[Wizards can fix TFM files using TFtoPL/PLtoTF.]",
		    "You might try inserting a different font spec;",
		    "e.g., type `I\font<same font id>=<substitute font name>'.",
		    NULL } ;
	if(!get_suppress_fontnotfound_error()) {
	  msg = font_error_message(u, cnom, s);
	  tex_error(msg,help);
	  free(msg);
	}
	if (caire != NULL) free(caire);
	free(cnom);
    return 0;
  }
}
コード例 #6
0
ファイル: predialogs.c プロジェクト: svn2github/iup-iup
static int k_any(Ihandle *ih, int c)
{
  switch(c)
  {
  case K_m:
    IupSetGlobal("PARENTDIALOG", "_MAIN_DIALOG_TEST_");
    IupMessage("IupMessage Test", "Message Text\nSecond Line.");
    IupSetGlobal("PARENTDIALOG", NULL);
    break;
  case K_e:
    new_message("ERROR", NULL);
    break;
  case K_i:
    new_message("INFORMATION", NULL);
    break;
  case K_w:
    new_message("WARNING", "OKCANCEL");
    break;
  case K_q:
    new_message("QUESTION", "YESNO");
    break;
  case K_c:
    new_color();
    break;
  case K_f:
    new_font();
    break;
  case K_o:
    new_file("OPEN", 0);
    break;
  case K_O:
    new_file("OPEN", 1);
    break;
  case K_G:
    new_file("OPEN", 2);
    break;
  case K_s:
    new_file("SAVE", 0);
    break;
  case K_d:
    new_file("DIR", 0);
    break;
  case K_a:
    new_alarm();
    break;
  case K_g:
    new_getfile();
    break;
  case K_t:
    new_gettext();
    break;
  case K_l:
    new_list();
    break;
  case K_ESC:
    IupDestroy(ih);
    return IUP_IGNORE;
  }
  return IUP_DEFAULT;
}
コード例 #7
0
ファイル: texfont.c プロジェクト: luigiScarso/mflua
void 
create_null_font (void) {
  int i = new_font();
  assert(i==0);
  set_font_name(i,xstrdup("nullfont")); 
  set_font_area(i,xstrdup(""));
  set_font_touched(i,1);
}
コード例 #8
0
ファイル: edittagdialog.cpp プロジェクト: vranki/Clementine
void EditTagDialog::UpdateModifiedField(const FieldData& field, const QModelIndexList& sel) {
  const bool modified = IsValueModified(sel, field.id_);

  // Update the boldness
  QFont new_font(font());
  new_font.setBold(modified);
  field.label_->setFont(new_font);
  field.editor_->setFont(new_font);
}
コード例 #9
0
ファイル: font.cpp プロジェクト: PaulFSherwood/cplusplus
CL_Font::CL_Font( CL_GraphicContext &context, const CL_StringRef &typeface_name, int height)
: impl(new CL_Font_Impl)
{
	CL_FontDescription desc;
	desc.set_typeface_name(typeface_name);
	desc.set_height(height);

	CL_Font_System new_font(context, typeface_name, height);
	*this = new_font;
}
コード例 #10
0
ファイル: dofont.c プロジェクト: luigiScarso/mflua
int 
find_font_id (char *nom, char *aire, scaled s) {
  integer f;
  f = new_font();
  if ((f = do_define_font(f, nom, aire,s,-1))) {
    return f;
  } else {
    return 0;
  }
}
コード例 #11
0
ファイル: CBar.cpp プロジェクト: qualified-self/nexus-10
CBar::CBar( const unsigned int a_size, const QColor & fg, const QColor & bg )
	: QWidget()
	, theSize( QSize(a_size,4*a_size) )
	, theText("")
	, theFGColour( fg )
	, theBGColour( bg )
	, theFilledFraction( 1.0 )
{
	setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::MinimumExpanding ) );

	QFont new_font( "Helvetica", 24, QFont::Bold );
	setFont( new_font );

	// nice signal to communicate across threads
	connect( this, SIGNAL(update_signal()), this, SLOT(update()) );

	emit update_signal();
}
コード例 #12
0
void EditTagDialog::InitFieldValue(const FieldData& field,
                                   const QModelIndexList& sel) {
  const bool varies = DoesValueVary(sel, field.id_);
  const bool modified = IsValueModified(sel, field.id_);

  if (ExtendedEditor* editor = dynamic_cast<ExtendedEditor*>(field.editor_)) {
    editor->clear();
    editor->clear_hint();
    if (varies) {
      editor->set_hint(tr(EditTagDialog::kHintText));
    } else {
      editor->set_text(data_[sel[0].row()].current_value(field.id_).toString());
    }
  }

  QFont new_font(font());
  new_font.setBold(modified);
  field.label_->setFont(new_font);
  field.editor_->setFont(new_font);
}
コード例 #13
0
ファイル: font.cpp プロジェクト: PaulFSherwood/cplusplus
CL_Font::CL_Font( CL_GraphicContext &context,const CL_FontDescription &desc)
: impl(new CL_Font_Impl)
{
	CL_Font_System new_font(context, desc);
	*this = new_font;
}