void free_Fonts(void) { int i; struct xfont *nf; for (i=0; i<NUM_FONTS; i++) { for (nf = x_fontinfo[i].xfontlist; nf != NULL;) { XUnloadFont(tool_d, nf->fid); if (nf->fstruct != NULL) XFreeFont(tool_d, nf->fstruct); if (nf->fset != NULL) XFreeFontSet(tool_d, nf->fset); nf = nf->next; } } if (bold_font!=NULL) { XFreeFont(tool_d, bold_font); } if (roman_font!=NULL) { XFreeFont(tool_d, roman_font); }; if (button_font!=NULL) { XFreeFont(tool_d, button_font); }; XFreeGC(tool_d, sr_xor_gc); for (i=0; i<NUMOPS; i++) { XFreeGC(tool_d, gccache[i]); } for (i=0; i<NUMFILLPATS; i++) { XFreeGC(tool_d, fill_gc[i]); } }
void Destroy() { DDProcTable &procTable = OGL::GetDDProcTable(); procTable.pfnDestroyRenderTarget(OGL::GetDDHandle(), mRenderBuffers[0]); procTable.pfnDestroyRenderTarget(OGL::GetDDHandle(), mRenderBuffers[1]); procTable.pfnDestroyRenderTarget(OGL::GetDDHandle(), mDepthBuffer); mRenderBuffers[0] = mRenderBuffers[1] = NULL; mDepthBuffer = NULL; if (mIsDisplay) { for (UINT i = 0; i < 2; ++i) { if (useShm) { XShmDetach(mpDisplay, &mShmInfo[i]); XDestroyImage(mpImages[i]); shmdt(mShmInfo[i].shmaddr); shmctl(mShmInfo[i].shmid, IPC_RMID, NULL); } else { XDestroyImage(mpImages[i]); } } XFreeGC(mpDisplay, swapGC); XFreeGC(mpDisplay, fontGC); XFreeFont(mpDisplay, fontinfo); } }
int main(int argc, char * argv[]) { GC gc; XFontStruct* font; XGCValues values; Display* dpy = InitDisplay(); if(!dpy) return EXIT_FAILURE; Window win = InitWindow(dpy, argc, argv); if(!win) return EXIT_FAILURE; // ListFontNames(dpy); if(!(font = XLoadQueryFont(dpy, "-misc-fixed-bold-r-normal--18-120-100-100-c-90-iso10646-1"))) { fprintf(stderr, "%s: cannot open 9x15 font.\n", argv[0]); return EXIT_FAILURE; } gc = XCreateGC(dpy, win, 0, &values); XSetFont(dpy, gc, font->fid); XSetForeground(dpy, gc, BlackPixel(dpy, DefaultScreen(dpy))); XMapWindow(dpy, win); //XFlush(dpy);//force message sending MsgLoop(dpy, win, gc, font); XFreeFont(dpy, font); XFreeGC(dpy, gc); XCloseDisplay(dpy); return EXIT_SUCCESS; }
/* * Show the currently selected font in the sample text label. */ static void display_sample(SharedFontSelData *data) { Arg args[2]; int n; XFontStruct * font; XmFontList font_list; Display * display; XmString str; display = XtDisplay(data->dialog); font = XLoadQueryFont(display, data->font_name); font_list = gui_motif_create_fontlist(font); n = 0; str = XmStringCreateLocalized("AaBbZzYy 0123456789"); XtSetArg(args[n], XmNlabelString, str); n++; XtSetArg(args[n], XmNfontList, font_list); n++; XtSetValues(data->sample, args, n); XmStringFree(str); if (data->old) { XFreeFont(display, data->old); XmFontListFree(data->old_list); } data->old = font; data->old_list = font_list; }
static void clean_up(void) { int i; free_event_list(); #ifndef DZEN_XFT if(dzen.font.set) XFreeFontSet(dzen.dpy, dzen.font.set); else XFreeFont(dzen.dpy, dzen.font.xfont); #endif XFreePixmap(dzen.dpy, dzen.title_win.drawable); if(dzen.slave_win.max_lines) { for(i=0; i < dzen.slave_win.max_lines; i++) { XFreePixmap(dzen.dpy, dzen.slave_win.drawable[i]); XDestroyWindow(dzen.dpy, dzen.slave_win.line[i]); } free(dzen.slave_win.line); XDestroyWindow(dzen.dpy, dzen.slave_win.win); } XFreeGC(dzen.dpy, dzen.gc); XFreeGC(dzen.dpy, dzen.rgc); XFreeGC(dzen.dpy, dzen.tgc); XDestroyWindow(dzen.dpy, dzen.title_win.win); XCloseDisplay(dzen.dpy); }
void buildfont() { #ifdef __linux__ Display *dpy = XOpenDisplay(NULL); if (dpy) { XFontStruct *fontinfo = XLoadQueryFont(dpy, "fixed"); if (fontinfo) { int minchar = fontinfo->min_char_or_byte2; int maxchar = fontinfo->max_char_or_byte2; fontlistbase = glGenLists(maxchar + 1); glXUseXFont(fontinfo->fid, minchar, maxchar - minchar + 1, fontlistbase + minchar); XFreeFont(dpy, fontinfo); } } XCloseDisplay(dpy); #else HDC hdc = wglGetCurrentDC(); SelectObject(hdc, GetStockObject(SYSTEM_FONT)); wglUseFontBitmaps(hdc, 0, 255, fontlistbase); #endif }
static void font_box_show_font (font_box_data * client) /* Font-box datas */ { Display * display; XmFontList motif_font_list; XFontStruct *old_font; Window window; /* Get the display */ display = XtDisplay (client->text); /* Store the old font */ old_font = client->current_font; /* Query the new font */ client->current_font = XLoadQueryFont (display, client->current_font_name); /* Set it in the text widget */ motif_font_list = XmFontListCreate (client->current_font, XmSTRING_DEFAULT_CHARSET); XtVaSetValues (client->text, XmNfontList, motif_font_list, NULL); XmFontListFree (motif_font_list); /* Free the old font if it's loaded (the first time it is not) */ if (old_font != NULL) XFreeFont (display, old_font); /* Clear the window and force an Expose event to redraw properly the text */ if (window = XtWindow (client->text)) XClearArea (display, XtWindow (client->text), 0, 0, 0, 0, True); }
wxXFont::~wxXFont() { // Freeing the font used to produce a segv, but // appears to be OK now (bug fix in X11?) XFontStruct* fontStruct = (XFontStruct*) m_fontStruct; XFreeFont((Display*) m_display, fontStruct); }
/* * This code was created by Jeff Molofee '99 * (ported to Linux/SDL by Ti Leggett '01) * * If you've found this code useful, please let me know. * * Visit Jeff at http://nehe.gamedev.net/ * * or for port-specific comments, questions, bugreports etc. * email to [email protected] */ void BuildFont(void) // Build Our Bitmap Font { Display *dpy; /* Our current X display */ XFontStruct *fontInfo; /* Our font info */ /* Sotrage for 96 characters */ hwconf.font_baze = glGenLists(96); /* Get our current display long enough to get the fonts */ dpy = XOpenDisplay(NULL); /* Get the font information */ fontInfo = XLoadQueryFont(dpy, "-adobe-helvetica-medium-r-normal--18-*-*-*-p-*-iso8859-1"); /* If the above font didn't exist try one that should */ if (fontInfo == NULL) { fontInfo = XLoadQueryFont(dpy, "fixed"); /* If that font doesn't exist, something is wrong */ if (fontInfo == NULL) { fprintf(stderr, "no X font available?\n"); return; } } /* generate the list */ glXUseXFont(fontInfo->fid, 32, 96, hwconf.font_baze); /* Recover some memory */ XFreeFont(dpy, fontInfo); /* close the display now that we're done with it */ XCloseDisplay(dpy); }
void xFreeFont(Display *display, XFontStruct *font) { if (font != NULL) XFreeFont(display, font); }
/* * Registered with the 2D disposer to be called after the Font is GC'd. */ static void pDataDisposeMethod(JNIEnv *env, jlong pData) { struct FontData *fdata = NULL; int32_t i = 0; Display *display = XDISPLAY; AWT_LOCK(); fdata = (struct FontData *)pData; if (fdata == NULL) { AWT_UNLOCK(); return; } if (fdata->xfs != NULL) { XFreeFontSet(display, fdata->xfs); } /* AWT fonts are always "multifonts" and probably have been in * all post 1.0 releases, so this test for multi fonts is * probably not needed, and the singleton xfont is probably never used. */ if (fdata->charset_num > 0) { for (i = 0; i < fdata->charset_num; i++) { free((void *)fdata->flist[i].xlfd); JNU_ReleaseStringPlatformChars(env, NULL, fdata->flist[i].charset_name); if (fdata->flist[i].load) { XFreeFont(display, fdata->flist[i].xfont); } } free((void *)fdata->flist); /* Don't free fdata->xfont because it is equal to fdata->flist[i].xfont for some 'i' */ } else { if (fdata->xfont != NULL) { XFreeFont(display, fdata->xfont); } } free((void *)fdata); AWT_UNLOCK(); }
static void Dealloc(PaxFontObject *self) { if (self->from_id) XFreeFontInfo(NULL, self->font_struct, 1); else XFreeFont(self->display, self->font_struct); PyObject_Del(self); }
/* Set Font Size */ void xwindow_set_font_size_core(XWindow *xw, float width, float height) { int i, k; int w; float s,ds; char *p; static int n = 0; static XFontStruct **fs = NULL; static int *sizes = NULL; UNUSED(width); if(!xw) { return; } /* Window dimensions */ w = xw->width; /* Load Fond Data, if not already available */ if(!fs) { fs = unique_font_struct(BASE, &sizes, &n); } /* Find font size based on font height in window * This is a bit weird as the scaling is done by * the window width, but this fits with the * output and scaling of the softwaretext() routine */ k = -1; ds = 1.0; for(i = 0; i < n; i++) { s = fabs( height - ((float)(fs[i]->ascent + fs[i]->descent) / (float)w)); if(s < ds) { k = i; ds = s; } } /* Load the closest font */ if(k >= 0) { asprintf(&p, "%s-%d-*", BASE, sizes[k]); if(xw->font->font_core) { XFreeFont(DISPLAY(xw), xw->font->font_core); } xw->font->font_core = XLoadQueryFont(DISPLAY(xw), p); if(xw->font->font_core == None) { fprintf(stderr, "error loading font: %s\n", p); } else { XSetFont(DISPLAY(xw), xw->gc, xw->font->font_core->fid); } free(p); p = NULL; } }
QFontEngineXLFD::~QFontEngineXLFD() { XFreeFont(QX11Info::display(), _fs); _fs = 0; #ifndef QT_NO_FREETYPE if (freetype) freetype->release(face_id); #endif }
void crt0_finish(void) { XUnmapWindow(display,win); XFreeGC(display,gc); XFreeFont(display,bgi_font); XCloseDisplay(display); bgi_status=0; xw_error_stat=NULL; }
// detruire les variables globales et les fenetres graphiques encore ouverte void destroy_graphique(void){ if(font != NULL) XFreeFont(dpy, font); XFreeCursor(dpy, cursor ); int i; for(i=0; i< N; i++) if(tab_mails[i].init_window == true) destroy_mail_win_graphique(i); }
static void caml_gr_get_font(char *fontname) { XFontStruct * font = XLoadQueryFont(caml_gr_display, fontname); if (font == NULL) caml_gr_fail("cannot find font %s", fontname); if (caml_gr_font != NULL) XFreeFont(caml_gr_display, caml_gr_font); caml_gr_font = font; XSetFont(caml_gr_display, caml_gr_window.gc, caml_gr_font->fid); XSetFont(caml_gr_display, caml_gr_bstore.gc, caml_gr_font->fid); }
static void font_del(Display *dpy, XFont *font) { if(!font) return; if(font->set) XFreeFontSet(dpy, font->set); else XFreeFont(dpy, font->xfont); free(font); }
MCOldFontnode::~MCOldFontnode() { if (reqname != NULL) { if (!MCnoui) XFreeFont(MCdpy, font.fstruct); delete font.reqname ; delete reqname; } }
void drw_font_free(Display *dpy, Fnt *font) { if(!font) return; if(font->set) XFreeFontSet(dpy, font->set); else XFreeFont(dpy, font->xfont); free(font); }
void drw_font_free(Drw *drw, Fnt *font) { if(!drw || !font) return; if(font->set) XFreeFontSet(drw->dpy, font->set); else XFreeFont(drw->dpy, font->xfont); free(font); }
void uifreefont_xorg(struct ui *ui, struct uifont *font) { struct uienv_xorg *env = ui->env; if ((font) && (font->data)) { XFreeFont(env->display, font->data); } return; }
FontRep::~FontRep() { XFreeFont(display_->rep()->display_, font_); for (ListUpdater(FontRepList) i(entry_->fontreps); i.more(); i.next()) { if (i.cur() == this) { i.remove_cur(); break; } } delete name_; delete encoding_; }
Bool xnestUnrealizeFont(ScreenPtr pScreen, FontPtr pFont) { if (xnestFontPriv(pFont)) { if (xnestFontStruct(pFont)) XFreeFont(xnestDisplay, xnestFontStruct(pFont)); xfree(xnestFontPriv(pFont)); FontSetPrivate(pFont, xnestFontPrivateIndex, NULL); } return True; }
void freedc(DC *dc) { if(dc->font.set) XFreeFontSet(dc->dpy, dc->font.set); if(dc->font.xfont) XFreeFont(dc->dpy, dc->font.xfont); if(dc->canvas) XFreePixmap(dc->dpy, dc->canvas); XFreeGC(dc->dpy, dc->gc); XCloseDisplay(dc->dpy); free(dc); }
void setfont(const char *fontstr) { #ifndef DZEN_XFT char *def, **missing; int i, n; missing = NULL; if(dzen.font.set) XFreeFontSet(dzen.dpy, dzen.font.set); dzen.font.set = XCreateFontSet(dzen.dpy, fontstr, &missing, &n, &def); if(missing) XFreeStringList(missing); if(dzen.font.set) { XFontSetExtents *font_extents; XFontStruct **xfonts; char **font_names; dzen.font.ascent = dzen.font.descent = 0; font_extents = XExtentsOfFontSet(dzen.font.set); n = XFontsOfFontSet(dzen.font.set, &xfonts, &font_names); for(i = 0, dzen.font.ascent = 0, dzen.font.descent = 0; i < n; i++) { if(dzen.font.ascent < (*xfonts)->ascent) dzen.font.ascent = (*xfonts)->ascent; if(dzen.font.descent < (*xfonts)->descent) dzen.font.descent = (*xfonts)->descent; xfonts++; } } else { if(dzen.font.xfont) XFreeFont(dzen.dpy, dzen.font.xfont); dzen.font.xfont = NULL; if(!(dzen.font.xfont = XLoadQueryFont(dzen.dpy, fontstr))) eprint("dzen: error, cannot load font: '%s'\n", fontstr); dzen.font.ascent = dzen.font.xfont->ascent; dzen.font.descent = dzen.font.xfont->descent; } dzen.font.height = dzen.font.ascent + dzen.font.descent; #else if(dzen.font.xftfont) XftFontClose(dzen.dpy, dzen.font.xftfont); dzen.font.xftfont = XftFontOpenXlfd(dzen.dpy, dzen.screen, fontstr); if(!dzen.font.xftfont) dzen.font.xftfont = XftFontOpenName(dzen.dpy, dzen.screen, fontstr); if(!dzen.font.xftfont) eprint("error, cannot load font: '%s'\n", fontstr); dzen.font.extents = malloc(sizeof(XGlyphInfo)); XftTextExtentsUtf8(dzen.dpy, dzen.font.xftfont, (unsigned const char *) fontstr, strlen(fontstr), dzen.font.extents); dzen.font.height = dzen.font.xftfont->ascent + dzen.font.xftfont->descent; dzen.font.width = (dzen.font.extents->width)/strlen(fontstr); #endif }
/* * Procedure Destroy() is called during the destruction of the widget. * Destroy() releases and frees GCs, frees the pixmaps and frees the * fonts. */ static void Destroy(AngbandWidget widget) { int n; /* Free all GC's */ for (n = 0; n < NUM_COLORS + 1; n++) { XtReleaseGC((Widget)widget, widget->angband.gc[n]); } /* Free the font */ XFreeFont(XtDisplay((Widget)widget), widget->angband.fnt); }
/** Free \a pFont on the back-end associated with \a pScreen. */ Bool dmxBEFreeFont(ScreenPtr pScreen, FontPtr pFont) { DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; dmxFontPrivPtr pFontPriv = FontGetPrivate(pFont, dmxFontPrivateIndex); if (pFontPriv && pFontPriv->font[pScreen->myNum]) { XFreeFont(dmxScreen->beDisplay, pFontPriv->font[pScreen->myNum]); pFontPriv->font[pScreen->myNum] = NULL; return TRUE; } return FALSE; }
/* Release an xfont. */ static int x_release(gx_xfont * xf, gs_memory_t * mem) { #if 0 /* The device may not be open. Cannot reliably free the font. */ x_xfont *xxf = (x_xfont *) xf; XFreeFont(xxf->xdev->dpy, xxf->font); #endif if (mem != NULL) gs_free_object(mem, xf, "x_release"); return 0; }
void iupdrvFontFinish(void) { int i, count = iupArrayCount(mot_fonts); ImotFont* fonts = (ImotFont*)iupArrayGetData(mot_fonts); for (i = 0; i < count; i++) { XmFontListFree(fonts[i].fontlist); fonts[i].fontlist = NULL; XFreeFont(iupmot_display, fonts[i].fontstruct); fonts[i].fontstruct = NULL; } iupArrayDestroy(mot_fonts); }