diff --git a/Xext/xf86bigfont.c b/Xext/xf86bigfont.c index b9fe1bf..e858713 100644 --- a/Xext/xf86bigfont.c +++ b/Xext/xf86bigfont.c @@ -179,7 +179,7 @@ XFree86BigfontExtensionInit() + (unsigned int) (65536.0 / (RAND_MAX + 1.0) * rand()); /* fprintf(stderr, "signature = 0x%08X\n", signature); */ - FontShmdescIndex = AllocateFontPrivateIndex(); + FontShmdescIndex = xfont2_allocate_font_private_index(); #if !defined(CSRG_BASED) && !defined(__CYGWIN__) pagesize = SHMLBA; @@ -511,7 +511,7 @@ ProcXF86BigfontQueryFont(ClientPtr client) } if (pDesc && !badSysCall) { *(CARD32 *) (pCI + nCharInfos) = signature; - if (!FontSetPrivate(pFont, FontShmdescIndex, pDesc)) { + if (!xfont2_font_set_private(pFont, FontShmdescIndex, pDesc)) { shmdealloc(pDesc); return BadAlloc; } diff --git a/configure.ac b/configure.ac index 9e40baf..1770fd4 100644 --- a/configure.ac +++ b/configure.ac @@ -319,7 +319,7 @@ XEXTXORG_LIB='$(top_builddir)/Xext/libXextbuiltin.la' dnl Core modules for most extensions, et al. REQUIRED_MODULES="[randrproto >= 1.2] renderproto [fixesproto >= 4.0] [damageproto >= 1.1] xcmiscproto xextproto xproto xtrans xf86bigfontproto [scrnsaverproto >= 1.1] bigreqsproto resourceproto fontsproto inputproto [kbproto >= 1.0.3]" -REQUIRED_LIBS="xfont fontenc" +REQUIRED_LIBS="xfont2 fontenc" AM_CONDITIONAL(SCREENSAVER, [test "x$SCREENSAVER" = xyes]) if test "x$SCREENSAVER" = xyes; then diff --git a/dix/dispatch.c b/dix/dispatch.c index de15948..ec5f1da 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -1388,7 +1388,7 @@ ProcQueryTextExtents(register ClientPtr client) return (BadLength); length--; } - if (!QueryTextExtents(pFont, length, (unsigned char *) &stuff[1], &info)) + if (!xfont2_query_text_extents(pFont, length, (unsigned char *) &stuff[1], &info)) return (BadAlloc); reply.type = X_Reply; reply.length = 0; diff --git a/dix/dixfonts.c b/dix/dixfonts.c index 667ff21..995c0a1 100644 --- a/dix/dixfonts.c +++ b/dix/dixfonts.c @@ -55,6 +55,8 @@ Equipment Corporation. #include #include #include +#include +#include #include "scrnintstr.h" #include "resource.h" #include "dixstruct.h" @@ -72,7 +74,7 @@ Equipment Corporation. #define QUERYCHARINFO(pci, pr) *(pr) = (pci)->metrics -extern pointer fosNaturalParams; +extern void *fosNaturalParams; extern FontPtr defaultFont; @@ -80,7 +82,7 @@ static FontPathElementPtr *font_path_elements = (FontPathElementPtr *) 0; static int num_fpes = 0; -_X_EXPORT FPEFunctions *fpe_functions = (FPEFunctions *) 0; +static xfont2_fpe_funcs_rec const **fpe_functions; static int num_fpe_types = 0; @@ -92,7 +94,7 @@ static int size_slept_fpes = 0; static FontPathElementPtr *slept_fpes = (FontPathElementPtr *) 0; -static FontPatternCachePtr patternCache; +static xfont2_pattern_cache_ptr patternCache; _X_EXPORT int FontToXError(err) @@ -114,6 +116,16 @@ int err; } } +void +GetGlyphs(FontPtr font, unsigned long count, unsigned char *chars, + FontEncoding fontEncoding, + unsigned long *glyphcount, /* RETURN */ + CharInfoPtr *glyphs) /* RETURN */ +{ + (*font->get_glyphs) (font, count, chars, fontEncoding, glyphcount, glyphs); +} + + /* * adding RT_FONT prevents conflict with default cursor font */ @@ -202,7 +214,7 @@ FontWakeup(pointer data, int count, pointer LastSelectMask) /* wake up any fpe's that may be waiting for information */ for (i = 0; i < num_slept_fpes; i++) { fpe = slept_fpes[i]; - (void) (*fpe_functions[fpe->type].wakeup_fpe) (fpe, LastSelectMask); + (void) (*fpe_functions[fpe->type]->wakeup_fpe) (fpe); } } @@ -218,7 +230,7 @@ FreeFPE(FontPathElementPtr fpe) { fpe->refcount--; if (fpe->refcount == 0) { - (*fpe_functions[fpe->type].free_fpe) (fpe); + (*fpe_functions[fpe->type]->free_fpe) (fpe); free(fpe->name); free(fpe); } @@ -269,14 +281,14 @@ doOpenFont(ClientPtr client, OFclosurePtr c) if (client->clientGone) { if (c->current_fpe < c->num_fpes) { fpe = c->fpe_list[c->current_fpe]; - (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe); + (*fpe_functions[fpe->type]->client_died) ((pointer) client, fpe); } err = Successful; goto bail; } while (c->current_fpe < c->num_fpes) { fpe = c->fpe_list[c->current_fpe]; - err = (*fpe_functions[fpe->type].open_font) + err = (*fpe_functions[fpe->type]->open_font) ((pointer) client, fpe, c->flags, c->fontname, c->fnamelen, FontFormat, BitmapFormatMaskByte | @@ -345,8 +357,8 @@ doOpenFont(ClientPtr client, OFclosurePtr c) goto bail; } if (patternCache && pfont != c->non_cachable_font) - CacheFontPattern(patternCache, c->origFontName, c->origFontNameLen, - pfont); + xfont2_cache_font_pattern(patternCache, c->origFontName, c->origFontNameLen, + pfont); bail: if (err != Successful && c->client != serverClient) { SendErrorToClient(c->client, X_OpenFont, 0, @@ -403,7 +415,7 @@ OpenFont(ClientPtr client, XID fid, Mask flags, unsigned lenfname, ** having to create another instance of a font that already exists. */ - cached = FindCachedFontPattern(patternCache, pfontname, lenfname); + cached = xfont2_find_cached_font_pattern(patternCache, pfontname, lenfname); if (cached && cached->info.cachable) { if (!AddResource(fid, RT_FONT, (pointer) cached)) return BadAlloc; @@ -470,7 +482,7 @@ CloseFont(pointer value, XID fid) return (Success); if (--pfont->refcnt == 0) { if (patternCache) - RemoveCachedFontPattern(patternCache, pfont); + xfont2_remove_cached_font_pattern(patternCache, pfont); /* * since the last reference is gone, ask each screen to free any * storage it may have allocated locally for it. @@ -486,7 +498,7 @@ CloseFont(pointer value, XID fid) XF86BigfontFreeFontShm(pfont); #endif fpe = pfont->fpe; - (*fpe_functions[fpe->type].close_font) (fpe, pfont); + (*fpe_functions[fpe->type]->close_font) (fpe, pfont); FreeFPE(fpe); } return (Success); @@ -596,7 +608,7 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c) if (client->clientGone) { if (c->current.current_fpe < c->num_fpes) { fpe = c->fpe_list[c->current.current_fpe]; - (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe); + (*fpe_functions[fpe->type]->client_died) ((pointer) client, fpe); } // err = Successful; goto bail; @@ -609,10 +621,10 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c) fpe = c->fpe_list[c->current.current_fpe]; err = Successful; - if (!fpe_functions[fpe->type].start_list_fonts_and_aliases) { + if (!fpe_functions[fpe->type]->start_list_fonts_and_aliases) { /* This FPE doesn't support/require list_fonts_and_aliases */ - err = (*fpe_functions[fpe->type].list_fonts) + err = (*fpe_functions[fpe->type]->list_fonts) ((pointer) c->client, fpe, c->current.pattern, c->current.patlen, c->current.max_names - c->names->nnames, c->names); @@ -640,7 +652,7 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c) the FPEs. */ if (!c->current.list_started) { - err = (*fpe_functions[fpe->type].start_list_fonts_and_aliases) + err = (*fpe_functions[fpe->type]->start_list_fonts_and_aliases) ((pointer) c->client, fpe, c->current.pattern, c->current.patlen, c->current.max_names - c->names->nnames, &c->current.private); @@ -660,7 +672,7 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c) char *tmpname; name = 0; - err = (*fpe_functions[fpe->type].list_next_font_or_alias) + err = (*fpe_functions[fpe->type]->list_next_font_or_alias) ((pointer) c->client, fpe, &name, &namelen, &tmpname, &resolvedlen, c->current.private); if (err == Suspended) { @@ -684,11 +696,11 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c) if (err == Successful) { if (c->haveSaved) { if (c->savedName) - (void) AddFontNamesName(c->names, c->savedName, + (void) xfont2_add_font_names_name(c->names, c->savedName, c->savedNameLen); } else - (void) AddFontNamesName(c->names, name, namelen); + (void) xfont2_add_font_names_name(c->names, name, namelen); } /* @@ -714,7 +726,7 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c) int tmpnamelen; tmpname = 0; - (void) (*fpe_functions[fpe->type].list_next_font_or_alias) + (void) (*fpe_functions[fpe->type]->list_next_font_or_alias) ((pointer) c->client, fpe, &tmpname, &tmpnamelen, &tmpname, &tmpnamelen, c->current.private); if (--aliascount <= 0) { @@ -822,7 +834,7 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c) free(c->fpe_list); if (c->savedName) free(c->savedName); - FreeFontNames(names); + xfont2_free_font_names(names); free(c); if (resolved) free(resolved); @@ -854,7 +866,7 @@ ListFonts(ClientPtr client, unsigned char *pattern, unsigned length, free(c); return BadAlloc; } - c->names = MakeFontNamesRecord(max_names < 100 ? max_names : 100); + c->names = xfont2_make_font_names_record(max_names < 100 ? max_names : 100); if (!c->names) { free(c->fpe_list); free(c); @@ -909,7 +921,7 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c) if (client->clientGone) { if (c->current.current_fpe < c->num_fpes) { fpe = c->fpe_list[c->current.current_fpe]; - (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe); + (*fpe_functions[fpe->type]->client_died) ((pointer) client, fpe); } err = Successful; goto bail; @@ -921,7 +933,7 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c) fpe = c->fpe_list[c->current.current_fpe]; err = Successful; if (!c->current.list_started) { - err = (*fpe_functions[fpe->type].start_list_fonts_with_info) + err = (*fpe_functions[fpe->type]->start_list_fonts_with_info) (client, fpe, c->current.pattern, c->current.patlen, c->current.max_names, &c->current.private); if (err == Suspended) { @@ -938,7 +950,7 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c) if (err == Successful) { name = 0; pFontInfo = &fontInfo; - err = (*fpe_functions[fpe->type].list_next_font_with_info) + err = (*fpe_functions[fpe->type]->list_next_font_with_info) (client, fpe, &name, &namelen, &pFontInfo, &numFonts, c->current.private); if (err == Suspended) { @@ -972,7 +984,7 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c) tmpname = 0; tmpFontInfo = &fontInfo; - (void) (*fpe_functions[fpe->type].list_next_font_with_info) + (void) (*fpe_functions[fpe->type]->list_next_font_with_info) (client, fpe, &tmpname, &tmpnamelen, &tmpFontInfo, &numFonts, c->current.private); if (--aliascount <= 0) { @@ -1168,7 +1180,7 @@ doPolyText(ClientPtr client, register PTclosurePtr c) if (client->clientGone) { fpe = c->pGC->font->fpe; - (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe); + (*fpe_functions[fpe->type]->client_died) ((pointer) client, fpe); if (c->slept) { /* Client has died, but we cannot bail out right now. We @@ -1195,7 +1207,7 @@ doPolyText(ClientPtr client, register PTclosurePtr c) the FPE code to clean up after client and avoid further rendering while we clean up after ourself. */ fpe = c->pGC->font->fpe; - (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe); + (*fpe_functions[fpe->type]->client_died) ((pointer) client, fpe); c->pDraw = (DrawablePtr) 0; } @@ -1441,7 +1453,7 @@ doImageText(ClientPtr client, register ITclosurePtr c) if (client->clientGone) { fpe = c->pGC->font->fpe; - (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe); + (*fpe_functions[fpe->type]->client_died) ((pointer) client, fpe); err = Success; goto bail; } @@ -1456,7 +1468,7 @@ doImageText(ClientPtr client, register ITclosurePtr c) /* Our drawable has disappeared. Treat like client died... ask the FPE code to clean up after client. */ fpe = c->pGC->font->fpe; - (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe); + (*fpe_functions[fpe->type]->client_died) ((pointer) client, fpe); err = Success; goto bail; } @@ -1588,7 +1600,7 @@ DetermineFPEType(char *pathname) int i; for (i = 0; i < num_fpe_types; i++) { - if ((*fpe_functions[i].name_check) (pathname)) + if ((*fpe_functions[i]->name_check) (pathname)) return i; } return -1; @@ -1656,8 +1668,8 @@ SetFontPathElements(int npaths, unsigned char *paths, int *bad, Bool persist) return BadAlloc; } for (i = 0; i < num_fpe_types; i++) { - if (fpe_functions[i].set_path_hook) - (*fpe_functions[i].set_path_hook) (); + if (fpe_functions[i]->set_path_hook) + (*fpe_functions[i]->set_path_hook) (); } for (i = 0; i < npaths; i++) { len = (unsigned int) (*cp++); @@ -1676,7 +1688,7 @@ SetFontPathElements(int npaths, unsigned char *paths, int *bad, Bool persist) */ fpe = find_existing_fpe(font_path_elements, num_fpes, cp, len); if (fpe) { - err = (*fpe_functions[fpe->type].reset_fpe) (fpe); + err = (*fpe_functions[fpe->type]->reset_fpe) (fpe); if (err == Successful) { UseFPE(fpe); /* since it'll be decref'd later when freed * from the old list */ @@ -1706,7 +1718,7 @@ SetFontPathElements(int npaths, unsigned char *paths, int *bad, Bool persist) if (fpe->type == -1) err = BadValue; else - err = (*fpe_functions[fpe->type].init_fpe) (fpe); + err = (*fpe_functions[fpe->type]->init_fpe) (fpe); if (err != Successful) { if (persist) { ErrorF @@ -1731,7 +1743,7 @@ SetFontPathElements(int npaths, unsigned char *paths, int *bad, Bool persist) FreeFontPath(font_path_elements, num_fpes, FALSE); font_path_elements = fplist; if (patternCache) - EmptyFontPatternCache(patternCache); + xfont2_empty_font_pattern_cache(patternCache); num_fpes = valid_paths; return Success; @@ -1832,8 +1844,8 @@ _X_EXPORT int LoadGlyphs(ClientPtr client, FontPtr pfont, unsigned nchars, int item_size, unsigned char *data) { - if (fpe_functions[pfont->fpe->type].load_glyphs) - return (*fpe_functions[pfont->fpe->type].load_glyphs) + if (fpe_functions[pfont->fpe->type]->load_glyphs) + return (*fpe_functions[pfont->fpe->type]->load_glyphs) (client, pfont, 0, nchars, item_size, data); else return Successful; @@ -1848,34 +1860,49 @@ DeleteClientFontStuff(ClientPtr client) for (i = 0; i < num_fpes; i++) { fpe = font_path_elements[i]; - if (fpe_functions[fpe->type].client_died) - (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe); + if (fpe_functions[fpe->type]->client_died) + (*fpe_functions[fpe->type]->client_died) ((pointer) client, fpe); } } +_X_EXPORT XFONT_LTO +Font +get_new_font_client_id() +{ + return FakeClientID(0); +} + +_X_EXPORT XFONT_LTO +int +store_font_Client_font(FontPtr pfont, Font id) +{ + return AddResource(id, RT_NONE, (pointer) pfont); +} + +_X_EXPORT XFONT_LTO void -InitFonts() +delete_font_client_id(Font id) { - patternCache = MakeFontPatternCache(); + FreeResource(id, RT_NONE); +} - { -#ifdef KDRIVESERVER - BuiltinRegisterFpeFunctions(); -#endif - FontFileRegisterFpeFunctions(); - } +_X_EXPORT XFONT_LTO +int +_client_auth_generation(ClientPtr client) +{ + return 0; } _X_EXPORT XFONT_LTO int -GetDefaultPointSize() +get_default_point_size() { return 120; } _X_EXPORT XFONT_LTO FontResolutionPtr -GetClientResolutions(int *num) +get_client_resolutions(int *num) { if (requestingClient && requestingClient->fontResFunc != NULL && !requestingClient->clientGone) { @@ -1907,117 +1934,24 @@ GetClientResolutions(int *num) } } -/* - * returns the type index of the new fpe - * - * should be called (only once!) by each type of fpe when initialized - */ - -_X_EXPORT XFONT_LTO -int -RegisterFPEFunctions(NameCheckFunc name_func, - InitFpeFunc init_func, - FreeFpeFunc free_func, - ResetFpeFunc reset_func, - OpenFontFunc open_func, - CloseFontFunc close_func, - ListFontsFunc list_func, - StartLfwiFunc start_lfwi_func, - NextLfwiFunc next_lfwi_func, - WakeupFpeFunc wakeup_func, - ClientDiedFunc client_died, - LoadGlyphsFunc load_glyphs, - StartLaFunc start_list_alias_func, - NextLaFunc next_list_alias_func, SetPathFunc set_path_func) -{ - FPEFunctions *new; - - /* grow the list */ - new = (FPEFunctions *) realloc(fpe_functions, - (num_fpe_types + 1) * sizeof(FPEFunctions)); - if (!new) - return -1; - fpe_functions = new; - - fpe_functions[num_fpe_types].name_check = name_func; - fpe_functions[num_fpe_types].open_font = open_func; - fpe_functions[num_fpe_types].close_font = close_func; - fpe_functions[num_fpe_types].wakeup_fpe = wakeup_func; - fpe_functions[num_fpe_types].list_fonts = list_func; - fpe_functions[num_fpe_types].start_list_fonts_with_info = start_lfwi_func; - fpe_functions[num_fpe_types].list_next_font_with_info = next_lfwi_func; - fpe_functions[num_fpe_types].init_fpe = init_func; - fpe_functions[num_fpe_types].free_fpe = free_func; - fpe_functions[num_fpe_types].reset_fpe = reset_func; - fpe_functions[num_fpe_types].client_died = client_died; - fpe_functions[num_fpe_types].load_glyphs = load_glyphs; - fpe_functions[num_fpe_types].start_list_fonts_and_aliases = - start_list_alias_func; - fpe_functions[num_fpe_types].list_next_font_or_alias = next_list_alias_func; - fpe_functions[num_fpe_types].set_path_hook = set_path_func; - - return num_fpe_types++; -} - -void -FreeFonts() -{ - if (patternCache) { - FreeFontPatternCache(patternCache); - patternCache = 0; - } - FreeFontPath(font_path_elements, num_fpes, TRUE); - font_path_elements = 0; - num_fpes = 0; - free(fpe_functions); - num_fpe_types = 0; - fpe_functions = (FPEFunctions *) 0; -} - -/* convenience functions for FS interface */ - -FontPtr -find_old_font(XID id) +static uint32_t wrap_time_in_millis(void) { - return (FontPtr) SecurityLookupIDByType(NullClient, id, RT_NONE, - SecurityUnknownAccess); + return GetTimeInMillis(); } -_X_EXPORT XFONT_LTO -Font -GetNewFontClientID() -{ - return FakeClientID(0); -} - -_X_EXPORT XFONT_LTO -int -StoreFontClientFont(FontPtr pfont, Font id) -{ - return AddResource(id, RT_NONE, (pointer) pfont); -} +static int fs_handlers_installed = 0; -_X_EXPORT XFONT_LTO -void -DeleteFontClientID(Font id) -{ - FreeResource(id, RT_NONE); -} +static unsigned int last_server_gen; -_X_EXPORT XFONT_LTO -int -client_auth_generation(ClientPtr client) +static void +adjust_fs_wait_for_delay(void *wt, unsigned long newdelay) { - return 0; + AdjustWaitForDelay(wt, newdelay); } -static int fs_handlers_installed = 0; - -static unsigned int last_server_gen; - _X_EXPORT XFONT_LTO int -init_fs_handlers(FontPathElementPtr fpe, BlockHandlerProcPtr block_handler) +_init_fs_handlers(FontPathElementPtr fpe, FontBlockHandlerProcPtr block_handler) { /* if server has reset, make sure the b&w handlers are reinstalled */ if (last_server_gen < serverGeneration) { @@ -2025,9 +1959,7 @@ init_fs_handlers(FontPathElementPtr fpe, BlockHandlerProcPtr block_handler) fs_handlers_installed = 0; } if (fs_handlers_installed == 0) { - - - if (!RegisterBlockAndWakeupHandlers(block_handler, + if (!RegisterBlockAndWakeupHandlers((BlockHandlerProcPtr)block_handler, FontWakeup, (pointer) 0)) return AllocError; fs_handlers_installed++; @@ -2038,7 +1970,7 @@ init_fs_handlers(FontPathElementPtr fpe, BlockHandlerProcPtr block_handler) _X_EXPORT XFONT_LTO void -remove_fs_handlers(FontPathElementPtr fpe, BlockHandlerProcPtr block_handler, +_remove_fs_handlers(FontPathElementPtr fpe, FontBlockHandlerProcPtr block_handler, Bool all) { if (all) { @@ -2046,10 +1978,126 @@ remove_fs_handlers(FontPathElementPtr fpe, BlockHandlerProcPtr block_handler, if (--fs_handlers_installed == 0) { - RemoveBlockAndWakeupHandlers(block_handler, FontWakeup, + RemoveBlockAndWakeupHandlers((BlockHandlerProcPtr)block_handler, FontWakeup, (pointer) 0); } } RemoveFontWakeup(fpe); } +static int +register_fpe_funcs(const xfont2_fpe_funcs_rec *funcs) +{ + xfont2_fpe_funcs_rec const **new; + + /* grow the list */ + new = reallocarray(fpe_functions, num_fpe_types + 1, sizeof(xfont2_fpe_funcs_ptr)); + if (!new) + return -1; + fpe_functions = new; + + fpe_functions[num_fpe_types] = funcs; + + return num_fpe_types++; +} + +static unsigned long +get_server_generation(void) +{ + return serverGeneration; +} + +static void * +get_server_client(void) +{ + return serverClient; +} + +static int +add_fs_fd(int fd, FontFdHandlerProcPtr handler, void *data) +{ + return TRUE; +} + +static void +remove_fs_fd(int fd) +{ +} + +/* + * returns the type index of the new fpe + * + * should be called (only once!) by each type of fpe when initialized + */ + +xfont2_pattern_cache_ptr fontPatternCache; + +static const xfont2_client_funcs_rec xfont2_client_funcs = { + .version = XFONT2_CLIENT_FUNCS_VERSION, + .client_auth_generation = _client_auth_generation, + .client_signal = ClientSignal, + .delete_font_client_id = delete_font_client_id, + .verrorf = VErrorF, + .find_old_font = find_old_font, + .get_client_resolutions = get_client_resolutions, + .get_default_point_size = get_default_point_size, + .get_new_font_client_id = get_new_font_client_id, + .get_time_in_millis = wrap_time_in_millis, + .init_fs_handlers = _init_fs_handlers, + .register_fpe_funcs = register_fpe_funcs, + .remove_fs_handlers = _remove_fs_handlers, + .get_server_client = get_server_client, + .set_font_authorizations = set_font_authorizations, + .store_font_client_font = store_font_Client_font, + .make_atom = (Atom (*)(const char *, unsigned int, int))MakeAtom, + .valid_atom = ValidAtom, + .name_for_atom = (const char * (*)(Atom))NameForAtom, + .get_server_generation = get_server_generation, + .add_fs_fd = add_fs_fd, + .remove_fs_fd = remove_fs_fd, + .adjust_fs_wait_for_delay = adjust_fs_wait_for_delay, +}; + +void +InitFonts() +{ + if (fontPatternCache) + xfont2_free_font_pattern_cache(fontPatternCache); + fontPatternCache = xfont2_make_font_pattern_cache(); + xfont2_init(&xfont2_client_funcs); + { +#ifdef KDRIVESERVER + BuiltinRegisterFpeFunctions(); +#endif + FontFileRegisterFpeFunctions(); + } +} + + +void +FreeFonts() +{ + if (patternCache) { + xfont2_free_font_pattern_cache(patternCache); + patternCache = 0; + } + FreeFontPath(font_path_elements, num_fpes, TRUE); + font_path_elements = 0; + num_fpes = 0; + free(fpe_functions); + num_fpe_types = 0; + fpe_functions = NULL; +} + +/* convenience functions for FS interface */ + +FontPtr +find_old_font(XID id) +{ + return (FontPtr) SecurityLookupIDByType(NullClient, id, RT_NONE, + SecurityUnknownAccess); +} + + + + diff --git a/dix/main.c b/dix/main.c index a2c3a25..cbcf621 100644 --- a/dix/main.c +++ b/dix/main.c @@ -292,7 +292,7 @@ main(int argc, char *argv[], char *envp[]) InitAtoms(); InitEvents(); - InitGlyphCaching(); + xfont2_init_glyph_caching(); ResetExtensionPrivates(); ResetClientPrivates(); ResetScreenPrivates(); @@ -300,7 +300,9 @@ main(int argc, char *argv[], char *envp[]) ResetGCPrivates(); ResetPixmapPrivates(); ResetColormapPrivates(); +#if 0 ResetFontPrivateIndex(); +#endif ResetDevicePrivateIndex(); InitCallbackManager(); InitVisualWrap(); diff --git a/include/dixfont.h b/include/dixfont.h index 2ce672f..62c112a 100644 --- a/include/dixfont.h +++ b/include/dixfont.h @@ -28,13 +28,14 @@ SOFTWARE. #include #include "closure.h" #include +#include #define NullDIXFontProp ((DIXFontPropPtr)0) typedef struct _DIXFontProp *DIXFontPropPtr; - -extern FPEFunctions *fpe_functions; - +#if 0 +static xfont2_fpe_funcs_rec const **fpe_functions; +#endif int FontToXError(int /*err*/); Bool SetDefaultFont(char * /*defaultfontname*/); diff --git a/miext/damage/damage.c b/miext/damage/damage.c index 16959aa..3d0c9dc 100644 --- a/miext/damage/damage.c +++ b/miext/damage/damage.c @@ -1289,7 +1289,7 @@ damageDamageChars(DrawablePtr pDrawable, BoxRec box; - QueryGlyphExtents(font, charinfo, n, &extents); + xfont2_query_glyph_extents(font, charinfo, n, &extents); if (imageblt) { if (extents.overallWidth > extents.overallRight) extents.overallRight = extents.overallWidth; diff --git a/os/utils.c b/os/utils.c index 657a3fa..038e677 100644 --- a/os/utils.c +++ b/os/utils.c @@ -617,7 +617,7 @@ ProcessCommandLine(int argc, char *argv[]) #endif else if ( strcmp( argv[i], "-deferglyphs") == 0) { - if(++i >= argc || !ParseGlyphCachingMode(argv[i])) + if(++i >= argc || !xfont2_parse_glyph_caching_mode(argv[i])) UseMsg(); } else if ( strcmp( argv[i], "-f") == 0)