Skip to content

font is acting up #87

Closed
Closed

Description

@ff-joshmar

I've been using a font type that should be able to display a j however it shows a ?box? instead, I've made this small application to replicate the issue, could you look into this?

#:sdk Microsoft.NET.Sdk
#:package Synercoding.FileFormats.Pdf@1.0.0-alpha022

using Synercoding.FileFormats.Pdf;
using Synercoding.FileFormats.Pdf.Content.Text.Fonts;
using Synercoding.Primitives;
using Synercoding.Primitives.Extensions;

var fontPath = Path.Combine(Directory.GetCurrentDirectory(), "source-sans-pro.regular.ttf");
const string FONT_URL = "https://st.1001fonts.net/download/font/source-sans-pro.regular.ttf";

if (!File.Exists(fontPath))
{
    using var httpClient = new HttpClient();
    var fontBytes = await httpClient.GetByteArrayAsync(FONT_URL);
    await File.WriteAllBytesAsync(fontPath, fontBytes);
}

var pdfPath = Path.Combine(Directory.GetCurrentDirectory(), "test.pdf");
File.Delete(pdfPath);

var font = Font.Load(fontPath);

using (var fileStream = File.OpenWrite(pdfPath))
using (var writer = new PdfWriter(fileStream))
{
    writer.AddPage(page =>
    {
        page.MediaBox = new Size(ValueCreator.Cm(5), ValueCreator.Cm(2)).AsRectangle();
        page.Content.AddText(textContext =>
        {
            textContext.SetFontAndSize(font, 12);
            textContext.ShowText("▲ PJ1.1");
        });
    });
}

Activity

  1. added 2 commits that reference this issue on Apr 23, 2026
    7138775
    7bdef2f
  2. synercoder commented on Apr 23, 2026

    @synercoder
    Owner
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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