Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
BdfFont is a library for manipulating Glyph Bitmap Distribution Format (BDF) Fonts.
pip install bdffont
import shutil
from bdffont import BdfFont
from examples import assets_dir, build_dir
def main():
outputs_dir = build_dir.joinpath('load')
if outputs_dir.exists():
shutil.rmtree(outputs_dir)
outputs_dir.mkdir(parents=True)
font = BdfFont.load(assets_dir.joinpath('unifont', 'unifont-15.1.05.bdf'))
print(f'name: {font.name}')
print(f'size: {font.point_size}')
print(f'ascent: {font.properties.font_ascent}')
print(f'descent: {font.properties.font_descent}')
print()
for glyph in font.glyphs:
print(f'char: {chr(glyph.encoding)} ({glyph.encoding:04X})')
print(f'glyph_name: {glyph.name}')
print(f'advance_width: {glyph.device_width_x}')
print(f'dimensions: {glyph.dimensions}')
print(f'origin: {glyph.origin}')
for bitmap_row in glyph.bitmap:
text = ''.join(map(str, bitmap_row)).replace('0', ' ').replace('1', '██')
print(f'{text}*')
print()
font.save(outputs_dir.joinpath('unifont-15.0.01.bdf'))
if __name__ == '__main__':
main()
import shutil
from bdffont import BdfFont, BdfGlyph
from examples import build_dir
def main():
outputs_dir = build_dir.joinpath('create')
if outputs_dir.exists():
shutil.rmtree(outputs_dir)
outputs_dir.mkdir(parents=True)
font = BdfFont(
point_size=16,
resolution=(75, 75),
bounding_box=(16, 16, 0, -2),
)
font.glyphs.append(BdfGlyph(
name='A',
encoding=ord('A'),
scalable_width=(500, 0),
device_width=(8, 0),
bounding_box=(8, 16, 0, -2),
bitmap=[
[0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 1, 1, 0, 0, 0],
[0, 0, 1, 0, 0, 1, 0, 0],
[0, 0, 1, 0, 0, 1, 0, 0],
[0, 1, 0, 0, 0, 0, 1, 0],
[0, 1, 0, 0, 0, 0, 1, 0],
[0, 1, 1, 1, 1, 1, 1, 0],
[0, 1, 0, 0, 0, 0, 1, 0],
[0, 1, 0, 0, 0, 0, 1, 0],
[0, 1, 0, 0, 0, 0, 1, 0],
[0, 1, 0, 0, 0, 0, 1, 0],
[0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0],
],
))
font.properties.foundry = 'Pixel Font Studio'
font.properties.family_name = 'Demo Pixel'
font.properties.weight_name = 'Medium'
font.properties.slant = 'R'
font.properties.setwidth_name = 'Normal'
font.properties.add_style_name = 'Sans Serif'
font.properties.pixel_size = font.point_size
font.properties.point_size = font.point_size * 10
font.properties.resolution_x = font.resolution_x
font.properties.resolution_y = font.resolution_y
font.properties.spacing = 'P'
font.properties.average_width = round(sum([glyph.device_width_x * 10 for glyph in font.glyphs]) / len(font.glyphs))
font.properties.charset_registry = 'ISO10646'
font.properties.charset_encoding = '1'
font.generate_name_as_xlfd()
font.properties.default_char = -1
font.properties.font_ascent = 14
font.properties.font_descent = 2
font.properties.x_height = 5
font.properties.cap_height = 7
font.properties.font_version = '1.0.0'
font.properties.copyright = 'Copyright (c) TakWolf'
font.save(outputs_dir.joinpath('my-font.bdf'))
if __name__ == '__main__':
main()
Under the MIT license.
FAQs
A library for manipulating Glyph Bitmap Distribution Format (BDF) Fonts.
We found that bdffont demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.