helloSystem / Utilities

Utilities written in PyQt5, meant for use with helloSystem
BSD 2-Clause "Simplified" License
28 stars 29 forks source link

Add a simple font viewer #87

Open probonopd opened 3 years ago

probonopd commented 3 years ago

Currently helloSystem does not know what to do with font files.

Thought this was a good use case for pure Qml:

#!/usr/bin/env qml

import QtQuick 2.15

Item {
    width: 480; height: 300

    FontLoader {
        id: loadedFont; source: Qt.application.arguments[2]
        }

    Text {
        text: "Hamburgefonstiv"
        font.family: loadedFont.font.family
        font.weight: loadedFont.font.weight
        font.pixelSize: 48
    }
}

But:

FreeBSD%  Desktop/fontviewer.qml /usr/local/share/fonts/SourceCodePro/SourceCodePro-Black.ttf
file:///usr/home/user/Desktop/fontviewer.qml:15: TypeError: Cannot read property 'weight' of undefined
file:///usr/home/user/Desktop/fontviewer.qml:14: TypeError: Cannot read property 'family' of undefined
file:///usr/home/user/Desktop/fontviewer.qml:15: TypeError: Cannot read property 'weight' of undefined
file:///usr/home/user/Desktop/fontviewer.qml:14: TypeError: Cannot read property 'family' of undefined
QQmlApplicationEngine failed to load component
file:///usr/local/share/fonts/SourceCodePro/SourceCodePro-Black.ttf:1:1: Expected token `numeric literal'

Why Expected token 'numeric literal'? How to fix?

kettle-7 commented 3 years ago

I did add a PR with a fonts app didn't I?

probonopd commented 3 years ago

If you did, then it was totally lost on me. Where?