Hello community, here is the log from the commit of package gl2ps for openSUSE:Factory checked in at 2020-04-08 19:56:31 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/gl2ps (Old) and /work/SRC/openSUSE:Factory/.gl2ps.new.3248 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "gl2ps" Wed Apr 8 19:56:31 2020 rev:13 rq:792339 version:1.4.2 Changes: -------- --- /work/SRC/openSUSE:Factory/gl2ps/gl2ps.changes 2017-07-17 09:08:49.771616457 +0200 +++ /work/SRC/openSUSE:Factory/.gl2ps.new.3248/gl2ps.changes 2020-04-08 19:56:33.121117623 +0200 @@ -1,0 +2,15 @@ +Tue Apr 7 17:20:57 UTC 2020 - Stefan BrĂ¼ns <[email protected]> + +- Update to version 1.4.2: + * Revert dynamic library naming change inadvertently introduced + in 1.4.1 +- Update to version 1.4.1: + * Added gl2psSorting to change the sorting algorithm on the fly + * Fix rotated text in PGF output + * Use pt instead of px in SVG viewport + * New GL2PS_NO_TEX_FONTSIZE option and gl2psSetTexScaling + function to control LATEX scaling +- Cleanup spec file +- Drop upstream no-copy-dt-needed-entries.patch + +------------------------------------------------------------------- Old: ---- gl2ps-1.4.0.tgz no-copy-dt-needed-entries.patch New: ---- gl2ps-1.4.2.tgz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ gl2ps.spec ++++++ --- /var/tmp/diff_new_pack.lTwPqb/_old 2020-04-08 19:56:34.205118416 +0200 +++ /var/tmp/diff_new_pack.lTwPqb/_new 2020-04-08 19:56:34.209118418 +0200 @@ -1,7 +1,7 @@ # # spec file for package gl2ps # -# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -12,35 +12,24 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ # %define so_ver 1 Name: gl2ps -Version: 1.4.0 +Version: 1.4.2 Release: 0 Summary: OpenGL to PostScript Printing Library -License: LGPL-2.0+ or SUSE-GL2PS-2.0 +License: LGPL-2.0-or-later OR SUSE-GL2PS-2.0 Group: Development/Libraries/C and C++ -Url: http://www.geuz.org/gl2ps/ +URL: http://www.geuz.org/gl2ps/ Source0: http://geuz.org/gl2ps/src/%{name}-%{version}.tgz -# PATCH-FIX-UPSTREAM no-copy-dt-needed-entries.patch [email protected] -- Fix linking with --no-copy-dt-needed-entries -Patch0: no-copy-dt-needed-entries.patch BuildRequires: cmake BuildRequires: freeglut-devel BuildRequires: libpng-devel BuildRequires: zlib-devel -BuildRoot: %{_tmppath}/%{name}-%{version}-build -%if 0%{?sles_version} -BuildRequires: Mesa-devel -%else BuildRequires: pkgconfig(gl) -%endif -%if 0%{?suse_version} > 1230 -BuildRequires: libXi-devel -BuildRequires: libXmu-devel -%endif %description GL2PS is a C library providing vector output for any OpenGL @@ -55,10 +44,6 @@ provides limited, experimental support for Portable LaTeX Graphics (PGF). -The pstoedit program can also be used to transform the PostScript -files generated by GL2PS into many other vector formats such as xfig, -cgm, wmf, etc. - %package devel Summary: Development files for GL2PS Group: Development/Libraries/C and C++ @@ -80,12 +65,11 @@ invisible primitives and mixed vector/bitmap output. %prep -%setup -q -n %{name}-%{version}-source -%patch0 +%setup -q -n %{name}-%{version} %build %cmake -make %{?_smp_mflags} +%cmake_build %install %cmake_install @@ -99,13 +83,12 @@ %postun -n libgl2ps%{so_ver} -p /sbin/ldconfig %files devel -%defattr(-,root,root,-) -%doc COPYING.GL2PS COPYING.LGPL README.txt gl2ps.pdf gl2psTest*.c +%license COPYING.GL2PS COPYING.LGPL +%doc README.txt gl2ps.pdf gl2psTest*.c %{_includedir}/gl2ps.h %{_libdir}/libgl2ps.so %files -n libgl2ps%{so_ver} -%defattr(-,root,root,-) %{_libdir}/libgl2ps.so.%{so_ver}* %changelog ++++++ gl2ps-1.4.0.tgz -> gl2ps-1.4.2.tgz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gl2ps-1.4.0-source/.clang-format new/gl2ps-1.4.2/.clang-format --- old/gl2ps-1.4.0-source/.clang-format 1970-01-01 01:00:00.000000000 +0100 +++ new/gl2ps-1.4.2/.clang-format 2020-02-22 12:39:54.000000000 +0100 @@ -0,0 +1,105 @@ +--- +BasedOnStyle: None +AccessModifierOffset: -2 +AlignAfterOpenBracket: Align +AlignConsecutiveAssignments: false +AlignConsecutiveDeclarations: false +AlignEscapedNewlines: Right +AlignOperands: true +AlignTrailingComments: false +AllowAllParametersOfDeclarationOnNextLine: true +AllowShortBlocksOnASingleLine: true +AllowShortCaseLabelsOnASingleLine: true +AllowShortFunctionsOnASingleLine: All +AllowShortIfStatementsOnASingleLine: true +AllowShortLoopsOnASingleLine: true +AlwaysBreakAfterDefinitionReturnType: None +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: false +AlwaysBreakTemplateDeclarations: false +BinPackArguments: true +BinPackParameters: true +BraceWrapping: + AfterClass: false + AfterControlStatement: false + AfterEnum: false + AfterFunction: true + AfterNamespace: false + AfterObjCDeclaration: false + AfterStruct: false + AfterUnion: false + BeforeCatch: false + BeforeElse: true + IndentBraces: false + SplitEmptyFunction: true + SplitEmptyRecord: true + SplitEmptyNamespace: true +BreakBeforeBinaryOperators: None +BreakBeforeBraces: Custom +BreakBeforeInheritanceComma: true +BreakBeforeTernaryOperators: false +BreakConstructorInitializersBeforeComma: false +BreakAfterJavaFieldAnnotations: false +BreakStringLiterals: true +ColumnLimit: 80 +CommentPragmas: '^ IWYU pragma:' +CompactNamespaces: false +ConstructorInitializerAllOnOneLineOrOnePerLine: false +ConstructorInitializerIndentWidth: 2 +ContinuationIndentWidth: 2 +Cpp11BracedListStyle: true +DerivePointerAlignment: false +DisableFormat: false +ExperimentalAutoDetectBinPacking: false +FixNamespaceComments: true +ForEachMacros: + - foreach + - Q_FOREACH + - BOOST_FOREACH +IncludeCategories: + - Regex: '^"(llvm|llvm-c|clang|clang-c)/' + Priority: 2 + - Regex: '^(<|"(gtest|gmock|isl|json)/)' + Priority: 3 + - Regex: '.*' + Priority: 1 +IncludeIsMainRegex: '(Test)?$' +IndentCaseLabels: false +IndentWidth: 2 +IndentWrappedFunctionNames: false +JavaScriptQuotes: Leave +JavaScriptWrapImports: true +KeepEmptyLinesAtTheStartOfBlocks: false +MacroBlockBegin: '' +MacroBlockEnd: '' +MaxEmptyLinesToKeep: 1 +NamespaceIndentation: All +ObjCBlockIndentWidth: 2 +ObjCSpaceAfterProperty: true +ObjCSpaceBeforeProtocolList: true +PenaltyBreakAssignment: 2 +PenaltyBreakBeforeFirstCallParameter: 19 +PenaltyBreakComment: 300 +PenaltyBreakFirstLessLess: 120 +PenaltyBreakString: 1000 +PenaltyExcessCharacter: 1000000 +PenaltyReturnTypeOnItsOwnLine: 60 +PointerAlignment: Right +ReflowComments: true +SortIncludes: false +SortUsingDeclarations: true +SpaceAfterCStyleCast: false +SpaceAfterTemplateKeyword: true +SpaceBeforeAssignmentOperators: true +SpaceBeforeParens: false +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 1 +SpacesInAngles: false +SpacesInContainerLiterals: true +SpacesInCStyleCastParentheses: false +SpacesInParentheses: false +SpacesInSquareBrackets: false +Standard: Cpp03 +TabWidth: 4 +UseTab: Never +... diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gl2ps-1.4.0-source/CMakeLists.txt new/gl2ps-1.4.2/CMakeLists.txt --- old/gl2ps-1.4.0-source/CMakeLists.txt 2017-04-04 01:09:28.000000000 +0200 +++ new/gl2ps-1.4.2/CMakeLists.txt 2020-04-07 20:12:36.000000000 +0200 @@ -1,46 +1,49 @@ # GL2PS, an OpenGL to PostScript Printing Library # Copyright (C) 1999-2017 C. Geuzaine -# +# # This program is free software; you can redistribute it and/or # modify it under the terms of either: -# +# # a) the GNU Library General Public License as published by the Free # Software Foundation, either version 2 of the License, or (at your # option) any later version; or -# +# # b) the GL2PS License as published by Christophe Geuzaine, either # version 2 of the License, or (at your option) any later version. -# +# # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See either # the GNU Library General Public License or the GL2PS License for # more details. -# +# # You should have received a copy of the GNU Library General Public # License along with this library in the file named "COPYING.LGPL"; # if not, write to the Free Software Foundation, Inc., 675 Mass Ave, # Cambridge, MA 02139, USA. -# +# # You should have received a copy of the GL2PS License with this # library in the file named "COPYING.GL2PS"; if not, I will be glad # to provide one. -# +# # For the latest info about gl2ps and a full list of contributors, # see http://www.geuz.org/gl2ps/. -# +# # Please report all bugs and problems to <[email protected]>. -cmake_minimum_required(VERSION 2.4 FATAL_ERROR) +cmake_minimum_required(VERSION 2.8 FATAL_ERROR) + +# do not warn about non-definition of WIN32 on Cygwin +set(CMAKE_LEGACY_CYGWIN_WIN32 0) # if CMAKE_BUILD_TYPE is specified use it; otherwise set the default # build type to "RelWithDebInfo" ("-O2 -g" with gcc) prior to calling # project() if(DEFINED CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "Choose build type") -else(DEFINED CMAKE_BUILD_TYPE) +else() set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose build type") -endif(DEFINED CMAKE_BUILD_TYPE) +endif() project(gl2ps C) @@ -49,44 +52,56 @@ set(GL2PS_MAJOR_VERSION 1) set(GL2PS_MINOR_VERSION 4) -set(GL2PS_PATCH_VERSION 0) +set(GL2PS_PATCH_VERSION 2) set(GL2PS_EXTRA_VERSION "" CACHE STRING "GL2PS extra version string") set(GL2PS_VERSION "${GL2PS_MAJOR_VERSION}.${GL2PS_MINOR_VERSION}") set(GL2PS_VERSION "${GL2PS_VERSION}.${GL2PS_PATCH_VERSION}${GL2PS_EXTRA_VERSION}") -execute_process(COMMAND date "+%Y%m%d" OUTPUT_VARIABLE DATE +execute_process(COMMAND date "+%Y%m%d" OUTPUT_VARIABLE DATE OUTPUT_STRIP_TRAILING_WHITESPACE) if(NOT DATE) set(DATE "unknown") -endif(NOT DATE) +endif() set(GL2PS_DATE "${DATE}") if(APPLE) set(GL2PS_OS "MacOSX") elseif(CYGWIN) - set(GL2PS_OS "Windows") -else(APPLE) + # detect if we use the MinGW compilers on Cygwin - if we do, handle the build + # as a pure Windows build + if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR + CMAKE_CXX_COMPILER_ID MATCHES "Clang") + execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpmachine + OUTPUT_VARIABLE CXX_COMPILER_MACHINE + OUTPUT_STRIP_TRAILING_WHITESPACE) + if(CXX_COMPILER_MACHINE MATCHES "mingw") + set(GMSH_OS "Windows") + set(WIN32 1) + add_definitions(-DWIN32) + endif() + endif() +else() set(GL2PS_OS "${CMAKE_SYSTEM_NAME}") -endif(APPLE) +endif() include(CheckFunctionExists) check_function_exists(vsnprintf HAVE_VSNPRINTF) if(NOT HAVE_VSNPRINTF) add_definitions(-DHAVE_NO_VSNPRINTF) -endif(NOT HAVE_VSNPRINTF) +endif() find_package(OpenGL) if(OPENGL_FOUND) list(APPEND EXTERNAL_INCLUDES ${OPENGL_INCLUDE_DIR}) list(APPEND EXTERNAL_LIBRARIES ${OPENGL_LIBRARIES}) -endif(OPENGL_FOUND) +endif() find_package(GLUT) if(GLUT_FOUND) list(APPEND EXTERNAL_INCLUDES ${GLUT_INCLUDE_DIR}) list(APPEND EXTERNAL_LIBRARIES ${GLUT_LIBRARIES}) -endif(GLUT_FOUND) +endif() if(ENABLE_ZLIB) find_package(ZLIB) @@ -94,8 +109,8 @@ add_definitions(-DHAVE_ZLIB) list(APPEND EXTERNAL_INCLUDES ${ZLIB_INCLUDE_DIR}) list(APPEND EXTERNAL_LIBRARIES ${ZLIB_LIBRARIES}) - endif(ZLIB_FOUND) -endif(ENABLE_ZLIB) + endif() +endif() if(ENABLE_PNG) find_package(PNG) @@ -103,38 +118,49 @@ add_definitions(-DHAVE_PNG) list(APPEND EXTERNAL_LIBRARIES ${PNG_LIBRARIES}) list(APPEND EXTERNAL_INCLUDES ${PNG_INCLUDE_DIR}) - endif(PNG_FOUND) -endif(ENABLE_PNG) + endif() +endif() find_library(MATH_LIBRARY m) if(MATH_LIBRARY) list(APPEND EXTERNAL_LIBRARIES ${MATH_LIBRARY}) -endif(MATH_LIBRARY) +endif() include_directories(${EXTERNAL_INCLUDES}) +if(APPLE) + # OpenGL and GLUT are deprecated on macOS... + include(CheckCCompilerFlag) + check_c_compiler_flag("-Wdeprecated-declarations" DEPRECATED) + if(DEPRECATED) + set_source_files_properties(gl2ps.c gl2psTest.c gl2psTestSimple.c PROPERTIES + COMPILE_FLAGS "-Wno-deprecated-declarations") + endif() +endif() + if(OPENGL_FOUND) add_library(lib STATIC gl2ps.c gl2ps.h) set_target_properties(lib PROPERTIES OUTPUT_NAME gl2ps) add_library(shared SHARED gl2ps.c gl2ps.h) target_link_libraries(shared ${EXTERNAL_LIBRARIES}) - set_target_properties(shared PROPERTIES OUTPUT_NAME gl2ps) - set_target_properties(shared PROPERTIES + set_target_properties(shared PROPERTIES OUTPUT_NAME gl2ps VERSION ${GL2PS_MAJOR_VERSION}.${GL2PS_MINOR_VERSION}.${GL2PS_PATCH_VERSION} SOVERSION ${GL2PS_MAJOR_VERSION}) - if(MSVC) - set_target_properties(shared PROPERTIES COMPILE_FLAGS "-DGL2PSDLL -DGL2PSDLL_EXPORTS") - endif(MSVC) - - install(TARGETS lib shared DESTINATION lib${LIB_SUFFIX}) -endif(OPENGL_FOUND) + if(WIN32 OR CYGWIN) + set_target_properties(shared PROPERTIES + COMPILE_FLAGS "-DGL2PSDLL -DGL2PSDLL_EXPORTS") + endif() + install(TARGETS lib shared RUNTIME DESTINATION bin + LIBRARY DESTINATION lib${LIB_SUFFIX} + ARCHIVE DESTINATION lib${LIB_SUFFIX}) +endif() if(WIN32) set(GL2PS_DOC .) -else(WIN32) +else() set(GL2PS_DOC share/doc/gl2ps) -endif(WIN32) +endif() install(FILES gl2ps.h DESTINATION include) install(FILES ${CMAKE_SOURCE_DIR}/README.txt DESTINATION ${GL2PS_DOC}) @@ -148,11 +174,11 @@ target_link_libraries(gl2psTest lib ${EXTERNAL_LIBRARIES}) add_executable(gl2psTestSimple WIN32 gl2psTestSimple.c) target_link_libraries(gl2psTestSimple lib ${EXTERNAL_LIBRARIES}) -endif(GLUT_FOUND) +endif() find_package(LATEX) if(PDFLATEX_COMPILER) - add_custom_command(OUTPUT gl2ps.pdf DEPENDS gl2ps.tex + add_custom_command(OUTPUT gl2ps.pdf DEPENDS gl2ps.tex COMMAND ${PDFLATEX_COMPILER} ARGS ${CMAKE_SOURCE_DIR}/gl2ps.tex COMMAND ${PDFLATEX_COMPILER} ARGS ${CMAKE_SOURCE_DIR}/gl2ps.tex COMMAND ${PDFLATEX_COMPILER} ARGS ${CMAKE_SOURCE_DIR}/gl2ps.tex @@ -162,35 +188,40 @@ find_program(TTH tth) if(TTH) add_custom_command(OUTPUT gl2ps.html DEPENDS gl2ps.tex gl2ps.pdf - COMMAND ${CMAKE_COMMAND} -E copy_if_different + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/gl2ps.tex ${CMAKE_BINARY_DIR}/gl2ps.tex COMMAND ${TTH} ARGS -w1 gl2ps.tex) add_custom_target(html DEPENDS gl2ps.html) - endif(TTH) -endif(PDFLATEX_COMPILER) + endif() +endif() set(CPACK_PACKAGE_VENDOR "Christophe Geuzaine") set(CPACK_PACKAGE_VERSION_MAJOR ${GL2PS_MAJOR_VERSION}) set(CPACK_PACKAGE_VERSION_MINOR ${GL2PS_MINOR_VERSION}) set(CPACK_PACKAGE_VERSION_PATCH ${GL2PS_PATCH_VERSION}) set(CPACK_PACKAGE_DESCRIPTION_FILE ${CMAKE_SOURCE_DIR}/README.txt) -set(CPACK_PACKAGE_DESCRIPTION_SUMMARY +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "An OpenGL to PostScript (and PDF, and SVG...) printing library") -set(CPACK_PACKAGE_FILE_NAME gl2ps-${GL2PS_VERSION}-${GL2PS_OS}) +if(GL2PS_EXTRA_VERSION MATCHES "-git.*") # so that we'll overwrite the archives + set(CPACK_PACKAGE_FILE_NAME gl2ps-git-${GL2PS_OS}) + set(CPACK_SOURCE_PACKAGE_FILE_NAME gl2ps-git) +else() + set(CPACK_PACKAGE_FILE_NAME gl2ps-${GL2PS_VERSION}-${GL2PS_OS}) + set(CPACK_SOURCE_PACKAGE_FILE_NAME gl2ps-${GL2PS_VERSION}) +endif() set(CPACK_PACKAGE_INSTALL_DIRECTORY "gl2ps") set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/COPYING.LGPL) set(CPACK_RESOURCE_FILE_README ${CMAKE_SOURCE_DIR}/README.txt) set(CPACK_RESOURCE_FILE_WELCOME ${CMAKE_SOURCE_DIR}/README.txt) set(CPACK_PACKAGE_EXECUTABLE "gl2ps;gl2ps") set(CPACK_STRIP_FILES TRUE) -set(CPACK_SOURCE_PACKAGE_FILE_NAME gl2ps-${GL2PS_VERSION}-source) set(CPACK_SOURCE_GENERATOR TGZ) set(CPACK_SOURCE_IGNORE_FILES "TODO.txt" "${CMAKE_BINARY_DIR}" "/CVS/" "/.svn" "/.git" "~$" "DS_Store$" "/tmp/" "/bin/" "/lib/") if(WIN32) set(CPACK_GENERATOR ZIP) -else(WIN32) +else() set(CPACK_GENERATOR TGZ) -endif(WIN32) +endif() include(CPack) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gl2ps-1.4.0-source/gl2ps.c new/gl2ps-1.4.2/gl2ps.c --- old/gl2ps-1.4.0-source/gl2ps.c 2017-04-04 00:48:30.000000000 +0200 +++ new/gl2ps-1.4.2/gl2ps.c 2020-04-01 13:48:04.000000000 +0200 @@ -1,6 +1,6 @@ /* * GL2PS, an OpenGL to PostScript Printing Library - * Copyright (C) 1999-2017 C. Geuzaine + * Copyright (C) 1999-2020 C. Geuzaine * * This program is free software; you can redistribute it and/or * modify it under the terms of either: @@ -109,9 +109,9 @@ typedef GLfloat GL2PSplane[4]; -typedef struct _GL2PSbsptree2d GL2PSbsptree2d; +typedef struct GL2PSbsptree2d_ GL2PSbsptree2d; -struct _GL2PSbsptree2d { +struct GL2PSbsptree2d_ { GL2PSplane plane; GL2PSbsptree2d *front, *back; }; @@ -121,9 +121,9 @@ char *array; } GL2PSlist; -typedef struct _GL2PSbsptree GL2PSbsptree; +typedef struct GL2PSbsptree_ GL2PSbsptree; -struct _GL2PSbsptree { +struct GL2PSbsptree_ { GL2PSplane plane; GL2PSlist *primitives; GL2PSbsptree *front, *back; @@ -153,9 +153,9 @@ GLfloat *pixels; } GL2PSimage; -typedef struct _GL2PSimagemap GL2PSimagemap; +typedef struct GL2PSimagemap_ GL2PSimagemap; -struct _GL2PSimagemap { +struct GL2PSimagemap_ { GL2PSimage *image; GL2PSimagemap *next; }; @@ -164,7 +164,7 @@ GLshort type, numverts; GLushort pattern; char boundary, offset, culled; - GLint factor, linecap, linejoin; + GLint factor, linecap, linejoin, sortid; GLfloat width, ofactor, ounits; GL2PSvertex *verts; union { @@ -229,6 +229,9 @@ /* for image map list */ GL2PSimagemap *imagemap_head; GL2PSimagemap *imagemap_tail; + + /* for TEX scaling */ + GLfloat tex_scaling; } GL2PScontext; typedef struct { @@ -600,6 +603,15 @@ qsort(list->array, list->n, list->size, fcmp); } +/* Must be a list of GL2PSprimitives. */ +static void gl2psListAssignSortIds(GL2PSlist *list) +{ + GLint i; + for(i = 0; i < gl2psListNbr(list); i++){ + (*(GL2PSprimitive**)gl2psListPointer(list, i))->sortid = i; + } +} + static void gl2psListAction(GL2PSlist *list, void (*action)(void *data)) { GLint i; @@ -853,7 +865,8 @@ static GLint gl2psAddText(GLint type, const char *str, const char *fontname, GLshort fontsize, GLint alignment, GLfloat angle, - GL2PSrgba color) + GL2PSrgba color, GLboolean setblpos, + GLfloat blx, GLfloat bly) { GLfloat pos[4]; GL2PSprimitive *prim; @@ -878,11 +891,16 @@ prim = (GL2PSprimitive*)gl2psMalloc(sizeof(GL2PSprimitive)); prim->type = (GLshort)type; prim->boundary = 0; - prim->numverts = 1; - prim->verts = (GL2PSvertex*)gl2psMalloc(sizeof(GL2PSvertex)); + prim->numverts = setblpos ? 2 : 1; + prim->verts = (GL2PSvertex*)gl2psMalloc(sizeof(GL2PSvertex) * prim->numverts); prim->verts[0].xyz[0] = pos[0]; prim->verts[0].xyz[1] = pos[1]; prim->verts[0].xyz[2] = pos[2]; + if (setblpos) { + prim->verts[1].xyz[0] = blx; + prim->verts[1].xyz[1] = bly; + prim->verts[1].xyz[2] = 0; + } prim->culled = 0; prim->offset = 0; prim->ofactor = 0.0; @@ -1452,7 +1470,8 @@ return 1; } else{ - return 0; + /* Ensure that initial ordering is preserved when depths match. */ + return q->sortid < w->sortid ? -1 : 1; } } @@ -2277,7 +2296,7 @@ GLboolean boundary; GLint i, sizeoffloat, count, v, vtot, offset = 0, factor = 0, auxindex = 0; GLint lcap = 0, ljoin = 0; - GLfloat lwidth = 1.0F, psize = 1.0F, ofactor, ounits; + GLfloat lwidth = 1.0F, psize = 1.0F, ofactor = 0.0F, ounits = 0.0F; GLfloat *current; GL2PSvertex vertices[3]; GL2PSprimitive *prim; @@ -2399,12 +2418,12 @@ case GL2PS_LINE_CAP_TOKEN : current += 2; used -= 2; - lcap = current[1]; + lcap = (GLint)current[1]; break; case GL2PS_LINE_JOIN_TOKEN : current += 2; used -= 2; - ljoin = current[1]; + ljoin = (GLint)current[1]; break; case GL2PS_LINE_WIDTH_TOKEN : current += 2; @@ -3317,6 +3336,7 @@ char name[256]; time_t now; int i; + GLfloat s; if(gl2ps->filename && strlen(gl2ps->filename) < 256){ for(i = (int)strlen(gl2ps->filename) - 1; i >= 0; i--){ @@ -3343,14 +3363,17 @@ GL2PS_PATCH_VERSION, GL2PS_EXTRA_VERSION, GL2PS_COPYRIGHT, gl2ps->producer, ctime(&now)); + s = gl2ps->tex_scaling; + if(s <= 0.) s = 1.; fprintf(gl2ps->stream, - "\\setlength{\\unitlength}{1pt}\n" + "\\setlength{\\unitlength}{%gpt}\n" "\\begin{picture}(0,0)\n" - "\\includegraphics{%s}\n" + "\\includegraphics[scale=%g]{%s}\n" "\\end{picture}%%\n" "%s\\begin{picture}(%d,%d)(0,0)\n", - name, (gl2ps->options & GL2PS_LANDSCAPE) ? "\\rotatebox{90}{" : "", - (int)gl2ps->viewport[2], (int)gl2ps->viewport[3]); + s, s, name, + (gl2ps->options & GL2PS_LANDSCAPE) ? "\\rotatebox{90}{" : "", + (int)(gl2ps->viewport[2]), (int)(gl2ps->viewport[3])); } static void gl2psPrintTeXPrimitive(void *data) @@ -3361,10 +3384,12 @@ switch(prim->type){ case GL2PS_TEXT : - fprintf(gl2ps->stream, "\\fontsize{%d}{0}\n\\selectfont", - prim->data.text->fontsize); + if(!(gl2ps->options & GL2PS_NO_TEX_FONTSIZE)) + fprintf(gl2ps->stream, "\\fontsize{%d}{0}\\selectfont", + prim->data.text->fontsize); fprintf(gl2ps->stream, "\\put(%g,%g)", - prim->verts[0].xyz[0], prim->verts[0].xyz[1]); + prim->verts[0].xyz[0], + prim->verts[0].xyz[1]); if(prim->data.text->angle) fprintf(gl2ps->stream, "{\\rotatebox{%g}", prim->data.text->angle); fprintf(gl2ps->stream, "{\\makebox(0,0)"); @@ -3559,6 +3584,43 @@ } } +/* + This is used for producing aligned text in PDF. (x, y) is the anchor for the + aligned text, (xbl, ybl) is the bottom left corner. Rotation happens + around (x, y).*/ +static void gl2psPutPDFTextBL(GL2PSstring *text, int cnt, GLfloat x, GLfloat y, + GLfloat xbl, GLfloat ybl) +{ + if(text->angle == 0.0F){ + gl2ps->streamlength += gl2psPrintf + ("BT\n" + "/F%d %d Tf\n" + "%f %f Td\n" + "(%s) Tj\n" + "ET\n", + cnt, text->fontsize, xbl, ybl, text->str); + } + else{ + GLfloat a, ca, sa; + GLfloat pi = 3.141593F; + GLfloat i = atan2(y - ybl, x - xbl); + GLfloat r = sqrt((y - ybl) * (y - ybl) + (x - xbl) * (x - xbl)); + + a = (GLfloat)(pi * text->angle / 180.0F); + sa = (GLfloat)sin(a); + ca = (GLfloat)cos(a); + gl2ps->streamlength += gl2psPrintf + ("BT\n" + "/F%d %d Tf\n" + "%f %f %f %f %f %f Tm\n" + "(%s) Tj\n" + "ET\n", + cnt, text->fontsize, + ca, sa, -sa, ca, + xbl + r * (cos(i) - cos(i + a)), ybl + r * (sin(i) - sin(i+a)), text->str); + } +} + static void gl2psPutPDFSpecial(int prim, int sec, GL2PSstring *text) { gl2ps->streamlength += gl2psPrintf("/GS%d%d gs\n", prim, sec); @@ -3941,8 +4003,16 @@ for(j = 0; j <= lastel; ++j){ prim = *(GL2PSprimitive**)gl2psListPointer(gro->ptrlist, j); gl2ps->streamlength += gl2psPrintPDFFillColor(prim->verts[0].rgba); - gl2psPutPDFText(prim->data.text, gro->fontno, prim->verts[0].xyz[0], - prim->verts[0].xyz[1]); + if (prim->numverts == 2) { + gl2psPutPDFTextBL(prim->data.text, gro->fontno, prim->verts[0].xyz[0], + prim->verts[0].xyz[1], + prim->verts[1].xyz[0], + prim->verts[1].xyz[1]); + } + else { + gl2psPutPDFText(prim->data.text, gro->fontno, prim->verts[0].xyz[0], + prim->verts[0].xyz[1]); + } } break; case GL2PS_SPECIAL: @@ -5047,7 +5117,7 @@ gl2psPrintf("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n"); gl2psPrintf("<svg xmlns=\"http://www.w3.org/2000/svg\"\n"); gl2psPrintf(" xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n" - " width=\"%dpx\" height=\"%dpx\" viewBox=\"%d %d %d %d\">\n", + " width=\"%dpt\" height=\"%dpt\" viewBox=\"%d %d %d %d\">\n", width, height, x, y, width, height); gl2psPrintf("<title>%s</title>\n", gl2ps->title); gl2psPrintf("<desc>\n"); @@ -5663,12 +5733,12 @@ prim->verts[0].rgba[0], prim->verts[0].rgba[1], prim->verts[0].rgba[2], prim->data.text->str); - fprintf(gl2ps->stream, "}{}{\\pgfusepath{discard}}}"); + fprintf(gl2ps->stream, "}{}{\\pgfusepath{discard}}"); if(prim->data.text->angle) fprintf(gl2ps->stream, "}"); - fprintf(gl2ps->stream, "\n"); + fprintf(gl2ps->stream, "\n}\n"); break; case GL2PS_SPECIAL : /* alignment contains the format for which the special output text @@ -5834,6 +5904,7 @@ gl2psListReset(gl2ps->primitives); break; case GL2PS_SIMPLE_SORT : + gl2psListAssignSortIds(gl2ps->primitives); gl2psListSort(gl2ps->primitives, gl2psCompareDepth); if(gl2ps->options & GL2PS_OCCLUSION_CULL){ gl2psListActionInverse(gl2ps->primitives, gl2psAddInImageTree); @@ -6089,6 +6160,8 @@ gl2ps->buffersize = 0; } + gl2ps->tex_scaling = 1.; + return GL2PS_SUCCESS; } @@ -6142,34 +6215,70 @@ return res; } +GL2PSDLL_API GLint gl2psSorting(GLint mode) +{ + GLint res; + + if(!gl2ps) return GL2PS_UNINITIALIZED; + + switch(mode){ + case GL2PS_NO_SORT : + case GL2PS_SIMPLE_SORT : + case GL2PS_BSP_SORT : + gl2ps->sort = mode; + res = GL2PS_SUCCESS; + break; + default : + gl2psMsg(GL2PS_ERROR, "Unknown sorting algorithm: %d", mode); + gl2psFree(gl2ps); + gl2ps = NULL; + res = GL2PS_ERROR; + } + + return res; +} + GL2PSDLL_API GLint gl2psTextOptColor(const char *str, const char *fontname, GLshort fontsize, GLint alignment, GLfloat angle, GL2PSrgba color) { return gl2psAddText(GL2PS_TEXT, str, fontname, fontsize, alignment, angle, - color); + color, GL_FALSE, 0, 0); +} + +/** + * This version of gl2psTextOptColor is used to go around the + * fact that PDF does not support text alignment. The extra parameters + * (blx, bly) represent the bottom left corner of the text bounding box. + */ +GL2PSDLL_API GLint gl2psTextOptColorBL(const char *str, const char *fontname, + GLshort fontsize, GLint alignment, GLfloat angle, + GL2PSrgba color, GLfloat blx, GLfloat bly) +{ + return gl2psAddText(GL2PS_TEXT, str, fontname, fontsize, alignment, angle, + color, GL_TRUE, blx, bly); } GL2PSDLL_API GLint gl2psTextOpt(const char *str, const char *fontname, GLshort fontsize, GLint alignment, GLfloat angle) { - return gl2psAddText(GL2PS_TEXT, str, fontname, fontsize, alignment, angle, NULL); + return gl2psAddText(GL2PS_TEXT, str, fontname, fontsize, alignment, angle, NULL, GL_FALSE, 0, 0); } GL2PSDLL_API GLint gl2psText(const char *str, const char *fontname, GLshort fontsize) { return gl2psAddText(GL2PS_TEXT, str, fontname, fontsize, GL2PS_TEXT_BL, 0.0F, - NULL); + NULL, GL_FALSE, 0, 0); } GL2PSDLL_API GLint gl2psSpecial(GLint format, const char *str) { - return gl2psAddText(GL2PS_SPECIAL, str, "", 0, format, 0.0F, NULL); + return gl2psAddText(GL2PS_SPECIAL, str, "", 0, format, 0.0F, NULL, GL_FALSE, 0, 0); } GL2PSDLL_API GLint gl2psSpecialColor(GLint format, const char *str, GL2PSrgba rgba) { - return gl2psAddText(GL2PS_SPECIAL, str, "", 0, format, 0.0F, rgba); + return gl2psAddText(GL2PS_SPECIAL, str, "", 0, format, 0.0F, rgba, GL_FALSE, 0, 0); } GL2PSDLL_API GLint gl2psDrawPixels(GLsizei width, GLsizei height, @@ -6470,6 +6579,10 @@ GL2PSDLL_API GLint gl2psGetFileFormat() { + if(!gl2ps) { + return GL2PS_UNINITIALIZED; + } + return gl2ps->format; } @@ -6491,3 +6604,14 @@ return GL2PS_SUCCESS; } + +GL2PSDLL_API GLint gl2psSetTexScaling(GLfloat scaling) +{ + + if(!gl2ps) { + return GL2PS_UNINITIALIZED; + } + gl2ps->tex_scaling = scaling; + + return GL2PS_SUCCESS; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gl2ps-1.4.0-source/gl2ps.h new/gl2ps-1.4.2/gl2ps.h --- old/gl2ps-1.4.0-source/gl2ps.h 2017-04-04 00:48:26.000000000 +0200 +++ new/gl2ps-1.4.2/gl2ps.h 2020-04-07 20:16:44.000000000 +0200 @@ -1,6 +1,6 @@ /* * GL2PS, an OpenGL to PostScript Printing Library - * Copyright (C) 1999-2017 C. Geuzaine + * Copyright (C) 1999-2020 C. Geuzaine * * This program is free software; you can redistribute it and/or * modify it under the terms of either: @@ -33,8 +33,8 @@ * Please report all bugs and problems to <[email protected]>. */ -#ifndef __GL2PS_H__ -#define __GL2PS_H__ +#ifndef GL2PS_H +#define GL2PS_H #include <stdio.h> #include <stdlib.h> @@ -47,7 +47,9 @@ # pragma warning(disable:4127) # pragma warning(disable:4996) # endif -# define NOMINMAX +# if !defined(NOMINMAX) +# define NOMINMAX +# endif # include <windows.h> # undef NOMINMAX # if defined(GL2PSDLL) @@ -87,14 +89,14 @@ #define GL2PS_MAJOR_VERSION 1 #define GL2PS_MINOR_VERSION 4 -#define GL2PS_PATCH_VERSION 0 +#define GL2PS_PATCH_VERSION 2 #define GL2PS_EXTRA_VERSION "" #define GL2PS_VERSION (GL2PS_MAJOR_VERSION + \ 0.01 * GL2PS_MINOR_VERSION + \ 0.0001 * GL2PS_PATCH_VERSION) -#define GL2PS_COPYRIGHT "(C) 1999-2017 C. Geuzaine" +#define GL2PS_COPYRIGHT "(C) 1999-2020 C. Geuzaine" /* Output file formats (the values and the ordering are important!) */ @@ -138,6 +140,7 @@ #define GL2PS_NO_BLENDING (1<<11) #define GL2PS_TIGHT_BOUNDING_BOX (1<<12) #define GL2PS_NO_OPENGL_CONTEXT (1<<13) +#define GL2PS_NO_TEX_FONTSIZE (1<<14) /* Arguments for gl2psEnable/gl2psDisable */ @@ -146,7 +149,6 @@ #define GL2PS_LINE_STIPPLE 3 #define GL2PS_BLEND 4 - /* Arguments for gl2psLineCap/Join */ #define GL2PS_LINE_CAP_BUTT 0 @@ -216,6 +218,9 @@ GL2PSDLL_API GLint gl2psTextOptColor(const char *str, const char *fontname, GLshort fontsize, GLint align, GLfloat angle, GL2PSrgba color); +GL2PSDLL_API GLint gl2psTextOptColorBL(const char *str, const char *fontname, + GLshort fontsize, GLint align, GLfloat angle, + GL2PSrgba color, GLfloat blx, GLfloat bly); GL2PSDLL_API GLint gl2psSpecial(GLint format, const char *str); GL2PSDLL_API GLint gl2psSpecialColor(GLint format, const char *str, GL2PSrgba rgba); GL2PSDLL_API GLint gl2psDrawPixels(GLsizei width, GLsizei height, @@ -228,6 +233,7 @@ GL2PSDLL_API GLint gl2psLineJoin(GLint value); GL2PSDLL_API GLint gl2psLineWidth(GLfloat value); GL2PSDLL_API GLint gl2psBlendFunc(GLenum sfactor, GLenum dfactor); +GL2PSDLL_API GLint gl2psSorting(GLint mode); /* referenced in the documentation, but not fully documented */ GL2PSDLL_API GLint gl2psForceRasterPos(GL2PSvertex *vert); @@ -245,9 +251,10 @@ GL2PSDLL_API const char *gl2psGetFileExtension(GLint format); GL2PSDLL_API const char *gl2psGetFormatDescription(GLint format); GL2PSDLL_API GLint gl2psGetFileFormat(); +GL2PSDLL_API GLint gl2psSetTexScaling(GLfloat scaling); #if defined(__cplusplus) } #endif -#endif /* __GL2PS_H__ */ +#endif Binary files old/gl2ps-1.4.0-source/gl2ps.pdf and new/gl2ps-1.4.2/gl2ps.pdf differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gl2ps-1.4.0-source/gl2ps.tex new/gl2ps-1.4.2/gl2ps.tex --- old/gl2ps-1.4.0-source/gl2ps.tex 2017-04-04 01:15:27.000000000 +0200 +++ new/gl2ps-1.4.2/gl2ps.tex 2020-04-07 20:00:47.000000000 +0200 @@ -1,6 +1,6 @@ % % GL2PS, an OpenGL to PostScript Printing Library -% Copyright (C) 1999-2017 C. Geuzaine +% Copyright (C) 1999-2020 C. Geuzaine % % This program is free software; you can redistribute it and/or % modify it under the terms of either: @@ -91,8 +91,8 @@ </center> <h2>Download</h2> The latest stable version of GL2PS is <a -href="http://geuz.org/gl2ps/src/gl2ps-1.4.0.tgz">gl2ps-1.4.0.tgz</a>. Older -versions and nightly source snapshots are available <a +href="http://geuz.org/gl2ps/src/gl2ps-1.4.2.tgz">gl2ps-1.4.2.tgz</a>. Older +versions and source snapshots are available <a href="http://geuz.org/gl2ps/src/">here</a>. For access to the Git repository use: '<code>git clone <a href="http://gitlab.onelab.info/gl2ps/gl2ps.git" >http://gitlab.onelab.info/gl2ps/gl2ps.git</a></code>'. @@ -100,7 +100,7 @@ For questions and discussions about GL2PS see the <a href="http://geuz.org/mailman/listinfo/gl2ps/">gl2ps mailing list</a>. If you think you have found a bug you can also file a report directly <a -href="http://gitlab.onelab.info/gl2ps/gl2ps/issues">here</a>. +href="http://gitlab.onelab.info/gl2ps/gl2ps/issues">here</a>. You can also subscribe to the <a href="http://geuz.org/mailman/listinfo/gl2ps-announce/">gl2ps-announce</a> mailing list to be notified automatically when a new version of GL2PS is @@ -149,10 +149,6 @@ corrections, questions or suggestions should be e-mailed to the GL2PS mailing list \email{[email protected]}{[email protected]}. -The interface consists of seventeen functions, all beginning with the -prefix \dd{gl2ps}. All the data structures and the symbolic constants -peculiar to GL2PS begin with \dd{GL2PS}. - \section{Usage} % ------------------------------------------------------------------------- @@ -310,6 +306,8 @@ \dd{GL_RGBA} if this option is enabled. If these restrictions are not met, a runtime error will be reported and \dd{gl2psBeginPage} / \dd{gl2psSetOptions} will return \dd{GL2PS_ERROR}. +\item[\dd{GL2PS_NO_TEX_FONTSIZE}] No fontsize specification is added in the + \LaTeX\ output. \end{description} \item[\dd{colormode}] Specifies the color mode: \dd{GL_RGBA} or @@ -358,7 +356,31 @@ \end{description} % ------------------------------------------------------------------------- +\subsection{\texttt{gl2psSorting}} +\label{sec:gl2psSorting} + +\subsubsection{Specification} + +\begin{verbatim} +GLint gl2psSorting( GLint value ) +\end{verbatim} + +\subsubsection{Description and arguments} + +\dd{gl2psSorting} specify the sorting algorithm for subsequent viewport(s). +This function is useful in order to set different sorting algorithms +from one viewport to another. +\subsubsection{Return value} + +\noindent\dd{gl2psSorting} returns: +\begin{description} +\item[\dd{GL2PS_UNINITIALIZED}] if the library is not initialized; +\item[\dd{GL2PS_ERROR}] if an error occurred; +\item[\dd{GL2PS_SUCCESS}] otherwise. +\end{description} + +% ------------------------------------------------------------------------- \subsection{\texttt{gl2psText} and \texttt{gl2psTextOpt}} \label{sec:gl2psText} @@ -603,13 +625,13 @@ For \dd{gl2psLineCap} allowed values are \dd{GL2PS_LINE_CAP_BUTT} (the default), \dd{GL2PS_LINE_CAP_ROUND} and \dd{GL2PS_LINE_CAP_SQUARE}. For -\dd{gl2psLineJoin} allowed values are \dd{GL2PS_LINE_JOIN_MITER} +\dd{gl2psLineJoin} allowed values are \dd{GL2PS_LINE_JOIN_MITER} (the default), \dd{GL2PS_LINE_JOIN_ROUND} and \dd{GL2PS_LINE_JOIN_BEVEL}. \subsubsection{Return value} \noindent\dd{gl2psPointSize}, \dd{gl2psLineWidth}, \dd{gl2psLineCap} -and \dd{gl2psLineJoin} return: +and \dd{gl2psLineJoin} return: \begin{description} \item[\dd{GL2PS_UNINITIALIZED}] if the library is not initialized; \item[\dd{GL2PS_ERROR}] if an error occurred; @@ -939,7 +961,7 @@ % \noemail{Pantxo Diribarne}{[email protected]} for polygon offset improvement, image scaling fix for SVG and PDF output, PostScript viewport color -bug fix, \dd{gl2psLineCap} and \dd{gl2psLineJoin}; +bug fix, \dd{gl2psLineCap}, \dd{gl2psLineJoin} and \dd{gl2psSorting}; % \noemail{David Lonie}{[email protected]} for direct addition of promitives (for newer OpenGL APIs without feedback buffer); @@ -1099,6 +1121,12 @@ \dd{gl2psBeginPage} now accepts a buffersize of 0; new \dd{gl2psForceRasterPos}, \dd{gl2psLineCap} and \dd{gl2psLineJoin}; fixed scaling of images in PDF output; fixed bug leading to corrupted PDF output. +\item[1.4.1] (Apr 1, 2020) Added \dd{gl2psSorting} to change the sorting + algorithm on the fly; fix rotated text in PGF output; use \dd{pt} instead of + \dd{px} in SVG viewport; new \dd{GL2PS_NO_TEX_FONTSIZE} option and + \dd{gl2psSetTexScaling} function to control \LaTeX\ scaling. +\item[1.4.2] (Apr 7, 2020) Revert dynamic library naming change inadvertently + introduced in 1.4.1. \end{description} \end{document}
