1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
|
# File 'lib/makefont.rb', line 1472
def MakeFontDescriptor(fm, symbolic)
asc = fm['Ascender'] ? fm['Ascender'] : 1000
fd = "{\n 'Ascent' => '#{asc}'"
desc = fm['Descender'] ? fm['Descender'] : -200
fd += ", 'Descent' => '#{desc}'"
if fm['CapHeight'] then
ch = fm['CapHeight']
elsif fm['CapXHeight']
ch = fm['CapXHeight']
else
ch = asc
end
fd += ", 'CapHeight' => '#{ch}'"
flags = 0
if fm['IsFixedPitch'] then
flags += 1 << 0
end
if symbolic then
flags += 1 << 2
else
flags += 1 << 5
end
if fm['ItalicAngle'] && (fm['ItalicAngle'] != 0) then
flags += 1 << 6
end
fd += ",\n 'Flags' => '#{flags}'"
if fm['FontBBox'] then
fbb = fm['FontBBox'].gsub(/,/, ' ')
else
fbb = "[0 #{desc - 100} 1000 #{asc + 100}]"
end
fd += ", 'FontBBox' => '#{fbb}'"
ia = fm['ItalicAngle'] ? fm['ItalicAngle'] : 0
fd += ",\n 'ItalicAngle' => '#{ia}'"
if fm['StdVW'] then
stemv = fm['StdVW']
elsif fm['Weight'] && (/bold|black/i =~ fm['Weight'])
stemv = 120
else
stemv = 70
end
fd += ", 'StemV' => '#{stemv}'"
if fm['MissingWidth'] then
fd += ", 'MissingWidth' => '#{fm['MissingWidth']}'"
end
fd += "\n }"
return fd
end
|