Giter Club home page Giter Club logo

Comments (11)

mkoertgen avatar mkoertgen commented on June 12, 2024

Hi @Willy-Kimura, thanks for your interest,

If i understand correctly, you are suggesting some abstraction that allows for simple/dynamic switching between multiple Fonts/IconEnums including not only FontAwesome but also others like e.g. https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit.

Great idea! There would need to be some hook/abstraction that allows using a custom icon-enum & font, e.g. MaterialDesign, and enhancing it with the existing font/bitmap logic. Right now, i have not yet a good idea how to preserve the XAML-user experience because for this types need usually to be known at compile-time.

I would need to think a little about how to best fit this into the library. Meanwhile, if you have any ideas or suggestions on this let me know. If you have concrete implementation ideas, i would also love to accept a pull request on this.

from fontawesome.sharp.

Willy-Kimura avatar Willy-Kimura commented on June 12, 2024

Exactly my idea!

That's very much possible with the existing font/bitmap logic with the little/much I've gathered from the code base.

As of currently, I've implemented this type of feature by overriding a FontAwesome image/icon generator library and allowed library-switching right from a ComboBox control. However, it brought up quite some memory issues when rendering the icons at runtime and thus needs to be handled carefully for production. It's quite rusty at the moment but I can definitely give you the sources if need-be.

And even better is that a Material Icons Enumeration generation library is already provided as is FontAwesome by the same developer.

On the XAML-side, that's okay, we may be able to figure things out along the way. More checkup will need to be done on that. I'll try some few hits of my own and see how I can leverage on this feature and more. Hope to see some neat integrations on this.

Thanks a lot for your feedback.

from fontawesome.sharp.

mkoertgen avatar mkoertgen commented on June 12, 2024

Some other popular fonts to consider:

from fontawesome.sharp.

mkoertgen avatar mkoertgen commented on June 12, 2024

Added feature branch: https://github.com/awesome-inc/FontAwesome.Sharp/tree/materialicons.
Added console program for generating font enum classes from css files. Works for current FontAwesome & MaterialDesign.

from fontawesome.sharp.

mkoertgen avatar mkoertgen commented on June 12, 2024

@Willy-Kimura A memory issue with IconBlock has recently been fixed by @ThomasMentzel, cf.: #12
I'm looking forward to having some spare time in the next few days and following up on this. 👍

from fontawesome.sharp.

mkoertgen avatar mkoertgen commented on June 12, 2024

@Willy-Kimura I quickly checked on extracting a base class for IconBlock that supports using a custom font & icon-enum. I went for using the icon-enum as a generic type parameter which might seem a bit tricky. Next, i added a minimal example class using the MaterialDesign Icons font.

I did not expect the extracted dependency properties to work at all (because they are static), especially with xaml-markup. However, as far as i can tell it works surprisingly well.

I will follow up on generalizing the other wpf helpers as well. Then finally checking on the winforms part.

from fontawesome.sharp.

Willy-Kimura avatar Willy-Kimura commented on June 12, 2024

@mkoertgen Great great stuff... I followed up on the IconBlock issue. Glad it was fixed before I did. That's really interesting for generic-type-params to work well on the icon enum...

Thanks a lot! I'll definitely check-up on your next commit for the made changes.

from fontawesome.sharp.

mkoertgen avatar mkoertgen commented on June 12, 2024

About to open a pull request.

Please note that instead of dynamically switching icon library at runtime we just made it easy & simple to use other icon fonts by

  • adding a cli for generating an icon enum class
  • extracting logic into a generic base classes that depend on icon enum & font

Also note that i only added an example for WPF since WinForms needs some extra effort. Is this ok for you?

Is the suggested example for material design ok for you? Or do you really need to switch icon fonts at runtime, i.e. use both fonts concurrently?

from fontawesome.sharp.

mkoertgen avatar mkoertgen commented on June 12, 2024

@Willy-Kimura Closed this for now. Feel free to reopen to continue discussion.

from fontawesome.sharp.

Willy-Kimura avatar Willy-Kimura commented on June 12, 2024

@mkoertgen Awesome work.

Just checked out the changes including the cli-class generation method.

If this method will allow me to embed various icon fonts at design-time, then probably I can find a way of switching them during design-time for the same purpose.

from fontawesome.sharp.

mkoertgen avatar mkoertgen commented on June 12, 2024

@Willy-Kimura You're welcome. You will probably need to add some abstraction on top since the types are fount-bound. 👍

from fontawesome.sharp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.