Git Product home page Git Product logo

Comments (3)

H-pun avatar H-pun commented on August 28, 2024 1

You were right! it was because there were no fonts available in the container.

So i tried your solution by adding default font to my project and load it like this:
using var ploted = await result.PlotImageAsync(image, new() { FontFamily = new FontCollection().Add(fontPath) });

However, upon initialization, the PlottingOptions constructor will always invokes GetDefaultFontFamily(), which is the main problem since there are no system fonts in the first place.

public PlottingOptions()
{
    FontFamily = GetDefaultFontFamily();
    FontSize = 12f;
} 

So currently my solution is by installing ttf-mscorefonts-installer for default SystemFonts on my Docker container. However, this solution is suboptimal as it could potentially degrade server performance.

RUN echo "deb http://deb.debian.org/debian/ bookworm main contrib" > /etc/apt/sources.list && \
    echo "deb-src http://deb.debian.org/debian/ bookworm main contrib" >> /etc/apt/sources.list && \
    echo "deb http://security.debian.org/ bookworm-security main contrib" >> /etc/apt/sources.list && \
    echo "deb-src http://security.debian.org/ bookworm-security main contrib" >> /etc/apt/sources.list
RUN sed -i'.bak' 's/$/ contrib/' /etc/apt/sources.list
RUN apt-get update; apt-get install -y ttf-mscorefonts-installer fontconfig

Well I think by using FirstOrDefault() in GetDefaultFontFamily() is better than First() since it wont throw Sequence contains no elements and FontFamily can be reassigned if there are no fonts available.

from yolov8.

dme-compunet avatar dme-compunet commented on August 28, 2024 1

I'll fix it soon, thanks for reporting it.

from yolov8.

dme-compunet avatar dme-compunet commented on August 28, 2024

from yolov8.

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.