- basename = re.sub ('\.pf[ab]', '',filename)
- fontname = re.sub ('-', ' ',basename)
-
- m = re.search ("([0-9]+)$", fontname)
- designsize = 'normal'
-
-
- if m:
- designsize = m.group (1)
- fontbase = re.sub ("([0-9]+)$", "", fontname)
-
-
- # FIXME: Font naming -- what a mess
- # Check sane naming with xfontsel and gtkfontsel
-
- # Adobe's font naming scheme and X11's seem to be conflicting.
- # Adobe's FontFamily seems to be X11's family + weight
- # Also, text selection applets like gtkfontsel, gfontview and
- # GNOME-applications specific ones, display X11's `family'
- # parameter as `Font', and X11's `Weight' parameter as `Style'.
-
- # Using X11 description/convention -- good for xfontsel:
- # 1 foundry: GNU
- # 2 family: LilyPond <basename>
- # 3 weight: <designsize>
- # 4 slant: r(oman) =upright
- # 5 setwidth: normal
- # 6 style:
- # 7 pixelsize: 0
- # 8 pointsize: 0 (20 crashes xfs, moved to style)
- # 9 xresolution: 0
- # 10 yresolution: 0
- # 11 spacing: p(roportional)
- # 12 averagewidth: 0
- # 13 registry: GNU
- # 14 encoding: fonstpecific
-
- # gives:
- # feta20.pfa -GNU-LilyPond feta-20-r-normal--0-0-0-0-p-0-gnu-fontspecific
-
- # However, GNOME (gtkfontsel, gnome apps) seems to want:
-
- # 1 foundry: GNU
- # 2 family: LilyPond
- # 3 weight: <basename>
- # 4 slant: r(oman) =upright
- # 5 setwidth: normal
- # 6 style: <designsize>
- # 7 pixelsize: 0
- # 8 pointsize: 0 (20 crashes xfs, moved to style)
- # 9 xresolution: 0
- # 10 yresolution: 0
- # 11 spacing: p(roportional)
- # 12 averagewidth: 0
- # 13 registry: GNU
- # 14 encoding: fonstpecific
-
- # which gives:
- # feta20.pfa -GNU-LilyPond-feta-r-normal--20-0-0-0-p-0-gnu-fontspecific
- # foundry: GNU
-
- ## ouch, pointsize 20 crashes xfs
- ## XXXfeta20.pfa -GNU-LilyPond Feta-regular-r-normal--0-20-0-0-p-0-gnu-fontspecific
-
- ## feta20.pfa -GNU-LilyPond feta-regular-r-normal-20-0-0-0-0-p-0-gnu-fontspecific
-
- afmfile = ''
- if not afmfile:
- #afmfile = find_file (basename + '.afm')
- afmfile = basename + '.afm'
-
- if afmfile:
- afmfile = os.path.abspath (afmfile)
- if os.path.exists (afmfile):
- afm = read_afm_file (afmfile)
- fontinfo = Font_info (afm.__dict__)
- else:
- fontinfo = Font_info (basename)
-
- family_name = string.join (string.split (fontinfo['FamilyName'],
- '-'), ' ')
-
- if sodipodi_p:
- print string.join ((os.path.abspath (filename),
- fontinfo.FamilyName,
- fontinfo.FamilyName,''
- ),
-
- ',')
-
- elif sketch_p:
- # Sketch's lilypond.sfd map:
- s = string.join ([fontinfo.FontName,
- fontinfo.family,
- '%s %s' % (fontinfo.weight, fontinfo.style),
- string.join (fontinfo.get_X11 ()[:4], '-'),
- string.join (fontinfo.get_X11 ()[-2:], '-'),
- fontinfo.name],
- ',')
- print s
-
- s = string.join ([fontinfo.FamilyName + fontinfo.designsize,
- fontinfo.family,
- '%s %s' % (fontinfo.weight, fontinfo.style),
- string.join (fontinfo.get_X11 ()[:4], '-'),
- string.join (fontinfo.get_X11 ()[-2:], '-'),
- fontinfo.name],
- ',')
- print s
- else:
- print filename + ' -' + string.join (fontinfo.get_X11 (), '-')
+ basename = re.sub ('\.pf[ab]', '',filename)
+ fontname = re.sub ('-', ' ',basename)
+
+ m = re.search ("([0-9]+)$", fontname)
+ designsize = 'normal'
+
+
+ if m:
+ designsize = m.group (1)
+ fontbase = re.sub ("([0-9]+)$", "", fontname)
+
+
+ # FIXME: Font naming -- what a mess
+ # Check sane naming with xfontsel and gtkfontsel
+
+ # Adobe's font naming scheme and X11's seem to be conflicting.
+ # Adobe's FontFamily seems to be X11's family + weight
+ # Also, text selection applets like gtkfontsel, gfontview and
+ # GNOME-applications specific ones, display X11's `family'
+ # parameter as `Font', and X11's `Weight' parameter as `Style'.
+
+ # Using X11 description/convention -- good for xfontsel:
+ # 1 foundry: GNU
+ # 2 family: LilyPond <basename>
+ # 3 weight: <designsize>
+ # 4 slant: r(oman) =upright
+ # 5 setwidth: normal
+ # 6 style:
+ # 7 pixelsize: 0
+ # 8 pointsize: 0 (20 crashes xfs, moved to style)
+ # 9 xresolution: 0
+ # 10 yresolution: 0
+ # 11 spacing: p(roportional)
+ # 12 averagewidth: 0
+ # 13 registry: GNU
+ # 14 encoding: fonstpecific
+
+ # gives:
+ # feta20.pfa -GNU-LilyPond feta-20-r-normal--0-0-0-0-p-0-gnu-fontspecific
+
+ # However, GNOME (gtkfontsel, gnome apps) seems to want:
+
+ # 1 foundry: GNU
+ # 2 family: LilyPond
+ # 3 weight: <basename>
+ # 4 slant: r(oman) =upright
+ # 5 setwidth: normal
+ # 6 style: <designsize>
+ # 7 pixelsize: 0
+ # 8 pointsize: 0 (20 crashes xfs, moved to style)
+ # 9 xresolution: 0
+ # 10 yresolution: 0
+ # 11 spacing: p(roportional)
+ # 12 averagewidth: 0
+ # 13 registry: GNU
+ # 14 encoding: fonstpecific
+
+ # which gives:
+ # feta20.pfa -GNU-LilyPond-feta-r-normal--20-0-0-0-p-0-gnu-fontspecific
+ # foundry: GNU
+
+ ## ouch, pointsize 20 crashes xfs
+ ## XXXfeta20.pfa -GNU-LilyPond Feta-regular-r-normal--0-20-0-0-p-0-gnu-fontspecific
+
+ ## feta20.pfa -GNU-LilyPond feta-regular-r-normal-20-0-0-0-0-p-0-gnu-fontspecific
+
+ afmfile = ''
+ if not afmfile:
+ #afmfile = find_file (basename + '.afm')
+ afmfile = basename + '.afm'
+
+ if afmfile:
+ afmfile = os.path.abspath (afmfile)
+ if os.path.exists (afmfile):
+ afm = read_afm_file (afmfile)
+ fontinfo = Font_info (afm.__dict__)
+ else:
+ fontinfo = Font_info (basename)
+
+ family_name = string.join (string.split (fontinfo['FamilyName'],
+ '-'), ' ')
+
+ if sodipodi_p:
+ print string.join ((os.path.abspath (filename),
+ fontinfo.FamilyName,
+ fontinfo.FamilyName,''
+ ),
+
+ ',')
+
+ elif sketch_p:
+ # Sketch's lilypond.sfd map:
+ s = string.join ([fontinfo.FontName,
+ fontinfo.family,
+ '%s %s' % (fontinfo.weight, fontinfo.style),
+ string.join (fontinfo.get_X11 ()[:4], '-'),
+ string.join (fontinfo.get_X11 ()[-2:], '-'),
+ fontinfo.name],
+ ',')
+ print s
+
+ s = string.join ([fontinfo.FamilyName + fontinfo.designsize,
+ fontinfo.family,
+ '%s %s' % (fontinfo.weight, fontinfo.style),
+ string.join (fontinfo.get_X11 ()[:4], '-'),
+ string.join (fontinfo.get_X11 ()[-2:], '-'),
+ fontinfo.name],
+ ',')
+ print s
+ else:
+ print filename + ' -' + string.join (fontinfo.get_X11 (), '-')