Skip to content

StateMapGenerator failure due to Pillow removing font.getsize #4

@malonkey1

Description

@malonkey1

When running the StateMapGenerator with current version of Pillow, the script fails:

Traceback (most recent call last):
  File "D:\steam\steamapps\workshop\content\394360\1521695605\map\hoi4statemapgenerator.py", line 640, in <module>
    main()
  File "D:\steam\steamapps\workshop\content\394360\1521695605\map\hoi4statemapgenerator.py", line 615, in main
    create_states_map_with_id(colors_replacement_dict, province_map, [round(255 * x) for x in water_color], args.font)
  File "D:\steam\steamapps\workshop\content\394360\1521695605\map\hoi4statemapgenerator.py", line 292, in create_states_map_with_id
    state_pixels[key] = (value, font.getsize(str(key)))
AttributeError: 'FreeTypeFont' object has no attribute 'getsize'

When rolling back to Pillow 9.5, the issue is resolved. This is likely due to font.getsize being removed from Pillow in version 10.0.0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions