by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • May 28 23:12
    CaduhDEV opened #138
  • May 16 11:24
    willhuo commented #112
  • May 15 14:32
    jacamera edited #137
  • May 15 14:30
    jacamera opened #137
  • May 13 11:17

    tocsoft on master

    and now include the license file (compare)

  • May 13 11:16

    tocsoft on master

    fix package licence (compare)

  • May 13 09:47

    tocsoft on v1.0.0-beta.11

    (compare)

  • May 13 09:45

    tocsoft on private-compiler

    (compare)

  • May 13 09:45

    tocsoft on master

    make compiler toolset private Merge pull request #136 from Si… (compare)

  • May 13 09:45
    tocsoft closed #136
  • May 13 09:43
    codecov[bot] commented #136
  • May 13 09:39
    tocsoft opened #136
  • May 13 09:38

    tocsoft on private-compiler

    make compiler toolset private (compare)

  • May 13 09:22

    tocsoft on v1.0.0-beta10

    (compare)

  • May 08 19:03

    tocsoft on beta10

    (compare)

  • May 08 19:03

    tocsoft on master

    Update license to AGPL3 Merge pull request #135 from Si… (compare)

  • May 08 19:03
    tocsoft closed #135
  • May 08 10:52
    codecov[bot] commented #135
  • May 08 10:49
    tocsoft review_requested #135
  • May 08 10:49
    tocsoft opened #135
Akash Borad
@boradakash

I am using ImageSharp.Drawing(1.0.0-alpha9-00189)
I want to add text and glyphicon on the image

Here is my code:

FontFamily font= FontCollection.Install(@"E:\Frames\gothamrnd-medium.ttf");
var textLocation = new SixLabors.Primitives.PointF(200, 200);
image.DrawText("Hello world", this.font, NamedColors<Rgba32>.Black,textLocation,TextGraphicsOptions.Default);

I am getting the error in the third line for this.font
Because it is FontFamily but it should be of Type Font
Can anybody give me some similar example or solution for this problem?
Thanks

Scott Williams
@tocsoft
you need to create a new Font instance from the FontFamily class it should be just be new Font(family, size) where family is the installed font family and size is the size in points
Scott Williams
@tocsoft
also (as i'm not sure it very obvious) you will want to make sure you keep hold of your FontCollection instance for as long as possible (i.e. don't new one up and install the font every time you want to draw an icon) as installing a font into the collection is quite an expensive operation... most people probably just want a global singleton some where with the fonts installed..
Getting a FontFamily out of a collection which already have fonts installed is quite cheep so you don't have to retain the FontFamily objects (they are really just small points to stuff internal to the collection anyway) just the collection itself.
Akash Borad
@boradakash
Thanks, it works
Akash Borad
@boradakash
Is there a way to use icon(i.e fontawesome), If I want to display it on image?
Scott Williams
@tocsoft
fontawesome is just a font so it will work fine... you just need to make sure us you user the unicode escape codes for choosing the glyphs as they don't map to standard character ranges.
Stephan Vedder
@feliwir
Hey, just found that library and it looks really nice. I was wondering if it could make use of the new System.Drawing.Font that becomes part of .net core 2.1
Stephan Vedder
@feliwir
(the System.Drawing.Common package is that)
Jesse
@Jjagg
@tocsoft Is there a reason there is no setter for the Font property of RendererOptions? Mind if I add it?
Chris
@furesoft
how can i use this lib in wpf?
Stephan Vedder
@feliwir
What's the difference between Font and FontInstance? Why are Glyphs only accesible internally? @tocsoft
Stephan Vedder
@feliwir
Did a PR
Scott Williams
@tocsoft
@furesoft yes it can be used anywhere netstandard 1.3 can be used... however what is it you expect the fonts library will do for you in WPF? by itself it will only measure and layout glyphs, it doesn't actually render anything directly you would have to implement a custom IGlyphRenderer to access the points and line for the glyphs to render them yourself or use other libraries (i.e. Imagesharp) to rasterize them for you.
Johan Talboom
@Borf
I'm running in docker on a dotnet core 2.2 image, on linux, but for some reason I can't get a .ttf file to load. The description is is not null if I do var desc = FontDescription.LoadDescription("./tahoma.ttf") , but the FontName, FontFamily etc are all empty. How am I supposed to load a font under linux? (also the SystemFonts.Families is empty
Stephan Vedder
@feliwir
Would it be possible to split the drawing & loading part of: https://github.com/SixLabors/Fonts into 2 seperate libraries?
E.g. there is: https://github.com/drjaydenm/SharpText which would only need the loading, since it renders with GPU
Scott Williams
@tocsoft
it is split... Font doesn't have a direct drawing aspect it has it "renders" by calling a series of line and arc operations and expects a third party component to understand vector rasterization.
James Jackson-South
@JimBobSquarePants
TIL this room exists...
LanYi
@BSG-75
Hello everyone
Just wanted to know if currently SystemFonts supports loading fonts by its localized name, i.e. something similiar to SystemFonts.Load("黑体") instead of SystemFonts.Load("SimHei")
Scott Williams
@tocsoft
We don't directly support localisation of names at the moment, we currently prioritise the US English name (if present) otherwise we fallback to the first alternative name we find.
LanYi
@BSG-75
I'm trying to make it capable of loading fonts from localized names. From what I saw, we'd need to load arrays of FontFamilyName, FontName, FontSubFamilyName when reading SixLabors.Fonts.Tables.General.NameTable, and then similar thing for SixLabors.Fonts.FontDescription.
Is there anything else that I need to pay attention to?
Scott Williams
@tocsoft
I've had a quick look into this it looks like all that 'should' be needed to be done is replace the hard coded 0x0409 with CultureInfo.CurrentCulture.LCID which instead should mean that it will just default to current culture instead of the hardcoded en-us id.
the Dictionarys in FontCollection might also need to be updated to account for cultural lookup differences (i'm not an expert on the effect of the different string comparer options) all know is that I was after was a case insensitive lookup.
Scott Williams
@tocsoft
I am not aware of anywhere else in the codebase that would need to be impacted for different cultures.
LanYi
@BSG-75
Should we also provide (a maybe separate) collection which simply stores every languageId-fontFamilyName pair, and then the user can retrieve it with any language he want?
Scott Williams
@tocsoft
could do, but I am not sure how often/likely it is that a user will be switching between languages without just reloading the fonts. But obviously as your the one that needs/wants the functionality you would have the greater insight into the subject.
LanYi
@BSG-75
It's mainly because we probably can't rely on the default CurrentCulture
Also a single FontFamilyName might be a little inflexible, if it's using current language then it cannot be loaded using English name, and vice versa if it's using English name then it cannot be loaded using current language name, which could be cumbersome?
LanYi
@BSG-75
I think I'll keep the US English names for existing fields, just to make things simpler
LanYi
@BSG-75

the Dictionarys in FontCollection might also need to be updated to account for cultural lookup differences (i'm not an expert on the effect of the different string comparer options) all know is that I was after was a case insensitive lookup.

That looks like possible, we could create a StringComparer for each LanguageId present in the name tables, but StringComparer.Create is available only from .net standard 2.0, so it's not supported in .net standard 1.0 ...

LanYi
@BSG-75
Let me see if there are other ways to retrieve an locale specific IEqualityComparer<string> in .net standard 1.0
LanYi
@BSG-75
Hmmm... Even constructing CultureInfo by LCID requires .NET Standard 2.0 ……
Scott Williams
@tocsoft
@BSG-75 I've just pushed a PR with changes to allow the first level of loading a FontCollection with a single culture defined.... also supports loading the System Fonts with a specific culture defined.
LanYi
@BSG-75
@tocsoft does this mean, let's say, I've set the culture to Chinese, and I won't be able to find any font by its English name if this font has a Chinese name?
LanYi
@BSG-75
By the way your pull request is much more complete than what I'm doing, so I think we can just focus on your's one
LanYi
@BSG-75
I've posted what I was trying to implement as comments in your pull request
LanYi
@BSG-75
@tocsoft I created a pull request to your branch sw/culture-aware-fontnames, implementing what I had in mind. Please tell me if there are anything that should be fixed / reworked
Stephan Vedder
@feliwir
What's the state of all these pulls https://github.com/SixLabors/Fonts/pulls @tocsoft ?
Scott Williams
@tocsoft
One was only raised yesterday and is waiting on another member of the team to provide a cursory review... the other 2 are actually a single item for local await font names and still needs more thought to what level localisation should go to and when it should be applied.
James Jackson-South
@JimBobSquarePants
I’ll review yesterday’s one tonight
Stephan Vedder
@feliwir
thanks!
Yeah i know, this one: SixLabors/Fonts#127 was opened by @BSG-75 who is part of my team at OpenSage
We had some issues with chinsese localization