···88 sha256 = "0llraqw86jmw4vzv7inskp3xxm2gc64my08iwq5mzncgfdbfza4f";
99 };
10101111- patches = [
1212- # FreeType 2.7 prefixes PCF font family names with the foundry name.
1313- # The output of fc-list and fc-query change which breaks the tests.
1414- ./test-pcf-family-names-freetype-2.7.patch
1515- ];
1616-1711 outputs = [ "bin" "dev" "lib" "out" ]; # $out contains all the config
18121913 propagatedBuildInputs = [ freetype ];
-4
pkgs/development/libraries/fontconfig/default.nix
···3333 url = "https://cgit.freedesktop.org/fontconfig/patch/?id=1ab5258f7c";
3434 sha256 = "0x2a4qx51j3gqcp1kp4lisdzmhrkw1zw0r851d82ksgjlc0vkbaz";
3535 })
3636-3737- # FreeType 2.7 prefixes PCF font family names with the foundry name.
3838- # The output of fc-list and fc-query change which breaks the tests.
3939- ./test-pcf-family-names-freetype-2.7.patch
4036 ];
4137 # additionally required for the glibc-2.25 patch; avoid requiring gperf
4238 postPatch = ''
···11+diff --git a/devel/ftoption.h b/devel/ftoption.h
22+index 3b63931..b8b0a8d 100644
33+--- a/devel/ftoption.h
44++++ b/devel/ftoption.h
55+@@ -82,8 +82,8 @@ FT_BEGIN_HEADER
66+ /* to control the various font drivers and modules. The controllable */
77+ /* properties are listed in the section `Controlling FreeType Modules' */
88+ /* in the reference's table of contents; currently there are properties */
99+- /* for the auto-hinter (file `ftautoh.h'), CFF (file `ftcffdrv.h'), and */
1010+- /* TrueType (file `ftttdrv.h'). */
1111++ /* for the auto-hinter (file `ftautoh.h'), CFF (file `ftcffdrv.h'), */
1212++ /* TrueType (file `ftttdrv.h'), and PCF (file `ftpcfdrv.h'). */
1313+ /* */
1414+ /* `FREETYPE_PROPERTIES' has the following syntax form (broken here into */
1515+ /* multiple lines for better readability). */
1616+@@ -835,6 +835,33 @@ FT_BEGIN_HEADER
1717+ /*************************************************************************/
1818+ /*************************************************************************/
1919+ /**** ****/
2020++ /**** P C F D R I V E R C O N F I G U R A T I O N ****/
2121++ /**** ****/
2222++ /*************************************************************************/
2323++ /*************************************************************************/
2424++
2525++
2626++ /*************************************************************************/
2727++ /* */
2828++ /* There are many PCF fonts just called `Fixed' which look completely */
2929++ /* different, and which have nothing to do with each other. When */
3030++ /* selecting `Fixed' in KDE or Gnome one gets results that appear rather */
3131++ /* random, the style changes often if one changes the size and one */
3232++ /* cannot select some fonts at all. This option makes the PCF module */
3333++ /* prepend the foundry name (plus a space) to the family name. */
3434++ /* */
3535++ /* We also check whether we have `wide' characters; all put together, we */
3636++ /* get family names like `Sony Fixed' or `Misc Fixed Wide'. */
3737++ /* */
3838++ /* If this option is activated, it can be controlled with the */
3939++ /* `no-long-family-names' property of the pcf driver module. */
4040++ /* */
4141++#define PCF_CONFIG_OPTION_LONG_FAMILY_NAMES
4242++
4343++
4444++ /*************************************************************************/
4545++ /*************************************************************************/
4646++ /**** ****/
4747+ /**** A U T O F I T M O D U L E C O N F I G U R A T I O N ****/
4848+ /**** ****/
4949+ /*************************************************************************/
5050+diff --git a/docs/CHANGES b/docs/CHANGES
5151+index cb3b327..3823395 100644
5252+--- a/docs/CHANGES
5353++++ b/docs/CHANGES
5454+@@ -1,4 +1,20 @@
5555+5656++CHANGES BETWEEN 2.7.1 and 2.7.2
5757++
5858++ I. IMPORTANT CHANGES
5959++
6060++ - The PCF change to show more `colourful' family names (introduced
6161++ in version 2.7.1) was too radical; it can now be configured with
6262++ PCF_CONFIG_OPTION_LONG_FAMILY_NAMES at compile time. If
6363++ activated, it can be switched off at run time with the new pcf
6464++ property `no-long-family-names'. If the `FREETYPE_PROPERTIES'
6565++ environment variable is available, you can say
6666++
6767++ FREETYPE_PROPERTIES=pcf:no-long-family-names=1
6868++
6969++
7070++======================================================================
7171++
7272+ CHANGES BETWEEN 2.7 and 2.7.1
7373+7474+ I. IMPORTANT CHANGES
7575+diff --git a/include/freetype/config/ftheader.h b/include/freetype/config/ftheader.h
7676+index 950d36c..d491af5 100644
7777+--- a/include/freetype/config/ftheader.h
7878++++ b/include/freetype/config/ftheader.h
7979+@@ -357,6 +357,19 @@
8080+ /*************************************************************************
8181+ *
8282+ * @macro:
8383++ * FT_PCF_DRIVER_H
8484++ *
8585++ * @description:
8686++ * A macro used in #include statements to name the file containing
8787++ * structures and macros related to the PCF driver module.
8888++ *
8989++ */
9090++#define FT_PCF_DRIVER_H <freetype/ftpcfdrv.h>
9191++
9292++
9393++ /*************************************************************************
9494++ *
9595++ * @macro:
9696+ * FT_TYPE1_TABLES_H
9797+ *
9898+ * @description:
9999+diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h
100100+index f5bc540..5676074 100644
101101+--- a/include/freetype/config/ftoption.h
102102++++ b/include/freetype/config/ftoption.h
103103+@@ -82,8 +82,8 @@ FT_BEGIN_HEADER
104104+ /* to control the various font drivers and modules. The controllable */
105105+ /* properties are listed in the section `Controlling FreeType Modules' */
106106+ /* in the reference's table of contents; currently there are properties */
107107+- /* for the auto-hinter (file `ftautoh.h'), CFF (file `ftcffdrv.h'), and */
108108+- /* TrueType (file `ftttdrv.h'). */
109109++ /* for the auto-hinter (file `ftautoh.h'), CFF (file `ftcffdrv.h'), */
110110++ /* TrueType (file `ftttdrv.h'), and PCF (file `ftpcfdrv.h'). */
111111+ /* */
112112+ /* `FREETYPE_PROPERTIES' has the following syntax form (broken here into */
113113+ /* multiple lines for better readability). */
114114+@@ -835,6 +835,33 @@ FT_BEGIN_HEADER
115115+ /*************************************************************************/
116116+ /*************************************************************************/
117117+ /**** ****/
118118++ /**** P C F D R I V E R C O N F I G U R A T I O N ****/
119119++ /**** ****/
120120++ /*************************************************************************/
121121++ /*************************************************************************/
122122++
123123++
124124++ /*************************************************************************/
125125++ /* */
126126++ /* There are many PCF fonts just called `Fixed' which look completely */
127127++ /* different, and which have nothing to do with each other. When */
128128++ /* selecting `Fixed' in KDE or Gnome one gets results that appear rather */
129129++ /* random, the style changes often if one changes the size and one */
130130++ /* cannot select some fonts at all. This option makes the PCF module */
131131++ /* prepend the foundry name (plus a space) to the family name. */
132132++ /* */
133133++ /* We also check whether we have `wide' characters; all put together, we */
134134++ /* get family names like `Sony Fixed' or `Misc Fixed Wide'. */
135135++ /* */
136136++ /* If this option is activated, it can be controlled with the */
137137++ /* `no-long-family-names' property of the pcf driver module. */
138138++ /* */
139139++#define PCF_CONFIG_OPTION_LONG_FAMILY_NAMES
140140++
141141++
142142++ /*************************************************************************/
143143++ /*************************************************************************/
144144++ /**** ****/
145145+ /**** A U T O F I T M O D U L E C O N F I G U R A T I O N ****/
146146+ /**** ****/
147147+ /*************************************************************************/
148148+diff --git a/include/freetype/ftchapters.h b/include/freetype/ftchapters.h
149149+index ab43895..a0a121b 100644
150150+--- a/include/freetype/ftchapters.h
151151++++ b/include/freetype/ftchapters.h
152152+@@ -77,6 +77,7 @@
153153+ /* auto_hinter */
154154+ /* cff_driver */
155155+ /* tt_driver */
156156++/* pcf_driver */
157157+ /* */
158158+ /***************************************************************************/
159159+160160+diff --git a/include/freetype/ftpcfdrv.h b/include/freetype/ftpcfdrv.h
161161+new file mode 100644
162162+index 0000000..6622c93
163163+--- /dev/null
164164++++ b/include/freetype/ftpcfdrv.h
165165+@@ -0,0 +1,105 @@
166166++/***************************************************************************/
167167++/* */
168168++/* ftpcfdrv.h */
169169++/* */
170170++/* FreeType API for controlling the PCF driver (specification only). */
171171++/* */
172172++/* Copyright 2017 by */
173173++/* David Turner, Robert Wilhelm, and Werner Lemberg. */
174174++/* */
175175++/* This file is part of the FreeType project, and may only be used, */
176176++/* modified, and distributed under the terms of the FreeType project */
177177++/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
178178++/* this file you indicate that you have read the license and */
179179++/* understand and accept it fully. */
180180++/* */
181181++/***************************************************************************/
182182++
183183++
184184++#ifndef FTPCFDRV_H_
185185++#define FTPCFDRV_H_
186186++
187187++#include <ft2build.h>
188188++#include FT_FREETYPE_H
189189++
190190++#ifdef FREETYPE_H
191191++#error "freetype.h of FreeType 1 has been loaded!"
192192++#error "Please fix the directory search order for header files"
193193++#error "so that freetype.h of FreeType 2 is found first."
194194++#endif
195195++
196196++
197197++FT_BEGIN_HEADER
198198++
199199++
200200++ /**************************************************************************
201201++ *
202202++ * @section:
203203++ * pcf_driver
204204++ *
205205++ * @title:
206206++ * The PCF driver
207207++ *
208208++ * @abstract:
209209++ * Controlling the PCF driver module.
210210++ *
211211++ * @description:
212212++ * While FreeType's PCF driver doesn't expose API functions by itself,
213213++ * it is possible to control its behaviour with @FT_Property_Set and
214214++ * @FT_Property_Get. Right now, there is a single property
215215++ * `no-long-family-names' available if FreeType is compiled with
216216++ * PCF_CONFIG_OPTION_LONG_FAMILY_NAMES.
217217++ *
218218++ * The PCF driver's module name is `pcf'.
219219++ *
220220++ */
221221++
222222++
223223++ /**************************************************************************
224224++ *
225225++ * @property:
226226++ * no-long-family-names
227227++ *
228228++ * @description:
229229++ * If PCF_CONFIG_OPTION_LONG_FAMILY_NAMES is active while compiling
230230++ * FreeType, the PCF driver constructs long family names.
231231++ *
232232++ * There are many PCF fonts just called `Fixed' which look completely
233233++ * different, and which have nothing to do with each other. When
234234++ * selecting `Fixed' in KDE or Gnome one gets results that appear rather
235235++ * random, the style changes often if one changes the size and one
236236++ * cannot select some fonts at all. The improve this situation, the PCF
237237++ * module prepends the foundry name (plus a space) to the family name.
238238++ * It also checks whether there are `wide' characters; all put together,
239239++ * family names like `Sony Fixed' or `Misc Fixed Wide' are constructed.
240240++ *
241241++ * If `no-long-family-names' is set, this feature gets switched off.
242242++ *
243243++ * {
244244++ * FT_Library library;
245245++ * FT_Bool no_long_family_names = TRUE;
246246++ *
247247++ *
248248++ * FT_Init_FreeType( &library );
249249++ *
250250++ * FT_Property_Set( library, "pcf",
251251++ * "no-long-family-names",
252252++ * &no_long_family_names );
253253++ * }
254254++ *
255255++ * @note:
256256++ * This property can be used with @FT_Property_Get also.
257257++ *
258258++ * This property can be set via the `FREETYPE_PROPERTIES' environment
259259++ * variable (using values 1 and 0 for `on' and `off', respectively).
260260++ *
261261++ */
262262++
263263++
264264++FT_END_HEADER
265265++
266266++
267267++#endif /* FTPCFDRV_H_ */
268268++
269269++
270270++/* END */
271271+diff --git a/src/pcf/pcf.h b/src/pcf/pcf.h
272272+index 830cabe..f0390cb 100644
273273+--- a/src/pcf/pcf.h
274274++++ b/src/pcf/pcf.h
275275+@@ -167,6 +167,8 @@ FT_BEGIN_HEADER
276276+ {
277277+ FT_DriverRec root;
278278+279279++ FT_Bool no_long_family_names;
280280++
281281+ } PCF_DriverRec, *PCF_Driver;
282282+283283+284284+diff --git a/src/pcf/pcfdrivr.c b/src/pcf/pcfdrivr.c
285285+index 8f4a90d..bc65423 100644
286286+--- a/src/pcf/pcfdrivr.c
287287++++ b/src/pcf/pcfdrivr.c
288288+@@ -49,6 +49,8 @@ THE SOFTWARE.
289289+290290+ #include FT_SERVICE_BDF_H
291291+ #include FT_SERVICE_FONT_FORMAT_H
292292++#include FT_SERVICE_PROPERTIES_H
293293++#include FT_PCF_DRIVER_H
294294+295295+296296+ /*************************************************************************/
297297+@@ -667,6 +669,110 @@ THE SOFTWARE.
298298+ };
299299+300300+301301++ /*
302302++ * PROPERTY SERVICE
303303++ *
304304++ */
305305++ static FT_Error
306306++ pcf_property_set( FT_Module module, /* PCF_Driver */
307307++ const char* property_name,
308308++ const void* value,
309309++ FT_Bool value_is_string )
310310++ {
311311++#ifdef PCF_CONFIG_OPTION_LONG_FAMILY_NAMES
312312++
313313++ FT_Error error = FT_Err_Ok;
314314++ PCF_Driver driver = (PCF_Driver)module;
315315++
316316++#ifndef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
317317++ FT_UNUSED( value_is_string );
318318++#endif
319319++
320320++
321321++ if ( !ft_strcmp( property_name, "no-long-family-names" ) )
322322++ {
323323++#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
324324++ if ( value_is_string )
325325++ {
326326++ const char* s = (const char*)value;
327327++ long lfn = ft_strtol( s, NULL, 10 );
328328++
329329++
330330++ if ( lfn == 0 )
331331++ driver->no_long_family_names = 0;
332332++ else if ( lfn == 1 )
333333++ driver->no_long_family_names = 1;
334334++ else
335335++ return FT_THROW( Invalid_Argument );
336336++ }
337337++ else
338338++#endif
339339++ {
340340++ FT_Bool* no_long_family_names = (FT_Bool*)value;
341341++
342342++
343343++ driver->no_long_family_names = *no_long_family_names;
344344++ }
345345++
346346++ return error;
347347++ }
348348++
349349++#else /* !PCF_CONFIG_OPTION_LONG_FAMILY_NAMES */
350350++
351351++ FT_UNUSED( module );
352352++ FT_UNUSED( value );
353353++ FT_UNUSED( value_is_string );
354354++
355355++#endif /* !PCF_CONFIG_OPTION_LONG_FAMILY_NAMES */
356356++
357357++ FT_TRACE0(( "pcf_property_set: missing property `%s'\n",
358358++ property_name ));
359359++ return FT_THROW( Missing_Property );
360360++ }
361361++
362362++
363363++ static FT_Error
364364++ pcf_property_get( FT_Module module, /* PCF_Driver */
365365++ const char* property_name,
366366++ const void* value )
367367++ {
368368++#ifdef PCF_CONFIG_OPTION_LONG_FAMILY_NAMES
369369++
370370++ FT_Error error = FT_Err_Ok;
371371++ PCF_Driver driver = (PCF_Driver)module;
372372++
373373++
374374++ if ( !ft_strcmp( property_name, "no-long-family-names" ) )
375375++ {
376376++ FT_Bool no_long_family_names = driver->no_long_family_names;
377377++ FT_Bool* val = (FT_Bool*)value;
378378++
379379++
380380++ *val = no_long_family_names;
381381++
382382++ return error;
383383++ }
384384++
385385++#else /* !PCF_CONFIG_OPTION_LONG_FAMILY_NAMES */
386386++
387387++ FT_UNUSED( module );
388388++ FT_UNUSED( value );
389389++
390390++#endif /* !PCF_CONFIG_OPTION_LONG_FAMILY_NAMES */
391391++
392392++ FT_TRACE0(( "pcf_property_get: missing property `%s'\n",
393393++ property_name ));
394394++ return FT_THROW( Missing_Property );
395395++ }
396396++
397397++
398398++ FT_DEFINE_SERVICE_PROPERTIESREC(
399399++ pcf_service_properties,
400400++
401401++ (FT_Properties_SetFunc)pcf_property_set, /* set_property */
402402++ (FT_Properties_GetFunc)pcf_property_get ) /* get_property */
403403++
404404++
405405+ /*
406406+ *
407407+ * SERVICE LIST
408408+@@ -677,6 +783,7 @@ THE SOFTWARE.
409409+ {
410410+ { FT_SERVICE_ID_BDF, &pcf_service_bdf },
411411+ { FT_SERVICE_ID_FONT_FORMAT, FT_FONT_FORMAT_PCF },
412412++ { FT_SERVICE_ID_PROPERTIES, &pcf_service_properties },
413413+ { NULL, NULL }
414414+ };
415415+416416+@@ -694,7 +801,14 @@ THE SOFTWARE.
417417+ FT_CALLBACK_DEF( FT_Error )
418418+ pcf_driver_init( FT_Module module ) /* PCF_Driver */
419419+ {
420420++#ifdef PCF_CONFIG_OPTION_LONG_FAMILY_NAMES
421421++ PCF_Driver driver = (PCF_Driver)module;
422422++
423423++
424424++ driver->no_long_family_names = 0;
425425++#else
426426+ FT_UNUSED( module );
427427++#endif
428428+429429+ return FT_Err_Ok;
430430+ }
431431+diff --git a/src/pcf/pcfread.c b/src/pcf/pcfread.c
432432+index 38ba110..3eacf2b 100644
433433+--- a/src/pcf/pcfread.c
434434++++ b/src/pcf/pcfread.c
435435+@@ -1393,57 +1393,75 @@ THE SOFTWARE.
436436+ prop = pcf_find_property( face, "FAMILY_NAME" );
437437+ if ( prop && prop->isString )
438438+ {
439439+- /* Prepend the foundry name plus a space to the family name. */
440440+- /* There are many fonts just called `Fixed' which look completely */
441441+- /* different, and which have nothing to do with each other. When */
442442+- /* selecting `Fixed' in KDE or Gnome one gets results that appear */
443443+- /* rather random, the style changes often if one changes the size */
444444+- /* and one cannot select some fonts at all. */
445445+- /* */
446446+- /* We also check whether we have `wide' characters; all put */
447447+- /* together, we get family names like `Sony Fixed' or `Misc Fixed */
448448+- /* Wide'. */
449449+- PCF_Property foundry_prop, point_size_prop, average_width_prop;
450450+-
451451+- int l = ft_strlen( prop->value.atom ) + 1;
452452+- int wide = 0;
453453+-
454454+-
455455+- foundry_prop = pcf_find_property( face, "FOUNDRY" );
456456+- point_size_prop = pcf_find_property( face, "POINT_SIZE" );
457457+- average_width_prop = pcf_find_property( face, "AVERAGE_WIDTH" );
458458+-
459459+- if ( point_size_prop && average_width_prop )
460460++
461461++#ifdef PCF_CONFIG_OPTION_LONG_FAMILY_NAMES
462462++
463463++ PCF_Driver driver = (PCF_Driver)FT_FACE_DRIVER( face );
464464++
465465++
466466++ if ( !driver->no_long_family_names )
467467+ {
468468+- if ( average_width_prop->value.l >= point_size_prop->value.l )
469469++ /* Prepend the foundry name plus a space to the family name. */
470470++ /* There are many fonts just called `Fixed' which look */
471471++ /* completely different, and which have nothing to do with each */
472472++ /* other. When selecting `Fixed' in KDE or Gnome one gets */
473473++ /* results that appear rather random, the style changes often if */
474474++ /* one changes the size and one cannot select some fonts at all. */
475475++ /* */
476476++ /* We also check whether we have `wide' characters; all put */
477477++ /* together, we get family names like `Sony Fixed' or `Misc */
478478++ /* Fixed Wide'. */
479479++
480480++ PCF_Property foundry_prop, point_size_prop, average_width_prop;
481481++
482482++ int l = ft_strlen( prop->value.atom ) + 1;
483483++ int wide = 0;
484484++
485485++
486486++ foundry_prop = pcf_find_property( face, "FOUNDRY" );
487487++ point_size_prop = pcf_find_property( face, "POINT_SIZE" );
488488++ average_width_prop = pcf_find_property( face, "AVERAGE_WIDTH" );
489489++
490490++ if ( point_size_prop && average_width_prop )
491491+ {
492492+- /* This font is at least square shaped or even wider */
493493+- wide = 1;
494494+- l += ft_strlen( " Wide" );
495495++ if ( average_width_prop->value.l >= point_size_prop->value.l )
496496++ {
497497++ /* This font is at least square shaped or even wider */
498498++ wide = 1;
499499++ l += ft_strlen( " Wide" );
500500++ }
501501+ }
502502+- }
503503+504504+- if ( foundry_prop && foundry_prop->isString )
505505+- {
506506+- l += ft_strlen( foundry_prop->value.atom ) + 1;
507507++ if ( foundry_prop && foundry_prop->isString )
508508++ {
509509++ l += ft_strlen( foundry_prop->value.atom ) + 1;
510510+511511+- if ( FT_NEW_ARRAY( root->family_name, l ) )
512512+- goto Exit;
513513++ if ( FT_NEW_ARRAY( root->family_name, l ) )
514514++ goto Exit;
515515++
516516++ ft_strcpy( root->family_name, foundry_prop->value.atom );
517517++ ft_strcat( root->family_name, " " );
518518++ ft_strcat( root->family_name, prop->value.atom );
519519++ }
520520++ else
521521++ {
522522++ if ( FT_NEW_ARRAY( root->family_name, l ) )
523523++ goto Exit;
524524+525525+- ft_strcpy( root->family_name, foundry_prop->value.atom );
526526+- ft_strcat( root->family_name, " " );
527527+- ft_strcat( root->family_name, prop->value.atom );
528528++ ft_strcpy( root->family_name, prop->value.atom );
529529++ }
530530++
531531++ if ( wide )
532532++ ft_strcat( root->family_name, " Wide" );
533533+ }
534534+ else
535535++
536536++#endif /* PCF_CONFIG_OPTION_LONG_FAMILY_NAMES */
537537++
538538+ {
539539+- if ( FT_NEW_ARRAY( root->family_name, l ) )
540540++ if ( FT_STRDUP( root->family_name, prop->value.atom ) )
541541+ goto Exit;
542542+-
543543+- ft_strcpy( root->family_name, prop->value.atom );
544544+ }
545545+-
546546+- if ( wide )
547547+- ft_strcat( root->family_name, " Wide" );
548548+ }
549549+ else
550550+ root->family_name = NULL;
551551+--
552552+cgit v1.0-41-gc330
553553+
···7979 # Delete obsolete stuff that conflicts with cups-filters.
8080 rm -rf $out/share/cups/banners $out/share/cups/data/testprint
81818282+ # Some outputs in cups-config were unexpanded and some even wrong.
8283 moveToOutput bin/cups-config "$dev"
8484+ sed -e "/^cups_serverbin=/s|\$(lib)|$out|" \
8585+ -e "s|\$(out)|$out|" \
8686+ -e "s|\$(lib)|$lib|" \
8787+ -i "$dev/bin/cups-config"
83888489 # Rename systemd files provided by CUPS
8590 for f in "$out"/lib/systemd/system/*; do