Re: Bug with fc-match

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Patrick Lam <plam@xxxxxxx> さんは書きました:

> Mike FABIAN wrote:
>> I.e. there are both outline and bitmap versions of "Bitstream Charter"
>> available. fc-list works fine, but trying to match the outline
>> versions with fc-match doesn't work, it always matches the bitmap
>> versions:
>
> Hmm.  It's going to be hard for me to reproduce this bug because of what
> I just said.  'Bitstream Charter' is scalable whereas 'Charter' isn't,
> so it's not like they have the same name...
>
> I guess you could point me at a copy of the bitmap font called
> 'Bitstream Charter'.

If you like, you can try to apply my patch (attached) to your freetype
2.

If not I can make an edited copy of one of these bitmap fonts for you which
is already called "Bitstream Charter". 

diff -ru freetype-2.1.7/src/pcf/pcfread.c freetype-2.1.7.new/src/pcf/pcfread.c
--- freetype-2.1.7/src/pcf/pcfread.c	2004-03-15 22:47:12.761073165 +0100
+++ freetype-2.1.7.new/src/pcf/pcfread.c	2004-03-15 23:01:16.946185012 +0100
@@ -1046,12 +1046,34 @@
       prop = pcf_find_property( face, "FAMILY_NAME" );
       if ( prop && prop->isString )
       {
-        int  l = ft_strlen( prop->value.atom ) + 1;
-
-
-        if ( FT_NEW_ARRAY( root->family_name, l ) )
-          goto Exit;
-        ft_strcpy( root->family_name, prop->value.atom );
+ 	      int l = ft_strlen( prop->value.atom ) + 1;
+ 	      int wide = 0;
+ 	      PCF_Property foundry_prop = pcf_find_property( face, "FOUNDRY" );
+ 	      PCF_Property point_size_prop = pcf_find_property( face, "POINT_SIZE" );
+ 	      PCF_Property average_width_prop = pcf_find_property( face, "AVERAGE_WIDTH" );
+ 	      if ( point_size_prop != NULL && average_width_prop != NULL) {
+ 		      if ( average_width_prop->value.integer >= point_size_prop->value.integer ) {
+ 			      /* This font is at least square shaped or even wider */
+ 			      wide = 1;
+ 			      l += ft_strlen( " Wide");
+ 		      }
+ 	      }
+ 	      if ( foundry_prop != NULL && foundry_prop->isString) {
+ 		      l += ft_strlen( foundry_prop->value.atom ) + 1;
+ 		      if ( FT_NEW_ARRAY( root->family_name, l ) )
+ 			      goto Exit;
+ 		      ft_strcpy( root->family_name, foundry_prop->value.atom );
+ 		      strcat( root->family_name, " ");
+ 		      strcat( root->family_name, prop->value.atom );
+ 	      }
+ 	      else {
+ 		      if ( FT_NEW_ARRAY( root->family_name, l ) )
+ 			      goto Exit;
+ 		      ft_strcpy( root->family_name, prop->value.atom );
+ 	      }
+ 	      if ( wide != 0) {
+ 		      strcat( root->family_name, " Wide");
+ 	      }
       }
       else
         root->family_name = NULL;
-- 
Mike FABIAN   <mfabian@xxxxxxx>   http://www.suse.de/~mfabian
睡眠不足はいい仕事の敵だ。
_______________________________________________
Fontconfig mailing list
Fontconfig@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/fontconfig

[Index of Archives]     [Fedora Fonts]     [Fedora Users]     [Fedora Cloud]     [Kernel]     [Fedora Packaging]     [Fedora Desktop]     [PAM]     [Gimp Graphics Editor]     [Yosemite News]

  Powered by Linux