gamecreature / QtAwesome

QtAwesome - Font Awesome for Qt Applications
Other
773 stars 147 forks source link

Adding custom icons to library #55

Closed Dariusz1989 closed 10 months ago

Dariusz1989 commented 1 year ago

Hey

Would it be possible to provide a parser/writer to let us write new icons to this library?

I'm using it more and more and would love to add more of my own icons in to it and benefit from the custom painter customizations/etc.

Regards Dariusz

gamecreature commented 1 year ago

@Dariusz1989 Could you provide some pseudo code/sample how you would like to invoke/use such a feature?

Dariusz1989 commented 1 year ago

Hey Yea I was just thinking about it. It seems like we may need second app? Or a python app... Could be python/pyside2. But I suppose we need to give it path to a resource file & write in to it QPixmap/QIcon/QImage in to "that magical format" and then create tags/strings/etc .h/.cpp etc like the ones we have from Awesome library.

In general

  1. Open app
  2. Specify resource file
  3. Read icons in it
  4. remove/rename entries
  5. add entry a. Specify either img path b. Specify QPixmap/QImage/QIcon if we are dynamically generating something via painter/etc c. Configurew tags/etc
  6. Save rsc/ generate .h/.cpp/etc/etc

I'm using cmake that dynamically adds files to project, so we could probably do somethign similar so we can add multiple resourece/h/cpp and then probably create .h init for doing Q_RESOURCE_INIT stuff to generate them dynamically... ?

I could help doing the gui/writer/loading system, But I would need help with serializing/deserializing the input data in to that black bock rsc thini I tried understanding and gave up :- )

gamecreature commented 1 year ago

@Dariusz1989 Thanks for your input. Re-reading your suggestion multiple times, I don't see how this can be put into this project. The 'magic format' is a Font file that contains (vector) icons. (QtAwesome just uses an existing font-file). It cannot convert pixmaps or other other graphics into a font file.

The 'magic' is nothing else then settings the correct font and the foreground/background colors. And drawing a certain glyph from this font. The generator (written in Ruby), takes the meta-information from the FontAwesome project to generate the correct names for the glyphs into the c++ source/header files.

(* Adding other Font-icon files should be possible, but that's another wish already placed in the issue tracker.)