惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - 司徒正美
大猫的无限游戏
大猫的无限游戏
腾讯CDC
J
Java Code Geeks
博客园 - 【当耐特】
Microsoft Azure Blog
Microsoft Azure Blog
V
Visual Studio Blog
人人都是产品经理
人人都是产品经理
博客园 - Franky
博客园 - 聂微东
阮一峰的网络日志
阮一峰的网络日志
美团技术团队
云风的 BLOG
云风的 BLOG
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
U
Unit 42
雷峰网
雷峰网
B
Blog RSS Feed
博客园_首页
量子位
F
Fortinet All Blogs
罗磊的独立博客
H
Hackread – Cybersecurity News, Data Breaches, AI and More
酷 壳 – CoolShell
酷 壳 – CoolShell
C
Check Point Blog

Martin Owens activity

Martin Owens deleted project branch average-color-divide at Inkscape / inkscape Fix divide-by-zero crash when using calligraphy tool (!7923) · Merge requests · Inkscape / inkscape · GitLab Add selection file to bypass Windows command length limits (correction) (865df7a5) · Commits · Inkscape / inkscape · GitLab Draft: Fix AppImage crashing during save on older distros (!7922) · Merge requests · Inkscape / inkscape · GitLab e71fa7f8e0858aab87b7fc0814a30a8c88da9b43 to fe225a6b9e1042c7221d95173be22a02b3725337 · Martin Owens / inkscape · GitLab 403 Forbidden on Inkscape web server (#693) · Issues · Inkscape / inkscape-web · GitLab 403 Forbidden on Inkscape web server (#13509) · Issues · Inkscape / Inbox · GitLab Add selection file to bypass Windows command length limits (correction) (!7917) · 合并请求 · Inkscape / inkscape · GitLab Non-vertical axonometric axis implementation (!7912) · Merge requests · Inkscape / inkscape · GitLab Update split mode on tab switch (!7915) · Merge requests · Inkscape / inkscape · GitLab inset/offset as app functions so they can be used from CLI (!7914) · Merge requests · Inkscape / inkscape · GitLab Performace regresion in last month (#5879) · Issues · Inkscape / inkscape · GitLab [Regression] Right-aligned text has a new gap in 1.4.4 (#6130) · Issues · Inkscape / inkscape · GitLab [Regression] Right-aligned text has a new gap in 1.4.4 (#13498) · Issues · Inkscape / Inbox · GitLab c503804e014994d611de1b225bee8158c06448a8 to a4588d8ead1e7049b90c5a126962746ed286ab17 · Inkscape / inkscape-web · GitLab Validate the extensions of signature file uploads (a4588d8e) · 提交 · Inkscape / inkscape-web · GitLab Allow color conversions using static arrays instead of just vectors (e71fa7f8) · 提交 · Martin Owens / inkscape · GitLab Speed up ungroup on thousands of items (!7908) · Merge requests · Inkscape / inkscape · GitLab Incorrect handling of FontMatrix and transformation matrices with internal PDF import (#4845) · Issues · Inkscape / inkscape · GitLab Handling edge case of negative fonts in PDF (59040229) · 提交 · Inkscape / inkscape · GitLab Handling edge case of negative fonts in PDF (!7911) · 合并请求 · Inkscape / inkscape · GitLab Allow color conversions using static arrays instead of just vectors (33e65d1b) · Commits · Martin Owens / inkscape · GitLab Allow color conversions using static arrays instead of just vectors (9be5f867) · Commits · Martin Owens / inkscape · GitLab a9672ea1dff483b5b3aa8c6b5d88cd223001bef5 to 512a5e57602ac52e1d35782a7dcebae04262b2b8 · Martin Owens / inkscape · GitLab Add selection file to bypass Windows command length limits (!7905) · 合并请求 · Inkscape / inkscape · GitLab Revert Pango label changes (1.4.x) (!7907) · 合并请求 · Inkscape / inkscape · GitLab Crash on selecting a `<text>` object without a `<tspan>` inside (#5462) · Issues · Inkscape / inkscape · GitLab Fix breakage with Ubuntu 26.04 CI (!7904) · 合并请求 · Inkscape / inkscape · GitLab c673fdd5148253276826d4eda3951daaefb82607 to 356b31383ba324396a225686613236484305533d · Martin Owens / inkscape · GitLab Revert Text tool cursor changes (1.4.x) (!7903) · 合并请求 · Inkscape / inkscape · GitLab
Fix axis defaults in OpenType 2 for PDF output (4518fd2c)...
Martin Owens · 2026-06-21 · via Martin Owens activity
Commit 4518fd2c authored by Martin Owens's avatar Martin Owens 🕘
Browse files

Fix axis defaults in OpenType 2 for PDF output

We look up and pass along the axis data and use the default when it is
not set in the SPStyle Axis data.

When upstream's support for named axis presets is present, this needs
to be updated to support it.
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@
#include "remember-styles.h"
#include "style-enums.h"

class FontInstance;
class SPIPaint;
class SPAnchor;
class SPItem;
@@ -119,7 +120,7 @@ public:
    std::optional<CapyPDF_GraphicsStateId> get_group_graphics_state(SPStyle const *style,
                                                                    std::optional<CapyPDF_TransparencyGroupId> sm);
    std::optional<CapyPDF_GraphicsStateId> get_shape_graphics_state(SPStyle const *style);
    std::optional<CapyPDF_FontId> get_font(std::string const &filename, SPIFontVariationSettings &var);
    std::optional<std::pair<std::string, CapyPDF_FontId>> get_font(std::shared_ptr<FontInstance> font, SPIFontVariationSettings &var);

    std::optional<capypdf::Color> get_paint(SPIPaint const &paint, SPStyle const *context_style,
                                            std::optional<double> opacity);
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@
#include "colors/spaces/cms.h"
#include "colors/spaces/cmyk.h"
#include "object/sp-gradient.h"
#include "libnrtype/font-instance.h"
#include "object/sp-paint-server.h"
#include "style.h"

@@ -287,18 +288,24 @@ std::optional<CapyPDF_GraphicsStateId> Document::get_shape_graphics_state(SPStyl
 *
 * @returns the FontId in capypdf to use.
 */
std::optional<CapyPDF_FontId> Document::get_font(std::string const &filename, SPIFontVariationSettings &var)
std::optional<std::pair<std::string, CapyPDF_FontId>> Document::get_font(std::shared_ptr<FontInstance> font, SPIFontVariationSettings &var)
{
    auto filename = font->GetFilename();
    auto key = filename;
    if (!var.axes.empty()) {
        key += "-" + var.toString();
    }

    // TODO: It's possible for the font loading to fail but we don't know how yet.
    if (!_font_cache.contains(key)) {
        try {
            auto fontprops = capypdf::FontProperties();
            for (auto &[name, value] : var.axes) {
                fontprops.set_variation(name, (int)value);
            auto axes = font->get_opentype_varaxes();
            for (auto &axis : axes) {
                auto iter = var.axes.find(axis.tag);
                fontprops.set_variation(axis.tag, iter == var.axes.end()
                        ? (int)axis.def
                        : iter->second);
            }
            _font_cache[key] = _gen.load_font(filename.c_str(), fontprops);
        } catch (std::exception const &err) {
@@ -306,7 +313,7 @@ std::optional<CapyPDF_FontId> Document::get_font(std::string const &filename, SP
            return {};
        }
    }
    return _font_cache[key];
    return {{key, _font_cache[key]}};
}

/**
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@
#include "libnrtype/Layout-TNG.h"
#include "libnrtype/font-instance.h"
#include "style.h"
#include "style-text.h"

namespace Inkscape::Extension::Internal::PdfBuilder {

@@ -56,16 +57,16 @@ std::optional<double> TextContext::get_softmask(double opacity) const
 */
bool TextContext::set_text_style(std::shared_ptr<FontInstance> const &font, SPStyle *style)
{
    auto font_filename = font->GetFilename();
    if (font_filename != last_font) {
        if (auto font_id = _doc.get_font(font_filename, style->font_variation_settings)) {
    if (auto ret = _doc.get_font(font, style->font_variation_settings)) {
        auto &[key, font_id] = *ret;
        if (key != last_font) {
            // Transformation has consumed the font size
            _tx.cmd_Tf(*font_id, 1); // style->font_size.computed);
            last_font = font_filename;
            _tx.cmd_Tf(font_id, 1); // style->font_size.computed);
            last_font = key;
        }
    } else {
        return false;
    }
    }
    if (style->letter_spacing.set && style->letter_spacing.computed != last_letter_spacing) {
        _tx.cmd_Tc(style->letter_spacing.computed / 1000);
        last_letter_spacing = style->letter_spacing.computed;
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@ private:
    bool _soft_mask;

    // Text style memory
    Glib::ustring last_font;
    std::string last_font;
    double last_letter_spacing = 0;
    double last_ca = 1.0;
    double last_CA = 1.0;