glyph2qvg added
This commit is contained in:
parent
3fbd18456e
commit
8e3ac2fce2
|
@ -18,9 +18,9 @@ macro(qsk_setup_options)
|
|||
|
||||
# we actually want to use cmake_dependent_option - minimum cmake version ??
|
||||
|
||||
option( BUILD_SVG2QVG_STANDALONE "Build svg2qvg without qskinny library dependency" ON )
|
||||
option( BUILD_TOOLS_STANDALONE "Build tools without qskinny library dependency" ON )
|
||||
if( NOT BUILD_TOOLS )
|
||||
set( BUILD_SVG2QVG_STANDALONE OFF )
|
||||
set( BUILD_TOOLS_STANDALONE OFF )
|
||||
endif()
|
||||
|
||||
if( NOT BUILD_INPUTCONTEXT )
|
||||
|
|
15
LICENSES
15
LICENSES
|
@ -14,18 +14,25 @@ a) HCT color system
|
|||
SPDX-License-Identifier: Apache License 2.0
|
||||
Copyright (C) 2021 Google LLC
|
||||
|
||||
b) Cassowary constraint solving algorithm
|
||||
b) Cassowary constraint solving algorithm ( examples )
|
||||
|
||||
Code: https://github.com/nucleic/kiwi
|
||||
SPDX-License-Identifier: BSD 3-Clause "New" or "Revised" License
|
||||
Copyright (c) 2013, Nucleic Development Team
|
||||
|
||||
c) Material3 Icons
|
||||
fonts ( only for running the examples ):
|
||||
|
||||
Code: https://github.com/marella/material-design-icons
|
||||
a) Material3 Icons
|
||||
|
||||
Code: https://github.com/google/material-design-icons
|
||||
SPDX-License-Identifier: Apache License 2.0
|
||||
|
||||
d) Fluent2 Icons
|
||||
b) Fluent2 Icons
|
||||
|
||||
Code: https://github.com/microsoft/fluentui-system-icons
|
||||
SPDX-License-Identifier: MIT License
|
||||
|
||||
c) Segoe-UI Fonts
|
||||
|
||||
Code: https://github.com/mrbvrz/segoe-ui-linux
|
||||
License: https://github.com/mrbvrz/segoe-ui-linux/blob/master/license.txt
|
||||
|
|
|
@ -20,6 +20,45 @@ function(qsk_add_executable target)
|
|||
|
||||
endfunction()
|
||||
|
||||
function(qsk_embed_sources target)
|
||||
|
||||
# In cross platform scenarios you might need the qvg converter
|
||||
# tools for the build - not the target - platform. To avoid having
|
||||
# to build all libraries those tools offer a standalone
|
||||
# mode that includes some source files instead.
|
||||
|
||||
# Some moc files are transitively required:
|
||||
# - f.e #include <QskGraphic.cpp> -> #include "moc_QskGraphic.cpp"
|
||||
# Those will be generated when adding the dependency below
|
||||
|
||||
add_dependencies(${target} qskinny)
|
||||
|
||||
# TODO hack for standalone qvg2svg
|
||||
get_target_property(qskinny_AUTOGEN_DIR qskinny AUTOGEN_BUILD_DIR)
|
||||
if (${qskinny_AUTOGEN_DIR} STREQUAL "")
|
||||
message(FATAL_ERROR "Directory '${qskinny_AUTOGEN_DIR}' doesn't exist")
|
||||
endif()
|
||||
|
||||
# TODO fix multi configuration generators
|
||||
if(CMAKE_GENERATOR MATCHES "Visual Studio.*")
|
||||
add_definitions("/I${qskinny_AUTOGEN_DIR}/include_\$(Configuration)")
|
||||
elseif(CMAKE_GENERATOR MATCHES "Ninja Multi.*")
|
||||
target_include_directories(${target}
|
||||
PRIVATE
|
||||
${qskinny_AUTOGEN_DIR}/include_$<CONFIG>)
|
||||
else()
|
||||
target_include_directories(${target} PRIVATE ${qskinny_AUTOGEN_DIR}/include)
|
||||
endif()
|
||||
|
||||
target_include_directories(${target}
|
||||
PRIVATE
|
||||
${QSK_SOURCE_DIR}/src/common
|
||||
${QSK_SOURCE_DIR}/src/graphic)
|
||||
|
||||
target_compile_definitions(${target} PRIVATE QSK_STANDALONE)
|
||||
target_link_libraries(${target} PRIVATE Qt::Gui Qt::GuiPrivate)
|
||||
endfunction()
|
||||
|
||||
function(qsk_add_library target)
|
||||
|
||||
if(QT_VERSION_MAJOR VERSION_GREATER_EQUAL 6)
|
||||
|
|
|
@ -8,3 +8,5 @@ if(TARGET Qt::Svg)
|
|||
COMPONENT
|
||||
Devel)
|
||||
endif()
|
||||
|
||||
add_subdirectory(glyph2qvg)
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
############################################################################
|
||||
# QSkinny - Copyright (C) The authors
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
############################################################################
|
||||
|
||||
set(target glyph2qvg)
|
||||
qsk_add_executable(${target} main.cpp)
|
||||
|
||||
if(BUILD_TOOLS_STANDALONE)
|
||||
qsk_embed_sources(${target})
|
||||
else()
|
||||
target_link_libraries(${target} PRIVATE qskinny)
|
||||
endif()
|
||||
|
||||
set_target_properties(${target} PROPERTIES FOLDER tools)
|
||||
|
||||
install(TARGETS ${target})
|
||||
|
||||
# packaging TODO ...
|
|
@ -0,0 +1,71 @@
|
|||
/******************************************************************************
|
||||
* QSkinny - Copyright (C) The authors
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*****************************************************************************/
|
||||
|
||||
#if defined( QSK_STANDALONE )
|
||||
#include <QskGraphic.cpp>
|
||||
#include <QskRgbValue.cpp>
|
||||
#include <QskColorFilter.cpp>
|
||||
#include <QskPainterCommand.cpp>
|
||||
#include <QskGraphicPaintEngine.cpp>
|
||||
#include <QskGraphicIO.cpp>
|
||||
#else
|
||||
#include <QskGraphicIO.h>
|
||||
#include <QskGraphic.h>
|
||||
#endif
|
||||
|
||||
#include <QGuiApplication>
|
||||
#include <QRawFont>
|
||||
#include <QPainter>
|
||||
#include <QPainterPath>
|
||||
#include <QDebug>
|
||||
|
||||
static void usage( const char* appName )
|
||||
{
|
||||
qWarning() << "usage: " << appName << "<fontfile> <glyphindex> <qvgfile>";
|
||||
}
|
||||
|
||||
int main( int argc, char* argv[] )
|
||||
{
|
||||
if ( argc != 4 )
|
||||
{
|
||||
usage( argv[0] );
|
||||
return -1;
|
||||
}
|
||||
|
||||
QGuiApplication app( argc, argv );
|
||||
|
||||
QRawFont font( QString( argv[1] ), 16 );
|
||||
if ( !font.isValid() )
|
||||
{
|
||||
qWarning() << "invalid font name:" << argv[1];
|
||||
return -2;
|
||||
}
|
||||
|
||||
bool ok;
|
||||
|
||||
const auto glyphIndex = QString( argv[2] ).toUInt( &ok );
|
||||
if ( !ok )
|
||||
{
|
||||
qWarning() << "invalid glyph index:" << argv[2];
|
||||
return -3;
|
||||
}
|
||||
|
||||
const auto path = font.pathForGlyph( glyphIndex );
|
||||
if ( path.isEmpty() )
|
||||
{
|
||||
qWarning() << "no glyph for index:" << argv[2];
|
||||
return -3;
|
||||
}
|
||||
|
||||
QskGraphic graphic;
|
||||
|
||||
QPainter painter( &graphic );
|
||||
painter.setRenderHint( QPainter::Antialiasing, true );
|
||||
painter.fillPath( path, Qt::black );
|
||||
|
||||
QskGraphicIO::write( graphic, argv[3] );
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -6,37 +6,8 @@
|
|||
set(target svg2qvg)
|
||||
qsk_add_executable(${target} main.cpp)
|
||||
|
||||
if(BUILD_SVG2QVG_STANDALONE)
|
||||
|
||||
# NOTE: when building standalone some moc files are transitively required.
|
||||
# These files are being created by the qskinny build, hence we add an explicit dependency.
|
||||
# E.g. main.cpp -> #include <QskGraphic.cpp> -> #include "moc_QskGraphic.cpp"
|
||||
add_dependencies(${target} qskinny)
|
||||
|
||||
# TODO hack for standalone qvg2svg
|
||||
get_target_property(qskinny_AUTOGEN_DIR qskinny AUTOGEN_BUILD_DIR)
|
||||
if (${qskinny_AUTOGEN_DIR} STREQUAL "")
|
||||
message(FATAL_ERROR "Directory '${qskinny_AUTOGEN_DIR}' doesn't exist")
|
||||
endif()
|
||||
|
||||
# TODO fix multi configuration generators
|
||||
if(CMAKE_GENERATOR MATCHES "Visual Studio.*")
|
||||
add_definitions("/I${qskinny_AUTOGEN_DIR}/include_\$(Configuration)")
|
||||
elseif(CMAKE_GENERATOR MATCHES "Ninja Multi.*")
|
||||
target_include_directories(${target}
|
||||
PRIVATE
|
||||
${qskinny_AUTOGEN_DIR}/include_$<CONFIG>)
|
||||
else()
|
||||
target_include_directories(${target} PRIVATE ${qskinny_AUTOGEN_DIR}/include)
|
||||
endif()
|
||||
|
||||
target_include_directories(${target}
|
||||
PRIVATE
|
||||
${QSK_SOURCE_DIR}/src/common
|
||||
${QSK_SOURCE_DIR}/src/graphic)
|
||||
|
||||
target_compile_definitions(${target} PRIVATE QSK_STANDALONE)
|
||||
target_link_libraries(${target} PRIVATE Qt::Gui Qt::GuiPrivate)
|
||||
if(BUILD_TOOLS_STANDALONE)
|
||||
qsk_embed_sources(${target})
|
||||
else()
|
||||
target_link_libraries(${target} PRIVATE qskinny)
|
||||
endif()
|
||||
|
@ -70,4 +41,4 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
|||
install(FILES $<TARGET_PDB_FILE:${target}>
|
||||
DESTINATION
|
||||
${CMAKE_INSTALL_BINDIR} OPTIONAL)
|
||||
endif()
|
||||
endif()
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
static void usage( const char* appName )
|
||||
{
|
||||
qWarning() << "usage: " << appName << "svgfile qvgfile";
|
||||
qWarning() << "usage: " << appName << "<svgfile> <qvgfile>";
|
||||
}
|
||||
|
||||
static QRectF viewBox( QSvgRenderer& renderer )
|
||||
|
|
Loading…
Reference in New Issue