Merge pull request #6626 from hodefoting/master

vtvideo.cpp: Implement pixel stretching of characters.
This commit is contained in:
R. Belmont 2020-05-03 16:15:52 -04:00 committed by GitHub
commit a951bc0882
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -630,6 +630,53 @@ void vt100_video_device::display_char(bitmap_ind16 &bitmap, uint8_t code, int x,
if (m_columns == 80)
bitmap.pix16(y_preset, x_preset + 9) = bit;
}
/* The DEC terminals use a single ROM bitmap font and
* dot-stretching to synthesize multiple variants that are not
* just nearest neighbor resampled. The result is the same
* as one would get by fake-bolding; the already doubled raster image;
* by rendering twice with 1px horizontal offset.
*
* For details see: https://vt100.net/dec/vt220/glyphs
*/
int prev_bit = back_intensity;
int bits_width = 21;
if (!double_width)
{
if (m_columns == 80)
bits_width = 11;
else
bits_width = 10;
}
for (int b = 0; b < bits_width; b++)
{
if (double_width)
{
if (bitmap.pix16(y_preset, DOUBLE_x_preset + b) == fg_intensity)
{
prev_bit = fg_intensity;
}
else
{
if (prev_bit == fg_intensity)
bitmap.pix16(y_preset, DOUBLE_x_preset + b) = fg_intensity;
prev_bit = back_intensity;
}
}
else
{
if (bitmap.pix16(y_preset, x_preset + b) == fg_intensity)
{
prev_bit = fg_intensity;
}
else
{
if (prev_bit == fg_intensity)
bitmap.pix16(y_preset, x_preset + b) = fg_intensity;
prev_bit = back_intensity;
}
}
}
} // for (scan_line)
}