Adriano Del Vigna de Almeida
2005-Nov-21 08:50 UTC
[Fontconfig] Error accessing a FcConfig internal element
Ok, I solved the problem adding the file ''fcint.h'' into my project. This is the best solution? At first I tryed to redefine FcConfig into the source code, but it required to define also all of the inner variables... So I dicided to include ''fcint.h'' into the source code... Thanks again. Em Sex, 2004-01-02 ?s 12:16, Adriano Del Vigna de Almeida escreveu:> Hello folks, > > I''m having a strange error. When I try to access some internal > variable inside a FcConfig strucutre from a program I receive the > following error: > > gcc -I /usr/include/freetype2 `pkg-config --cflags glib-2.0` > -lfontconfig `pkg-config --libs glib-2.0` main.c fontsbase.c > fcconfighandlers.c -o fontman > main.c: In function `ListAllFonts'': > main.c:328: error: dereferencing pointer to incomplete type > make: ** [all] Erro 1 > > /***** CODE SNIPET ******************************/ > > > FcConfig *Config = NULL; > FcFontSet *FontSet = NULL; > > FcPattern *Pattern = NULL; > FcObjectSet *ObjectSet = NULL; > FcChar8 *Family; > > unsigned int count; > > Config = FcInitLoadConfigAndAllFonts(); > if(Config == NULL) > { > puts("Error on creating a Fontconfig configuration!"); > return(0); > } > > FcConfigSetCurrent(Config); > > Pattern = FcPatternCreate(); > ObjectSet = FcObjectSetBuild(FC_FAMILY, 0); > FontSet = FcFontList(0, Pattern, ObjectSet); > > for(count = 0; count < FontSet->nfont; count++) > { > FcPatternGetString(FontSet->fonts[count], FC_FAMILY, 0, > &Family); > > /** I GOT AN ERROR AT THIS LINE!! > ****************************/ > if(FcStrSetMember(Config->disabledFonts, Family)) > /************************************************************/ > > printf("%s\t\t!!DISABLED!!\n", Family); > else > printf("%s\n", Family); > } > } > > /******* END *******************************/ > > By the way, disabledFonts is a FcStrSet variable inside FcConfig > structure. What I''m doing wrong? I have never seen this error > before... > > Thanks for the attention! > > -- > Adriano Del Vigna de Almeida <katmandu@fs.inf.br>-------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.freedesktop.org/archives/fontconfig/attachments/20040102/6c8a43be/attachment.htm
Adriano Del Vigna de Almeida
2005-Nov-21 08:50 UTC
[Fontconfig] Error accessing a FcConfig internal element
Oh! No, this not my idea... I only want to see what my disabledFonts FcStrSet contains from a management program... I could add an API like ''FcConfigGetDisabledFonts'', this is my idea for know... But thanks man! Em Sex, 2004-01-02 ?s 15:09, Keith Packard escreveu:> Around 12 o''clock on Jan 2, Adriano Del Vigna de Almeida wrote: > > > By the way, disabledFonts is a FcStrSet variable inside FcConfig > > structure. What I''m doing wrong? I have never seen this error before... > > The FcConfig datatype is not exposed to applications; it''s entirely > private to the fontconfig implementation. If you want to add > ''disabledFonts'' to the implementation, you''ll need to expose some kind of > API that uses this datatype, preferably, the FcMatch, FcSort and FcList functions > would automatically use it to elide ''disabled'' fonts from their results so > that applications wouldn''t have to know about it. > > -keith > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.freedesktop.org/archives/fontconfig/attachments/20040102/eb06cdf9/attachment.html
Keith Packard
2005-Nov-21 08:50 UTC
[Fontconfig] Error accessing a FcConfig internal element
Around 14 o''clock on Jan 2, Adriano Del Vigna de Almeida wrote:> Ok, I solved the problem adding the file ''fcint.h'' into my project. This > is the best solution?No. fcint.h is an internal header file for use only within the library; it''s not installed and shouldn''t even be shipped in binary releases of the system. If you do use this header file, I''m tempted to promise to break the data structure in arbitrary ways at the next release :-) -keith
Keith Packard
2005-Nov-21 08:50 UTC
[Fontconfig] Error accessing a FcConfig internal element
Around 12 o''clock on Jan 2, Adriano Del Vigna de Almeida wrote:> By the way, disabledFonts is a FcStrSet variable inside FcConfig > structure. What I''m doing wrong? I have never seen this error before...The FcConfig datatype is not exposed to applications; it''s entirely private to the fontconfig implementation. If you want to add ''disabledFonts'' to the implementation, you''ll need to expose some kind of API that uses this datatype, preferably, the FcMatch, FcSort and FcList functions would automatically use it to elide ''disabled'' fonts from their results so that applications wouldn''t have to know about it. -keith
Adriano Del Vigna de Almeida
2005-Nov-21 08:50 UTC
[Fontconfig] Error accessing a FcConfig internal element
Hello folks, I''m having a strange error. When I try to access some internal variable inside a FcConfig strucutre from a program I receive the following error: gcc -I /usr/include/freetype2 `pkg-config --cflags glib-2.0` -lfontconfig `pkg-config --libs glib-2.0` main.c fontsbase.c fcconfighandlers.c -o fontman main.c: In function `ListAllFonts'': main.c:328: error: dereferencing pointer to incomplete type make: ** [all] Erro 1 /***** CODE SNIPET ******************************/ FcConfig *Config = NULL; FcFontSet *FontSet = NULL; FcPattern *Pattern = NULL; FcObjectSet *ObjectSet = NULL; FcChar8 *Family; unsigned int count; Config = FcInitLoadConfigAndAllFonts(); if(Config == NULL) { puts("Error on creating a Fontconfig configuration!"); return(0); } FcConfigSetCurrent(Config); Pattern = FcPatternCreate(); ObjectSet = FcObjectSetBuild(FC_FAMILY, 0); FontSet = FcFontList(0, Pattern, ObjectSet); for(count = 0; count < FontSet->nfont; count++) { FcPatternGetString(FontSet->fonts[count], FC_FAMILY, 0, &Family); /** I GOT AN ERROR AT THIS LINE!! ****************************/ if(FcStrSetMember(Config->disabledFonts, Family)) /************************************************************/ printf("%s\t\t!!DISABLED!!\n", Family); else printf("%s\n", Family); } } /******* END *******************************/ By the way, disabledFonts is a FcStrSet variable inside FcConfig structure. What I''m doing wrong? I have never seen this error before... Thanks for the attention! -- Adriano Del Vigna de Almeida <katmandu@fs.inf.br> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.freedesktop.org/archives/fontconfig/attachments/20040102/7d0c7c5a/attachment.html
Adriano Del Vigna de Almeida
2005-Nov-21 08:50 UTC
[Fontconfig] Error accessing a FcConfig internal element
I understand your concern with encapsulation. But in some situations it is interesting to have access to the inner infromation of Fontconfig, I mean, in a very few situations. Just like a big font manager, on top of Fontconfig, I can''t see any other situation know... I think that the data structure is very concise, and dont need any modifications. Just a better way to access some hidden information, something like the FcConfigGet* calls. I''ll see later if this idea is good. See if the compiler can solve the indirection inserted by ''typedef _FcConfig FcConfig'' construction. With this sort of construction the compiler can''t resolve the internal elements of structures, when accessed outside the lib. So a call returning directly the info that I need doesn''t require a big change in the data structure. What do you think? Em Sex, 2004-01-02 ?s 15:26, Keith Packard escreveu:> Around 14 o''clock on Jan 2, Adriano Del Vigna de Almeida wrote: > > > Ok, I solved the problem adding the file ''fcint.h'' into my project. This > > is the best solution? > > No. fcint.h is an internal header file for use only within the library; > it''s not installed and shouldn''t even be shipped in binary releases of the > system. If you do use this header file, I''m tempted to promise to break > the data structure in arbitrary ways at the next release :-) > > -keith > > > > _______________________________________________ > Fontconfig mailing list > Fontconfig@fontconfig.org > http://fontconfig.org/mailman/listinfo/fontconfig >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.freedesktop.org/archives/fontconfig/attachments/20040105/e5d8db47/attachment.htm