~ubuntu-branches/ubuntu/lucid/lcdf-typetools/lucid

« back to all changes in this revision

Viewing changes to otftotfm/secondary.cc

  • Committer: Bazaar Package Importer
  • Author(s): C.M. Connelly
  • Date: 2009-04-06 16:49:02 UTC
  • mfrom: (1.2.8 upstream) (3.1.4 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090406164902-9mu14sman9wo3112
Tags: 2.78-1
* New upstream release.
* t1lint: Report warnings when a font charstring command has too many
  arguments.
* Font library changes: correctly implement binary search in a couple
  places -- unexpected sizes could lead to overflow and bad behavior.

Show diffs side-by-side

added added

removed removed

Lines of Context:
110
110
        if (_nglyphs < 0 && post->ok())
111
111
            _nglyphs = post->nglyphs();
112
112
    }
113
 
    
 
113
 
114
114
    name = new Efont::OpenType::Name(otf->table("name"), errh);
115
115
}
116
116
 
261
261
        kerntype = Setting::KERNX;
262
262
        uni = va_arg(val, int);
263
263
    }
264
 
    
 
264
 
265
265
    for (; uni; uni = va_arg(val, int)) {
266
266
        int code = metrics.unicode_encoding(uni);
267
267
        if (code < 0) {
325
325
    for (int i = 0; i < metrics.n_mapped_fonts(); i++)
326
326
        if (metrics.mapped_font_name(i) == dj_name)
327
327
            return i;
328
 
    
 
328
 
329
329
    if (String filename = installed_type1_dotlessj(_otf_file_name, _finfo.cff->font_name(), (output_flags & G_DOTLESSJ), errh)) {
330
330
 
331
331
        // check for special case: "\0" means the font's "j" is already
332
332
        // dotless
333
333
        if (filename == String("\0", 1))
334
334
            return J_NODOT;
335
 
        
 
335
 
336
336
        // open dotless-j font file
337
337
        FILE *f = fopen(filename.c_str(), "rb");
338
338
        if (!f) {
348
348
            reader = new Efont::Type1PFBReader(f);
349
349
        else
350
350
            reader = new Efont::Type1PFAReader(f);
351
 
        Efont::Type1Font *font = new Efont::Type1Font(*reader);
 
351
        Efont::Type1Font *font = new Efont::Type1Font(*reader);
352
352
        delete reader;
353
 
        
 
353
 
354
354
        if (!font->ok()) {
355
355
            errh->error("%s: no glyphs in dotless-J font", filename.c_str());
356
356
            delete font;
362
362
        font->glyph_names(glyph_names);
363
363
        Vector<PermString>::iterator g = std::find(glyph_names.begin(), glyph_names.end(), "uni0237");
364
364
        if (g == glyph_names.end()) {
365
 
            errh->error("%s: dotless-J font has no 'uni0237' glyph", filename.c_str());
 
365
            errh->error("%s: dotless-J font has no %<uni0237%> glyph", filename.c_str());
366
366
            delete font;
367
367
            return -1;
368
368
        }
369
369
        dj_glyph = g - glyph_names.begin();
370
 
        
 
370
 
371
371
        // create metrics for dotless-J
372
372
        if (install_metrics) {
373
373
            Metrics dj_metrics(font, 256);
375
375
            ::dotlessj_file_name = filename;
376
376
            output_metrics(dj_metrics, font->font_name(), -1, _finfo, String(), String(), dj_name, dotlessj_dvips_include, errh);
377
377
        } else if (verbose)
378
 
            errh->message("using '%s' for dotless-J font metrics", dj_name.c_str());
379
 
        
 
378
            errh->message("using %<%s%> for dotless-J font metrics", dj_name.c_str());
 
379
 
380
380
        // add font to metrics
381
381
        return metrics.add_mapped_font(font, dj_name);
382
 
        
 
382
 
383
383
    } else
384
384
        return -1;
385
385
}
390
390
    Transform xform;
391
391
    int vsize = v.size();
392
392
    extern int letterspace;
393
 
    
 
393
 
394
394
    switch (uni) {
395
 
        
 
395
 
396
396
      case U_CWM:
397
397
      case U_ALTSELECTOR:
398
398
        v.push_back(Setting(Setting::RULE, 0, _xheight));
506
506
            return 1;
507
507
        }
508
508
        break;
509
 
        
 
509
 
510
510
      case U_BARDBL:
511
511
        if (char_setting(v, metrics, '|', 0)) {
512
512
            if (!_finfo.is_fixed_pitch()) {
543
543
            return 1;
544
544
        }
545
545
        break;
546
 
        
 
546
 
547
547
      case U_THREEQUARTERSEMDASH:
548
548
        if (char_setting(v, metrics, U_ENDASH, 0)) {
549
549
            if (!_finfo.is_fixed_pitch()) {
554
554
            return 1;
555
555
        }
556
556
        break;
557
 
        
 
557
 
558
558
      case U_CENTIGRADE:
559
559
        // TODO: set italic correction to that of a 'C'
560
560
        if (char_setting(v, metrics, U_USE_KERNX, U_DEGREE, 'C', 0))
561
561
            return 1;
562
562
        break;
563
 
        
 
563
 
564
564
      case U_INTERROBANG: {
565
565
          double exclam_offset =
566
566
              (char_one_bound(_finfo, xform, 4, true, 0, '?', 0)
612
612
          }
613
613
          break;
614
614
      }
615
 
        
 
615
 
616
616
    }
617
617
 
618
618
    // didn't find a good setting, restore v to pristine state