示例#1
0
boolean
kpse_bitmap_tolerance P2C(double, dpi1,  double, dpi2)
{
  unsigned tolerance = KPSE_BITMAP_TOLERANCE (dpi2);
  unsigned lower_bound = (int) (dpi2 - tolerance) < 0 ? 0 : dpi2 - tolerance;
  unsigned upper_bound = dpi2 + tolerance;

  return lower_bound <= dpi1 && dpi1 <= upper_bound;
}
示例#2
0
static string
try_resolution P4C(const_string, fontname,  unsigned, dpi,
                   kpse_file_format_type, format,
                   kpse_glyph_file_type *, glyph_file)
{
  string ret = try_size (fontname, dpi, format, glyph_file);
  
  if (!ret)
    {
      unsigned r;
      unsigned tolerance = KPSE_BITMAP_TOLERANCE (dpi);
      /* Cast to unsigned to shut up stupid compilers. */
      unsigned lower_bound = (int) (dpi - tolerance) < 0 ? 0 : (unsigned)(dpi - tolerance);
      unsigned upper_bound = (unsigned)(dpi + tolerance);
      
      /* Prefer scaling up to scaling down, since scaling down can omit
         character features (Tom did this in dvips).  */
      for (r = lower_bound; !ret && r <= upper_bound; r++)
        if (r != dpi)
          ret = try_size (fontname, r, format, glyph_file);
    }
  
  return ret;
}
static string
try_resolution P4C(const_string, font_name,
                   unsigned, dpi,
                   string *, glyph_paths,
                   kpse_font_file_type *, font_file)
{
  string ret = try_size (font_name, dpi, glyph_paths, font_file);
  
  if (!ret)
    {
      unsigned r;
      unsigned tolerance = KPSE_BITMAP_TOLERANCE (dpi);
      unsigned lower_bound = (int) (dpi - tolerance) < 0 ? 0 : dpi - tolerance;
      unsigned upper_bound = dpi + tolerance;
      
      /* Prefer scaling up to scaling down, since scaling down can omit
         character features (Tom did this in dvips).  */
      for (r = lower_bound; !ret && r <= upper_bound; r++)
        if (r != dpi)
          ret = try_size (font_name, r, glyph_paths, font_file);
    }
  
  return ret;
}