Issue of the Implementation # S0597


The function FcStrSetAddFilename contradicts its documentation

Detailed Description

The description of the function FcStrSetAddFilename states: "Adds a copy s to set, The copy is created with FcStrCopyFilename so that leading '~' values are replaced with the value of the HOME environment variable". But if the name of the input file is not a full path and its first character is not '~', the function FcStrCopyFilename returns concatenation of the current working directory with the file name. So the function FcStrSetAddFilename adds to the set the string, which should not be added according to the documentation.

Problem location(s) in the standard

Fontconfig Developers Reference, Version 2.4.2


        #define FILENAME        "asd"
	FcStrSet 		*ss;
	FcBool 			b;

	if (!(ss = FcStrSetCreate ()))
		printf ("Could not create StrSet\n");
        printf ("Adding the filename: '%s'\n", FILENAME);
        FcStrSetAddFilename (ss, (FcChar8 *)FILENAME);
        b = FcStrSetMember (ss, (FcChar8 *)FILENAME);
        if (b != FcTrue)
            printf ("The string '%s' was not found in the set.\n", FILENAME);


fontconfig 2.4.1 or later

Accepted Bugzilla 12965


Fixed in fontconfig 2.5.0