pax_global_header00006660000000000000000000000064141015445310014510gustar00rootroot0000000000000052 comment=3539d4ab34d1479e85ac5452b091990636ba6099 fntsample-release-5.4/000077500000000000000000000000001410154453100147675ustar00rootroot00000000000000fntsample-release-5.4/.editorconfig000066400000000000000000000005321410154453100174440ustar00rootroot00000000000000root = true [*] end_of_line = lf insert_final_newline = true charset = utf-8 trim_trailing_whitespace = true [*.{c,h}] indent_style = space indent_size = 4 [ChangeLog] indent_style = tab [{CMakeLists.txt,*.cmake}] indent_style = space indent_size = 2 [*.pl] indent_style = space indent_size = 4 [*.yml] indent_style = space indent_size = 2 fntsample-release-5.4/.github/000077500000000000000000000000001410154453100163275ustar00rootroot00000000000000fntsample-release-5.4/.github/workflows/000077500000000000000000000000001410154453100203645ustar00rootroot00000000000000fntsample-release-5.4/.github/workflows/ci.yml000066400000000000000000000023541410154453100215060ustar00rootroot00000000000000name: CI on: push: branches: [ master ] pull_request: branches: [ master ] env: BUILD_TYPE: Release jobs: build: strategy: matrix: os: - ubuntu-latest - macos-latest include: - os: ubuntu-latest blocks: -DUNICODE_BLOCKS=/usr/share/unicode/Blocks.txt - os: macos-latest env: - CMAKE_PREFIX_PATH: /usr/local/opt/gettext runs-on: ${{matrix.os}} steps: - uses: actions/checkout@v2 - name: Install APT Packages if: ${{ matrix.os == 'ubuntu-latest' }} run: > sudo apt update && sudo apt install cmake gettext libcairo2-dev libglib2.0-dev libfreetype6-dev libpango1.0-dev ninja-build pkg-config unicode-data - name: Install Homebrew Packages if: ${{ matrix.os == 'macos-latest' }} run: > brew update && brew install cairo cmake fontconfig freetype gettext glib pango ninja pkg-config - name: Configure run: cmake -GNinja -B${{ github.workspace }}/build -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} ${{ matrix.blocks }} - name: Build run: cmake --build ${{ github.workspace }}/build - name: Test run: ${{ github.workspace }}/build/src/fntsample --help fntsample-release-5.4/.gitignore000066400000000000000000000000201410154453100167470ustar00rootroot00000000000000/build/ .vscode fntsample-release-5.4/CMake/000077500000000000000000000000001410154453100157475ustar00rootroot00000000000000fntsample-release-5.4/CMake/DownloadUnicodeBlocks.cmake000066400000000000000000000024421410154453100231670ustar00rootroot00000000000000function(download_unicode_blocks) set(default_url "https://unicode.org/Public/UNIDATA/Blocks.txt") set(UNICODE_BLOCKS "UNICODE_BLOCKS-NOTFOUND" CACHE FILEPATH "Unicode blocks file") option(CHECK_UNICODE_CERT "Check certificate while downloading Unicode blocks file" ON) if(NOT UNICODE_BLOCKS_URL) set(UNICODE_BLOCKS_URL "${default_url}") endif() if(NOT UNICODE_BLOCKS) set(download_dest "${CMAKE_BINARY_DIR}/Blocks.txt") message(STATUS "Downloading ${UNICODE_BLOCKS_URL}...") file(DOWNLOAD "${UNICODE_BLOCKS_URL}" "${download_dest}" SHOW_PROGRESS STATUS status TLS_VERIFY ${CHECK_UNICODE_CERT}) list(GET status 0 err) if(err) list(GET status 1 msg) message(FATAL_ERROR "Download failed (${err}): ${msg}") endif() set(UNICODE_BLOCKS "${download_dest}" CACHE FILEPATH "Unicode blocks file" FORCE) endif() if(NOT EXISTS "${UNICODE_BLOCKS}") set(UNICODE_BLOCKS "UNICODE_BLOCKS-NOTFOUND" CACHE FILEPATH "Unicode blocks file" FORCE) message(FATAL_ERROR "Unicode blocks file not found. " "Use -DUNICODE_BLOCKS= or -DUNICODE_BLOCKS_URL= to specify location of this file.\n" "Blocks.txt file is available at the Unicode web site: ${default_url}") endif() endfunction() fntsample-release-5.4/CMake/FindXgettext.cmake000066400000000000000000000002441410154453100213660ustar00rootroot00000000000000find_program(XGETTEXT_EXECUTABLE xgettext) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(Xgettext REQUIRED_VARS XGETTEXT_EXECUTABLE) fntsample-release-5.4/CMake/PoFileUtils.cmake000066400000000000000000000061441410154453100211550ustar00rootroot00000000000000include_guard(GLOBAL) find_package(Gettext) find_package(Xgettext) if(NOT GETTEXT_FOUND) message(NOTICE "Translations will not be built.") endif() define_property(TARGET PROPERTY TRANSLATABLE_SOURCES BRIEF_DOCS "Translatable sources" FULL_DOCS "List of sources that are used to extract translation templates by xgettext") add_custom_target(_updatepot) function(add_translations) set(options) set(one_value_args POT_FILE) set(multi_value_args LANGUAGES XGETTEXT_ARGS MSGMERGE_ARGS) cmake_parse_arguments(PARSE_ARGV 0 ARG "${options}" "${one_value_args}" "${multi_value_args}") set(pot_file "${ARG_POT_FILE}") get_filename_component(pot_file_path "${pot_file}" ABSOLUTE) if(XGETTEXT_FOUND) add_custom_target(updatepot COMMAND "${XGETTEXT_EXECUTABLE}" ${ARG_XGETTEXT_ARGS} $ -o "${pot_file_path}" WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} COMMENT "Extracting translation templates into ${pot_file}" COMMAND_EXPAND_LISTS VERBATIM ) else() message(NOTICE "Updating translation templates will not be possible.") endif() if(NOT GETTEXT_FOUND) return() endif() if(TARGET updatepot) add_custom_target(updatepo) endif() add_custom_target(updatepo-only) set(gmo_files) foreach(lang IN LISTS ARG_LANGUAGES) set(po_file "${lang}.po") set(gmo_file "${lang}.gmo") set(po_file_path "${CMAKE_CURRENT_SOURCE_DIR}/${po_file}") set(gmo_file_path "${CMAKE_CURRENT_BINARY_DIR}/${gmo_file}") add_custom_command(OUTPUT ${gmo_file} COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} "${po_file_path}" -o "${gmo_file}" MAIN_DEPENDENCY "${po_file}" COMMENT "Generating binary catalog ${gmo_file} from ${po_file}" VERBATIM) install(FILES "${gmo_file_path}" DESTINATION "${CMAKE_INSTALL_LOCALEDIR}/${lang}/LC_MESSAGES/" RENAME "${CMAKE_PROJECT_NAME}.mo") list(APPEND gmo_files "${gmo_file_path}") macro(add_po_update_target target main_target) add_custom_target(${target} COMMAND "${GETTEXT_MSGMERGE_EXECUTABLE}" ${ARG_MSGMERGE_ARGS} --update "${po_file}" "${pot_file}" WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" DEPENDS ${ARGN} COMMENT "Merging ${pot_file} into ${po_file}" VERBATIM ) add_dependencies(${main_target} ${target}) endmacro() if(TARGET updatepot) add_po_update_target(updatepo-${lang} updatepo updatepot) endif() add_po_update_target(updatepo-only-${lang} updatepo-only) endforeach() add_custom_target(pofiles ALL DEPENDS ${gmo_files}) endfunction() function(add_translatable_sources) # Use paths relative to the project directory for source files. This way # the template file will contain the same file names independen of how # the build was configured. foreach(src IN LISTS ARGV) get_filename_component(src_abs_path "${src}" ABSOLUTE) file(RELATIVE_PATH src_path "${PROJECT_SOURCE_DIR}" "${src_abs_path}") set_property(TARGET _updatepot APPEND PROPERTY TRANSLATABLE_SOURCES "${src_path}") endforeach() endfunction() fntsample-release-5.4/CMakeLists.txt000066400000000000000000000017061410154453100175330ustar00rootroot00000000000000cmake_minimum_required(VERSION 3.12..3.21) project(fntsample VERSION 5.4 DESCRIPTION "PDF and PostScript font samples generator" HOMEPAGE_URL "https://github.com/eugmes/fntsample" LANGUAGES C) list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake") include(GNUInstallDirs) include(CPack) find_package(PkgConfig REQUIRED) find_package(Intl REQUIRED) # The target was added in CMake 3.20. if(NOT TARGET Intl::Intl) add_library(Intl::Intl INTERFACE IMPORTED GLOBAL) target_include_directories(Intl::Intl INTERFACE ${Intl_INCLUDE_DIRS}) target_link_libraries(Intl::Intl INTERFACE ${Intl_LIBRARIES}) endif() pkg_check_modules(pkgs REQUIRED IMPORTED_TARGET cairo>=1.15.4 fontconfig freetype2 glib-2.0 pangocairo>=1.37.0 pangoft2>=1.37.0 ) include(DownloadUnicodeBlocks) download_unicode_blocks() string(TIMESTAMP DATE "%Y-%m-%d" UTC) include(PoFileUtils) add_subdirectory(src) add_subdirectory(scripts) add_subdirectory(po) fntsample-release-5.4/COPYING000066400000000000000000001043741410154453100160330ustar00rootroot00000000000000 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 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 the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . fntsample-release-5.4/ChangeLog000066400000000000000000000062001410154453100165370ustar00rootroot00000000000000Changes in version 5.4: * Fixed handling of PDF files with already existing outlines in pdfoutline. * Added a script for extracting outlines from PDF files (pdf-extract-outline). * Pango is always used to draw glyphs, options -p and --use-pango are accepted but ignored. * Fixed possible outline corruption in pdfoutline with some versions of PDF::API2 library (Yifeng Li). * Various code and build system cleanups. Changes in version 5.3 * Support reproducible builds with PDF output (Khaled Hosny) Changes in version 5.2 * Fix handling of non-ASCII characters in pdfoutline Changes in version 5.1 * Make writing outlines with Cairo actually work * Fix typos Changes in version 5.0 * Add command line flag that allows to use pango for text layout (by Khaled Hosny, requires pango >= 1.37) * Add possiblility to create PDF outline directly using cairo (by Khaled Hosny, requires cairo >= 1.15.4) * Switch to CMake as build system * Add command line flag for loading Unicode blocks file during runtime. Changes in version 4.1: * Detect iconv and add LIBICONV to LDADD * Detect support for -Wl,--as-needed in configure * Those changes fix compilation on OS X Changes in version 4.0: * Add a --no-embed option * Fix broken handling of font names Changes in version 3.2: * Add support for SVG output (works correctly only for single page output) Changes in version 3.1: * Add support for files that contain multiple fonts, like TrueType Collections (.ttc) * Link with libm to avoid compilation failure with gold linker * Use silent-rules feature of automake 1.11 Changes in version 3.0: * Make it buildable with mawk again. * Switch to GPLv3. * Added localization support using gettext. * Added Ukrainian translation. * Added font scaling for fonts with large vertical metrics, to better work with fonts like TibetanMachine Changes in version 2.8: * It is now possible to use file Blocks.txt with dos line endings, like in zipped Unicode 5.1 UCD. Changes in version 2.7: * configure now checks for pangocairo >= 1.16, older pango does not have pango_layout_get_line_readonly() required by fntsample * Fixed crash (segmentation fault) with some values for -i (and maybe -x) Changes in version 2.6: * pango is now used for drawing headers and numbers in font samples * Font sizes are now tunable using "--style" option. Default font size for digits was made smaller for better look with fonts containing glyphs outside BMP Changes in version 2.5: * Added support for compiling with non-default fontconfig location * Added support for long options * Made some optimizations to text layout, this should make generated PDFs smaller * Added options for selecting Unicode ranges to include in samples (-i and -x) Changes in version 2.4: * Added script for making pdf files with bookmarks (pdfoutline) and option for fntsample to print bookmarks information (-l). pdfoutline requires perl and PDF::API2 library Changes in version 2.3: * Added "#include " to get definition of getopt() Changes in version 2.2: * Added support for fonts other than TrueType/OpenType * Improved errors handling fntsample-release-5.4/README.rst000066400000000000000000000061051410154453100164600ustar00rootroot00000000000000fntsample ========= |build| |license| .. |build| image:: https://github.com/eugmes/fntsample/actions/workflows/ci.yml/badge.svg :target: https://github.com/eugmes/fntsample/actions/workflows/ci.yml .. |license| image:: https://img.shields.io/badge/License-GPL%20v3-blue.svg :alt: License: GPL v3 :target: https://www.gnu.org/licenses/gpl-3.0 ``fntsample`` is a tool that can be used to make font samples that show coverage of the font and are similar in appearance to `Unicode Charts `_. It was developed for use with `DejaVu Fonts `_ project. ``fntsample`` is licensed under `GPL `_ version 3 or later. .. image:: screenshot.png :alt: Output example Features -------- * Support for various font formats using `FreeType `_ library, including TrueType, OpenType, and Type1. * Creating samples in PDF, PostScript, and SVG formats. * Adding outlines with Unicode block names for PDF samples. * Selection of code ranges to show in charts. * Comparing of two font files with highlighting of added glyphs. * Runs on Linux and other Unix-like systems. Download -------- Releases are available from `releases page `_. For source code releases for versions before 5.0 visit the `old project page `_. The source code and issues tracker are accessible via the `project page `_. Building -------- The following libraries are required to build ``fntsample``: `cairo `_, `fontconfig `_, `FreeType2 `_, `GLib `_, `Pango `_, `gettext `_. They should be available in most Linux distributions. Additionally Unicode `blocks `_ file is required. `CMake `_ is used to build the code. In the directory with source code execute:: % mkdir build % cd build % cmake .. -DUNICODE_BLOCKS=/path/to/Blocks.txt % make % make install The last step will install files under ``/usr/local`` by default. This can be overridden by adding ``-DCMAKE_INSTALL_PREFIX=/another/prefix`` to the ``cmake`` invocation. ``fntsample`` could be built using `Homebrew `_ on macOS. Use the following commands to install dependencies and configure the build environment before building the code:: % brew install cmake pgk-config gettext cairo pango fontconfig freetype glib % export CMAKE_PREFIX_PATH=/usr/local/opt/gettext Alternatively you can install ``fntsample`` using a Homebrew `formula `_:: % brew install eugmes/fntsample/fntsample Usage ----- The basic usage for ``fntsample`` looks as follows:: % fntsample -f /file/to/font/file.ttf -o output.pdf For more advanced usage consult the man pages for ``fntsample`` and ``pdfoutline``. fntsample-release-5.4/po/000077500000000000000000000000001410154453100154055ustar00rootroot00000000000000fntsample-release-5.4/po/CMakeLists.txt000066400000000000000000000005641410154453100201520ustar00rootroot00000000000000set(XGETTEXT_ARGS --keyword=_ --keyword=N_ --keyword=__ --keyword=__x --default-domain=${CMAKE_PROJECT_NAME} --add-comments=TRANSLATORS: --foreign-user --package-name ${CMAKE_PROJECT_NAME} --msgid-bugs-address=eugen@debian.org) add_translations( POT_FILE fntsample.pot LANGUAGES uk XGETTEXT_ARGS ${XGETTEXT_ARGS} MSGMERGE_ARGS --backup=none --verbose ) fntsample-release-5.4/po/fntsample.pot000066400000000000000000000077311410154453100201320ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # This file is put in the public domain. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: fntsample\n" "Report-Msgid-Bugs-To: eugen@debian.org\n" "POT-Creation-Date: 2021-08-01 16:57+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" #: src/fntsample.c:333 #, c-format msgid "Unicode blocks file should be given at most once!\n" msgstr "" #: src/fntsample.c:339 #, c-format msgid "Failed to load any blocks from the blocks file!\n" msgstr "" #: src/fntsample.c:345 src/fntsample.c:363 #, c-format msgid "Font file name should be given only once!\n" msgstr "" #: src/fntsample.c:352 #, c-format msgid "Output file name should be given only once!\n" msgstr "" #: src/fntsample.c:419 #, c-format msgid "Font index should be non-negative!\n" msgstr "" #: src/fntsample.c:424 #, c-format msgid "-s and -g cannot be used together!\n" msgstr "" #: src/fntsample.c:782 #, c-format msgid "" "Usage: %s [ OPTIONS ] -f FONT-FILE -o OUTPUT-FILE\n" " %s -h\n" "\n" msgstr "" #: src/fntsample.c:784 #, c-format msgid "" "Options:\n" " --blocks-file, -b BLOCKS-FILE Read Unicode blocks information from " "BLOCKS-FILE\n" " --font-file, -f FONT-FILE Create samples of FONT-FILE\n" " --font-index, -n IDX Font index in FONT-FILE\n" " --output-file, -o OUTPUT-FILE Save samples to OUTPUT-FILE\n" " --help, -h Show this information message and " "exit\n" " --other-font-file, -d OTHER-FONT Compare FONT-FILE with OTHER-FONT and " "highlight added glyphs\n" " --other-index, -m IDX Font index in OTHER-FONT\n" " --postscript-output, -s Use PostScript format for output " "instead of PDF\n" " --svg, -g Use SVG format for output\n" " --print-outline, -l Print document outlines data to " "standard output\n" " --write-outline, -w Write document outlines (only in PDF " "output)\n" " --no-embed, -e Don't embed the font in the output " "file, draw the glyphs instead\n" " --include-range, -i RANGE Show characters in RANGE\n" " --exclude-range, -x RANGE Do not show characters in RANGE\n" " --style, -t \"STYLE: VAL\" Set STYLE to value VAL\n" msgstr "" #: src/fntsample.c:801 #, c-format msgid "" "\n" "Supported styles (and default values):\n" msgstr "" #: src/fntsample.c:864 #, c-format msgid "Not enough space for rendering glyphs. Make cell font smaller.\n" msgstr "" #: src/fntsample.c:870 #, c-format msgid "The font has strange metrics: ascent + descent = %g\n" msgstr "" #: src/fntsample.c:903 #, c-format msgid "Failed to parse environment variable SOURCE_DATE_EPOCH.\n" msgstr "" #. TRANSLATORS: 'freetype' is a name of a library, and should be left untranslated #: src/fntsample.c:929 #, c-format msgid "%s: freetype error\n" msgstr "" #: src/fntsample.c:937 #, c-format msgid "%s: failed to open font file %s\n" msgstr "" #: src/fntsample.c:947 #, c-format msgid "%s: failed to create new font face\n" msgstr "" #. TRANSLATORS: 'cairo' is a name of a library, and should be left untranslated #: src/fntsample.c:966 #, c-format msgid "%s: failed to create cairo surface: %s\n" msgstr "" #: src/fntsample.c:974 #, c-format msgid "%s: cairo_create failed: %s\n" msgstr "" #: scripts/pdfoutline.pl:42 #, perl-format msgid "Usage: %s input.pdf outline.txt out.pdf\n" msgstr "" #: scripts/pdfoutline.pl:141 scripts/pdf-extract-outline.pl:174 #, perl-brace-format msgid "Cannot open outline file '{outlinefile}'" msgstr "" #: scripts/pdf-extract-outline.pl:48 #, perl-format msgid "Usage: %s input.pdf outline.txt\n" msgstr "" #: scripts/pdf-extract-outline.pl:181 msgid "Extracting outlines from encrypted files is not supported" msgstr "" fntsample-release-5.4/po/uk.po000066400000000000000000000202121410154453100163610ustar00rootroot00000000000000# This file is put in the public domain. # # Євгеній Мещеряков , 2008. # Eugeniy Meshcheryakov , 2009, 2010, 2017. msgid "" msgstr "" "Project-Id-Version: fntsample\n" "Report-Msgid-Bugs-To: eugen@debian.org\n" "POT-Creation-Date: 2021-08-01 16:57+0200\n" "PO-Revision-Date: 2021-08-01 16:59+0200\n" "Last-Translator: Ievgenii Meshcheriakov \n" "Language-Team: Ukrainian <>\n" "Language: uk\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Generator: Poedit 3.0\n" "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" "%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" #: src/fntsample.c:333 #, c-format msgid "Unicode blocks file should be given at most once!\n" msgstr "Файл блоків Unicode можна вказувати тільки один раз!\n" #: src/fntsample.c:339 #, c-format msgid "Failed to load any blocks from the blocks file!\n" msgstr "Не вдалося завантажити жодного блока з файлу блоків!\n" #: src/fntsample.c:345 src/fntsample.c:363 #, c-format msgid "Font file name should be given only once!\n" msgstr "Назву файлу шрифтів потрібно вказувати тільки один раз!\n" #: src/fntsample.c:352 #, c-format msgid "Output file name should be given only once!\n" msgstr "Назву файлу результату потрібно вказувати тільки один раз!\n" #: src/fntsample.c:419 #, c-format msgid "Font index should be non-negative!\n" msgstr "Індекс шрифту повинен бути ненегативним!\n" #: src/fntsample.c:424 #, c-format msgid "-s and -g cannot be used together!\n" msgstr "Не можна одночасно використовувати -s та -g!\n" #: src/fntsample.c:782 #, c-format msgid "" "Usage: %s [ OPTIONS ] -f FONT-FILE -o OUTPUT-FILE\n" " %s -h\n" "\n" msgstr "" "Використання: %s [ ОПЦІЇ ] -f ФАЙЛ-ШРИФТУ -o ФАЙЛ-РЕЗУЛЬТАТУ\n" " %s -h\n" "\n" #: src/fntsample.c:784 #, c-format msgid "" "Options:\n" " --blocks-file, -b BLOCKS-FILE Read Unicode blocks information from " "BLOCKS-FILE\n" " --font-file, -f FONT-FILE Create samples of FONT-FILE\n" " --font-index, -n IDX Font index in FONT-FILE\n" " --output-file, -o OUTPUT-FILE Save samples to OUTPUT-FILE\n" " --help, -h Show this information message and " "exit\n" " --other-font-file, -d OTHER-FONT Compare FONT-FILE with OTHER-FONT and " "highlight added glyphs\n" " --other-index, -m IDX Font index in OTHER-FONT\n" " --postscript-output, -s Use PostScript format for output " "instead of PDF\n" " --svg, -g Use SVG format for output\n" " --print-outline, -l Print document outlines data to " "standard output\n" " --write-outline, -w Write document outlines (only in PDF " "output)\n" " --no-embed, -e Don't embed the font in the output " "file, draw the glyphs instead\n" " --include-range, -i RANGE Show characters in RANGE\n" " --exclude-range, -x RANGE Do not show characters in RANGE\n" " --style, -t \"STYLE: VAL\" Set STYLE to value VAL\n" msgstr "" "Опції:\n" " --blocks-file, -b ФАЙЛ-БЛОКІВ Читати інформацію про блоки " "Unicode з ФАЙЛУ-БЛОКІВ\n" " --font-file, -f ФАЙЛ-ШРИФТУ Створити зразки ФАЙЛУ-ШРИФТУ\n" " --font-index, -n ІНД Індекс шрифту в ФАЙЛІ-ШРИФТУ\n" " --output-file, -o ФАЙЛ-РЕЗУЛЬТАТУ Зберегти зразки в ФАЙЛ-РЕЗУЛЬТАТУ\n" " --help, -h Показати це інформаційне " "повідомлення і вийти\n" " --other-font-file, -d ІНШИЙ-ШРИФТ Порівняти цей ФАЙЛУ-ШРИФТУ з ІНШИМ-" "ШРИФТОМ і виділити додані символи\n" " --other-index, -m ІНД Індекс шрифту в ІНШОМУ-ШРИФТІ\n" " --postscript-output, -s Використовувати формат PostScript " "замість PDF\n" " --svg, -g Використовувати формат SVG\n" " --print-outline, -l Друкувати зміст документа на " "стандартний вивід\n" " --write-outline, -w Створити зміст документа (тільки " "для формату PDF)\n" " --no-embed, -e Не вбудовувати шрифти, натомість " "малювати символи\n" " --include-range, -i ПРОМІЖОК Показати символи з ПРОМІЖКУ\n" " --exclude-range, -x ПРОМІЖОК Не показувати символи з ПРОМІЖКУ\n" " --style, -t \"СТИЛЬ: ЗНАЧ\" Встановити ЗНАЧЕННЯ СТИЛЮ\n" #: src/fntsample.c:801 #, c-format msgid "" "\n" "Supported styles (and default values):\n" msgstr "" "\n" "Підтримувані стилі (та значення за замовчанням):\n" #: src/fntsample.c:864 #, c-format msgid "Not enough space for rendering glyphs. Make cell font smaller.\n" msgstr "" "Недостатньо місця для відображення символів. Зробіть шрифт комірок меншим.\n" #: src/fntsample.c:870 #, c-format msgid "The font has strange metrics: ascent + descent = %g\n" msgstr "Шрифт має дивні метрики: ascent + descent = %g\n" #: src/fntsample.c:903 #, c-format msgid "Failed to parse environment variable SOURCE_DATE_EPOCH.\n" msgstr "Не вдалося розібрати змінну середовища SOURCE_DATE_EPOCH.\n" #. TRANSLATORS: 'freetype' is a name of a library, and should be left untranslated #: src/fntsample.c:929 #, c-format msgid "%s: freetype error\n" msgstr "%s: помилка freetype\n" #: src/fntsample.c:937 #, c-format msgid "%s: failed to open font file %s\n" msgstr "%s: неможливо відкрити файл шрифту %s\n" #: src/fntsample.c:947 #, c-format msgid "%s: failed to create new font face\n" msgstr "%s: неможливо створити новий шрифт\n" #. TRANSLATORS: 'cairo' is a name of a library, and should be left untranslated #: src/fntsample.c:966 #, c-format msgid "%s: failed to create cairo surface: %s\n" msgstr "%s: неможливо створити нову поверхню cairo: %s\n" #: src/fntsample.c:974 #, c-format msgid "%s: cairo_create failed: %s\n" msgstr "%s: помилка при виконанні cairo_create: %s\n" #: scripts/pdfoutline.pl:42 #, perl-format msgid "Usage: %s input.pdf outline.txt out.pdf\n" msgstr "Використання: %s оригінальний.pdf зміст.txt результат.pdf\n" #: scripts/pdfoutline.pl:141 scripts/pdf-extract-outline.pl:174 #, perl-brace-format msgid "Cannot open outline file '{outlinefile}'" msgstr "Неможливо відкрити файл змісту '{outlinefile}'" #: scripts/pdf-extract-outline.pl:48 #, perl-format msgid "Usage: %s input.pdf outline.txt\n" msgstr "Використання: %s вхідний.pdf зміст.txt\n" #: scripts/pdf-extract-outline.pl:181 msgid "Extracting outlines from encrypted files is not supported" msgstr "Видобування змісту зашифрованих файлів не підтримується" #, c-format #~ msgid "Cairo >= 1.15.4 is required for this option!\n" #~ msgstr "Для цієї опції потрібно Cairo >= 1.15.4!\n" #, c-format #~ msgid "%s: failed to create scaled font: %s\n" #~ msgstr "%s: неможливо створити масштабований шрифт: %s\n" #, c-format #~ msgid "Pango >= 1.37 is required for this option!\n" #~ msgstr "Для цієї опції потрібно Pango >= 1.37!\n" fntsample-release-5.4/screenshot.png000066400000000000000000000567351410154453100176720ustar00rootroot00000000000000PNG  IHDR7pԛsRGB pHYs+tIME/)W IDATx}w\WeM@QP+Xņ+F^bO4ElX01`WD SPT "mYe찈1yu;3w= 0 B/47nSv0Q` ӞClQj7CE{X2wVh=Z֨(Ihh>@vphe7̝P^E^'le҈$2 /,]YM뢖)(H޾}kbbR^^njjjkkK[O޿_VV֣GZl]]]]]]KKˢN:x{l֭_xcǎN:UUUaFcg͚E{@ شiSvB)))GdZZZ={Rv'BQQQ}uss"RPYBЮ(mW(?Hb ð1cTTThήe˖UUU{H$`׮]!oo/DիWgff:::} ֭\qttx3g`cu| dv'i^䫲)(Yv,zF;͂ˮ!b}}wՅ[XXXYY G677q\$رcԨQ֭3gBHWW!󵵵***zə3g<ꚟAEE1bΝ;O%qU@cU,֝~eڱz@ (--۷o1bDPP R)ܶgooAD">6lG˨!$ɨ$UTTL0aРANpOLL>|8H߆Ae—@2P~CXnQۼy3,Whs`H:;iTWW=z&999,,l۶m/FyxxfeejժK.7oAAA-[СΝ;GGG'''wǏC!==?x <?sǎq z7|SZZ \]] lllڶmmiivʮL- 丼ts=\.8Nŋ/~vB J #A,P(pg1ˎ#8/hZ 9ʍY׮]߾}llq`=1j`#fƂ.2|Č>#pԋ65L0nʻWMc gÑ`q/PPkWv0Ke);oX,nڏ1P3ی2VkS`i\Ε.pp)Gp댲dk >iՐpBx~U,=1adƍ'N3gNdd${U 3Ǟ={&NHqTHv˩' L0a۶m(=ÜЊ ---1 #mE1Fi$?Mnf#ʿUmr1 ۿ?B֒_xSRR J$--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rt %TyAK&IR7II?&F1Q:~SAM)5*Gm\@2G1 {СC̙󣣣՝=RITLǛGq<""b,uMSW>dȐSE){Us7!RK*?}cl%7g#""aTK|ȥ3dȐ7oޘ_vtiT K/dΓZMwZQ>@܊Q V^mii9dU?޽{6lsxDXB[^~, `$E"QLLZ#XlY@@իo߾]]]M_X#W222/^sNYjjj͛7nܸ~ϗdZZZuuu#G\~}S ^~=j(X#>|PZZzy*# ,?{,""bڴiܵׯ:tѱ:$$dرbm۶ X|ȑׯ_C)r(ȭcoop‰'zxx8;;;V.3$i>;w]_HSm?;;`:b5MUWK&țA F/5"#V.E` J )\7l]<_;Y{xy=h!N>''';rĐ=t:1$?vl4?~[P?|ׯǎ|0իWkkk`4 $IzXW $ɣG ,//ooo{<V+|^RT*ޞ uqZ}-$YeZDzMMMMMMp8Uş4 R*].=|`0׮P( 0I/yx6@lб@  D"aKVYYWk )o6 ^]]]m2L&SMMMyyNUUב#86.fǏg.3͇uX c 6mcc3/dmӈ>`vaN4baIN4=q3ugffsO=`A&>ŕq  P*J$1 r۷o%ݱ"|i`0%%ɵX:nssB I}jQ*^Z]]MFx|N0ρX5z(*|P($b>!Ó kN+xb8qmiiYXXxܦּ^o}}}0(7]T S'OL&Νԭt:]WW{23͛wd2J˗/@HBLq{Gh)B!:jI%ixljtYdookzQԇL&_H<3FwqRɡ|>o3L.3LHhrHdss͛7X̙3<ޑBt:Ng*z%Ud*#& hqg),RF9zE{ZmZe\rH$:=k iIENDB`fntsample-release-5.4/scripts/000077500000000000000000000000001410154453100164565ustar00rootroot00000000000000fntsample-release-5.4/scripts/CMakeLists.txt000066400000000000000000000012141410154453100212140ustar00rootroot00000000000000configure_file(pdf-extract-outline.1.in pdf-extract-outline.1 @ONLY) configure_file(pdfoutline.1.in pdfoutline.1 @ONLY) configure_file(pdfoutline.pl pdfoutline ESCAPE_QUOTES @ONLY) configure_file(pdf-extract-outline.pl pdf-extract-outline ESCAPE_QUOTES @ONLY) add_translatable_sources(pdfoutline.pl pdf-extract-outline.pl) install( PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/pdfoutline" "${CMAKE_CURRENT_BINARY_DIR}/pdf-extract-outline" DESTINATION ${CMAKE_INSTALL_BINDIR} ) install( FILES "${CMAKE_CURRENT_BINARY_DIR}/pdfoutline.1" "${CMAKE_CURRENT_BINARY_DIR}/pdf-extract-outline.1" DESTINATION "${CMAKE_INSTALL_MANDIR}/man1" ) fntsample-release-5.4/scripts/pdf-extract-outline.1.in000066400000000000000000000013521410154453100230440ustar00rootroot00000000000000.\" -*- nroff -*- .TH pdf-extract-outline 1 "@DATE@" "@CMAKE_PROJECT_VERSION@" "@CMAKE_PROJECT_NAME@" .SH NAME pdf-extract-outline \- extract outlines (aka bookmarks) from PDF files .SH SYNOPSIS .B pdf-extract-outline .I input.pdf outlines.txt .SH DESCRIPTION \fBpdf-extract-outline\fP reads input file given as first argument and extracts outlines into the file given as second argument. The output format is compatible with one accepted by \fBpdfoutline\fB. .SH OPTIONS .B pdf-extract-outline accepts no options. .SH SEE ALSO .B pdfoutline(1) .SH AUTHOR .B pdf-extract-outline author is Ievgenii Meshcheriakov .br \fBpdf-extract-outline\fP is part of \fBfntsample\fP and can be downoaded from <@CMAKE_PROJECT_HOMEPAGE_URL@>. fntsample-release-5.4/scripts/pdf-extract-outline.pl000077500000000000000000000120401410154453100227110ustar00rootroot00000000000000#! /usr/bin/env perl # This file is in the public domain # Author: Ievgenii Meshcheriakov # # This program extracts outlines from PDF files. The outlines # are stored into a text file that could be used with pdfoutline # program. # # Usage: pdf-extract-outline input.pdf outline.txt use strict; use warnings; use feature qw(say); use PDF::API2; use Locale::TextDomain('@CMAKE_PROJECT_NAME@', '@CMAKE_INSTALL_FULL_LOCALEDIR@'); use POSIX qw(:locale_h); use Encode qw(decode find_encoding); use Encode::Guess; use List::MoreUtils qw(first_index); my $fallback_encoding = 'PDFDocumentEncoding'; eval { require Encode::PDFDocumentEncoding; Encode::Guess->set_suspects(qw/PDFDocumentEncoding/); 1; } or do { warn 'Encode::PDFDocumentEncoding is missing, falling back to ASCII'; $fallback_encoding = 'ascii'; }; sub decode_pdf { my ($s) = @_; eval { decode('Guess', $s); } or do { decode $fallback_encoding, $s, sub { my $code = shift; my $repr = sprintf "\\x%02X", $code; warn "$fallback_encoding \"$repr\" does not map to Unicode"; return q{?}; }; } } sub usage { printf __"Usage: %s input.pdf outline.txt\n", $0; } sub search_tree { my ($tree, $key) = @_; if ($tree->{'Limits'}) { my ($first, $last) = @{$tree->{'Limits'}->val}; return if (($key lt $first->val) or ($key gt $last->val)); } if ($tree->{'Names'}) { my @arr = @{$tree->{'Names'}->val}; for (my $i = 0; $i < $#arr; $i += 2) { return $arr[$i + 1] if ($arr[$i]->val eq $key); } } if ($tree->{'Kids'}) { foreach my $kid (@{$tree->{'Kids'}->val}) { my $result = search_tree($kid->val, $key); return $result if $result; } } return; } sub extract_outlines { my ($pdf, $level, $outline, $F) = @_; OUTLINE: for (; $outline; $outline = $outline->{'Next'}) { $outline = $outline->val; my $raw_title = $outline->{'Title'}->val; my $title = decode_pdf($raw_title); my $dest; if ($outline->{'Dest'}) { $dest = $outline->{'Dest'}; } elsif ($outline->{'A'}) { my $a = $outline->{'A'}->val; # TODO Search for GoTo entry if ($a->{'S'}->val eq 'GoTo') { $dest = $a->{'D'}; } else { warn 'Action is not GoTo'; next OUTLINE; } } else { warn "No Dest or A entry for '$title'"; next OUTLINE; } if (ref($dest) eq 'PDF::API2::Basic::PDF::Name') { # Find the destination in Dest dictionary in Root object. my $named_ref = $dest->val; my $dests = $pdf->{'pdf'}->{'Root'}->{'Dests'}->val; $dest = $dests->{$named_ref}; } elsif (ref($dest) eq 'PDF::API2::Basic::PDF::String') { # Find the destination in Dest tree in Names dictionary of Root object my $names = $pdf->{'pdf'}->{'Root'}->{'Names'}->val; my $tree = $names->{'Dests'}->val; my $name = $dest->val; $dest = search_tree($tree, $name); unless ($dest) { warn "No Dest found with name '$name'"; next OUTLINE; } } if (ref($dest) eq 'PDF::API2::Basic::PDF::Objind') { $dest = $dest->val; } if (ref($dest) eq 'PDF::API2::Basic::PDF::Dict') { $dest = $dest->{'D'}; } if (ref($dest) eq 'PDF::API2::Basic::PDF::Array') { $dest = $dest->val; } unless ($dest) { warn "Destination not found for '$title'"; next OUTLINE; } my $page = $dest->[0]; my $page_no; if (ref($page) eq 'PDF::API2::Basic::PDF::Number') { # Some documents use numbers even for pages in the current document $page_no = $page->val + 1; } else { my $page_idx = first_index { $_ == $page } @{$pdf->{'pagestack'}}; if ($page_idx == -1) { warn "Page not found in the page stack for '$title'"; next OUTLINE; } $page_no = $page_idx + 1; } print {$F} "$level $page_no $title\n"; my $sub_outlines = $outline->{'First'}; if ($sub_outlines) { extract_outlines($pdf, $level + 1, $sub_outlines, $F); } } } setlocale(LC_ALL, q{}); if ($#ARGV != 1) { usage; exit 1; } my ($pdffile, $outlinefile) = @ARGV; my $pdf = PDF::API2->open($pdffile); open my $outline_fh, '>:encoding(UTF-8)', $outlinefile or die __x("Cannot open outline file '{outlinefile}'", outlinefile => $outlinefile); my $outlines = $pdf->{'pdf'}->{'Root'}->{'Outlines'}; if ($outlines) { if ($pdf->{'pdf'}->{'Encrypt'}) { die __('Extracting outlines from encrypted files is not supported'); } my $first = $outlines->val->{'First'}; extract_outlines($pdf, 0, $first, $outline_fh); } close $outline_fh; fntsample-release-5.4/scripts/pdfoutline.1.in000066400000000000000000000040641410154453100213220ustar00rootroot00000000000000.\" -*- nroff -*- .TH pdfoutline 1 "@DATE@" "@CMAKE_PROJECT_VERSION@" "@CMAKE_PROJECT_NAME@" .SH NAME pdfoutline \- add outlines (aka bookmarks) to PDF files \" macros .de SAMPLE .br .RS .nf .nh .. .de ESAMPLE .hy .fi .RE .. .SH SYNOPSIS .B pdfoutline .I input.pdf outlines.txt output.pdf .SH DESCRIPTION \fBpdfoutline\fP reads input file given as first argument, adds outlines from text file given as second argument, and saves result to file with name given as third argument. .P File with outlines information should consist of lines in the following format: .SAMPLE \fI\fP \fI\fP Outline text .ESAMPLE .P \fI\fP and \fI\fP should be integers. Each field should be separated by exactly one space symbol. All values for \fI\fP should be greater or equal than that of the first line. Page numeration starts with 1. .P Outlines file can contain comments that start with # in first column. Comments and empty lines are ignored. The text is expected to be in UTF-8 encoding. .SH OPTIONS .B pdfoutline accepts no options. .SH EXAMPLES Here is example of outlines data file: .SAMPLE 0 1 Document title 1 1 Chapter 1 2 1 Chapter 1.1 2 2 Chapter 1.2 1 3 Chapter 2 .ESAMPLE .P Using this file will result in outlines like the following: .SAMPLE Document title +-Chapter 1 | +-Chapter 1.1 | +-Chapter 1.2 +-Chapter 2 .ESAMPLE .SH BUGS Due to a bug in Perl library \fBPDF::API2 v2.039\fP and earlier, some Unicode characters are handled incorrectly and cause outline string corruptions. For example, everything after the CJK character U+4E0A (上) will get corrupted in the PDF output because its UTF-16 encoding contains byte 0x0A, which happens to be an ASCII newline character. .P For user convenience, this \fBpdfoutline\fP version includes a workaround that should allow flawless operation down to \fBPDF::API2 v2.034\fP. Users of even earlier versions should upgrade \fBPDF::API2\fP. .P .SH AUTHOR .B pdfoutline author is Ievgenii Meshcheriakov .br \fBpdfoutline\fP is part of \fBfntsample\fP and can be downoaded from <@CMAKE_PROJECT_HOMEPAGE_URL@>. fntsample-release-5.4/scripts/pdfoutline.pl000077500000000000000000000077151410154453100212010ustar00rootroot00000000000000#! /usr/bin/env perl # This file is in public domain # Author: Ievgenii Meshcheriakov # # This program adds outlines to pdf files. # Usage: pdfoutline input.pdf outline.txt out.pdf # # File given as second argument should contain outline information in # form: # # Some text # # where and are integers. Values for should be greater # or equal than that of first line. Page numeration starts with 1. # # Outlines file can contain comments that start with # in first column. Comments # and empty lines are ignored. # # Example file: # 0 1 Document title # 1 1 Chapter 1 # 2 1 Chapter 1.1 # 2 2 Chapter 1.2 # 1 3 Chapter 2 # # This file will result in outline like the following: # # Document title # +-Chapter 1 # | +-Chapter 1.1 # | +-Chapter 1.2 # +-Chapter 2 use strict; use warnings; use PDF::API2; use Locale::TextDomain('@CMAKE_PROJECT_NAME@', '@CMAKE_INSTALL_FULL_LOCALEDIR@'); use POSIX qw(:locale_h); use Encode qw(encode); sub usage { printf __"Usage: %s input.pdf outline.txt out.pdf\n", $0; } # get first non-empty non-comment line sub get_line { my ($F) = @_; my $line; while ($line = <$F>) { chomp $line; # skip comments ... next if $line =~ /^#/; # ... and empty lines next if $line eq q{}; last; } return $line; } # Encode string to UTF-16BE with BOM if it contains non-ASCII characters sub encode_pdf_text { my ($str) = @_; if ($str !~ /[^[:ascii:]]/) { return $str; } else { if (PDF::API2->VERSION ge "2.034") { # Perl PDF::API2 >= 2.034 already handles non-ASCII characters # automatically. This also avoids a bug before v2.040. # See: https://rt.cpan.org/Public/Bug/Display.html?id=33497 return $str; } else { # Buggy before PDF::API2 v2.040. # See: https://rt.cpan.org/Public/Bug/Display.html?id=134957 return encode('UTF-16', $str); } } } sub add_outlines { my ($pdf, $parent, $line, $F) = @_; my $cur_outline; my ($level) = split / /, $line; MAINLOOP: while ($line) { my ($new_level, $page, $text) = split / /, $line, 3; if ($new_level > $level) { $line = add_outlines($pdf, $cur_outline, $line, $F); next MAINLOOP; } elsif ($new_level < $level) { return $line; } else { $cur_outline = $parent->outline; $cur_outline->title(encode_pdf_text($text)); # FIXME it should be posible to make it easier my $pdfpage = $pdf->{pagestack}->[$page - 1]; $cur_outline->dest($pdfpage); } $line = get_line($F); } } # Create new outlines object ignorig outlines that can be # already present in the PDF file. sub new_outlines { my ($pdf) = @_; require PDF::API2::Outlines; $pdf->{'pdf'}->{'Root'}->{'Outlines'} = PDF::API2::Outlines->new($pdf); my $obj = $pdf->{'pdf'}->{'Root'}->{'Outlines'}; $pdf->{'pdf'}->new_obj($obj) unless $obj->is_obj($pdf->{'pdf'}); $pdf->{'pdf'}->out_obj($obj); $pdf->{'pdf'}->out_obj($pdf->{'pdf'}->{'Root'}); return $obj; } setlocale(LC_ALL, q{}); if ($#ARGV != 2) { usage; exit 1; } if (PDF::API2->VERSION le "2.033") { print STDERR "Warning: Perl PDF::API2 v2.033 or earlier detected.\n"; print STDERR "It's known to have an outline corruption bug!\n"; print STDERR "See pdfoutline man page for more information.\n"; } my ($inputfile, $outlinefile, $outputfile) = @ARGV; my $pdf = PDF::API2->open($inputfile); open my $outline_fh, '<:encoding(UTF-8)', $outlinefile or die __x("Cannot open outline file '{outlinefile}'", outlinefile => $outlinefile); my $line = get_line($outline_fh); # create new outlines here, don't try to use old ones my $outlines = new_outlines($pdf); add_outlines($pdf, $outlines, $line, $outline_fh) if $line; close $outline_fh; $pdf->saveas($outputfile); exit 0; fntsample-release-5.4/src/000077500000000000000000000000001410154453100155565ustar00rootroot00000000000000fntsample-release-5.4/src/CMakeLists.txt000066400000000000000000000027361410154453100203260ustar00rootroot00000000000000configure_file(config.h.in config.h ESCAPE_QUOTES @ONLY) configure_file(fntsample.1.in fntsample.1 @ONLY) set( C_WARNING_FLAGS -Wcast-align -Werror-implicit-function-declaration -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -Wmissing-format-attribute -fno-common -Wundef CACHE STRING "Warning flags for C compiler" ) add_executable(gen-unicode-blocks EXCLUDE_FROM_ALL gen_unicode_blocks.c read_blocks.c ) target_compile_features(gen-unicode-blocks PRIVATE c_std_99) target_compile_options(gen-unicode-blocks PRIVATE ${C_WARNING_FLAGS}) add_custom_command( OUTPUT static_unicode_blocks.c COMMAND "$" "${UNICODE_BLOCKS}" static_unicode_blocks.c MAIN_DEPENDENCY ${UNICODE_BLOCKS} DEPENDS gen-unicode-blocks VERBATIM ) add_executable(fntsample fntsample.c read_blocks.c ${CMAKE_CURRENT_BINARY_DIR}/static_unicode_blocks.c ) add_translatable_sources(fntsample.c read_blocks.c) target_compile_features(fntsample PRIVATE c_std_99) target_include_directories(fntsample PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ) target_link_libraries(fntsample PRIVATE m Intl::Intl PkgConfig::pkgs ) target_compile_options(fntsample PRIVATE ${C_WARNING_FLAGS}) # TODO use improved install handling in CMake 3.14 install(TARGETS fntsample DESTINATION ${CMAKE_INSTALL_BINDIR}) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/fntsample.1" DESTINATION "${CMAKE_INSTALL_MANDIR}/man1") fntsample-release-5.4/src/config.h.in000066400000000000000000000002551410154453100176030ustar00rootroot00000000000000#ifndef CONFIG_H #define CONFIG_H #cmakedefine CMAKE_PROJECT_NAME "@CMAKE_PROJECT_NAME@" #cmakedefine CMAKE_INSTALL_FULL_LOCALEDIR "@CMAKE_INSTALL_FULL_LOCALEDIR@" #endif fntsample-release-5.4/src/fntsample.1.in000066400000000000000000000107141410154453100202410ustar00rootroot00000000000000.\" -*- nroff -*- .TH fntsample 1 "@DATE@" "@CMAKE_PROJECT_VERSION@" "@CMAKE_PROJECT_NAME@" .SH NAME fntsample \- PDF and PostScript font samples generator \" macros .de SAMPLE .br .RS .nf .nh .. .de ESAMPLE .hy .fi .RE .. .SH SYNOPSIS .B fntsample .BI "[ " OPTIONS " ]" .BI "\-f " FONT-FILE " \-o " OUTPUT-FILE .br .B fntsample \-h .SH DESCRIPTION .B fntsample program can be used to generate font samples that show Unicode coverage of the font and are similar in appearance to Unicode charts. Samples can be saved into PDF (default) or PostScript file. .SH OPTIONS .B fntsample supports the following options. .TP .BI "\-\-blocks\-file, \-b " BLOCKS-FILE Read Unicode blocks information from .IR BLOCKS-FILE . .TP .BI "\-\-font\-file, \-f " FONT-FILE Make samples of .IR FONT-FILE . .TP .BI "\-\-font\-index, \-n " IDX Font index for \fIFONT-FILE\fP specified using \fB\-\-font\-file\fP option. Useful for files that contain multiple fonts, like TrueType Collections (.ttc). By default font with index 0 is used. .TP .BI "\-\-output\-file, \-o " OUTPUT-FILE Write output to .IR OUTPUT-FILE . .TP .BI "\-\-other\-font\-file, \-d " OTHER-FONT Compare .I FONT-FILE with .IR OTHER-FONT . Glyphs added to .I FONT-FILE will be highlighted. .TP .BI "\-\-other\-index, \-m " IDX Font index for \fIOTHER-FONT\fP specified using \fB\-\-other\-font\-file\fP option. .TP .BI "\-\-postscript\-output, \-s" Use PostScript format for output instead of PDF. .TP .BI "\-\-svg, \-g" Use SVG format for output. The generated document contains one page. Use range selection options to specify which. .TP .BI "\-\-print\-outline, \-l" Print document outlines data to standard output. This data can be used to add outlines (aka bookmarks) to resulting PDF file with \fBpdfoutline\fP program. .TP .BI "\-\-write\-outline, \-w" Write document outlines directly (only in PDF output). .TP .BI "\-\-include\-range, \-i " RANGE Show characters in \fIRANGE\fP. .TP .BI "\-\-exclude\-range, \-x " RANGE Do not show characters in \fIRANGE\fP. .TP .BI "\-\-style, \-t \(dq" STYLE ": " VAL "\(dq" Set \fISTYLE\fP to value \fIVAL\fP. Run \fBfntsample\fP with option \fB\-\-help\fP to see list of styles and default values. .TP .BI "\-\-no\-embed, \-e" Draw the outlines of the glyphs instead of embedding them in the PDF file. This can be used when embedding the font is not desired or not allowed. .TP .BI "\-\-help, \-h" Display help text and exit. .P Parameter \fIRANGE\fP for \fB\-i\fP and \fB\-x\fP can be given as one integer or a pair of integers delimited by minus sign (\-). Integers can be specified in decimal, hexadecimal (0x...) or octal (0...) format. One integer of a pair can be missing (\-N can be used to specify all characters with codes less or equal to N, and N\- for all characters with codes greather or equal to N). Multiple \fB\-i\fP and \fB\-x\fP options can be used. .SH COLORS Glyph cells can have one of several background colors. Meaning of those colors is following: .TP .B white normal glyph present in the font, this includes space glyphs that are usually invisible; .TP .B gray this glyph is defined in Unicode but not present in the font; .TP .B blue this is a control character; .TP .B black this glyph is not defined in Unicode; .TP .B yellow this is a new glyph (only when used with \fB\-d\fP). .SH ENVIRONMENT .TP .B SOURCE_DATE_EPOCH If $\fBSOURCE_DATE_EPOCH\fP is set, its value is interpreted as Unix timestamp to be used for creation date of generated PDF files. This is useful for making builds that use \fBfntsample\fP reproducible. .SH EXAMPLES .RI "Make PDF samples for " font.ttf " and write them to file " samples.pdf : .SAMPLE fntsample \-f font.ttf \-o samples.pdf .ESAMPLE .PP .RI "Make PDF samples for " font.ttf ", compare it with " oldfont.ttf .RI "and highlight new glyphs. Write output to file " samples.pdf : .SAMPLE fntsample \-f font.ttf \-d oldfont.ttf \-o samples.pdf .ESAMPLE .PP .RI "Make PostScript samples for " font.ttf " and write output to file " samples.ps . Show only glyphs for characters with codes less or equal to U+04FF but exclude U+0370\-U+03FF: .SAMPLE fntsample \-f font.ttf \-s \-o samples.ps \-i \-0x04FF \-x 0x0370\-0x03FF .ESAMPLE .PP .RI "Make PDF samples for " font.ttf " and save output to file " samples.pdf " adding outlines to it:" .SAMPLE fntsample \-f font.ttf \-o temp.pdf \-l > outlines.txt pdfoutline temp.pdf outlines.txt samples.pdf .ESAMPLE .SH AUTHOR Copyright \(co Ievgenii Meshcheriakov .br Homepage: <@CMAKE_PROJECT_HOMEPAGE_URL@> .SH SEE ALSO .PP .BR pdfoutline (1) fntsample-release-5.4/src/fntsample.c000066400000000000000000000737511410154453100177300ustar00rootroot00000000000000/* Copyright © Євгеній Мещеряков * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 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 the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include #include #include #include FT_FREETYPE_H #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "unicode_blocks.h" #include "static_unicode_blocks.h" #include "config.h" #define _(str) gettext(str) #define POINTS_PER_INCH 72 #define A4_WIDTH (8.3 * POINTS_PER_INCH) #define A4_HEIGHT (11.7 * POINTS_PER_INCH) #define xmin_border (POINTS_PER_INCH / 1.5) #define ymin_border POINTS_PER_INCH #define cell_width ((A4_WIDTH - 2 * xmin_border) / 16) #define cell_height ((A4_HEIGHT - 2 * ymin_border) / 16) static double cell_x(double x_min, int pos) { return x_min + cell_width * (pos / 16); } static double cell_y(int pos) { return ymin_border + cell_height * (pos % 16); } static struct option longopts[] = { {"blocks-file", 1, 0, 'b'}, {"font-file", 1, 0, 'f'}, {"output-file", 1, 0, 'o'}, {"help", 0, 0, 'h'}, {"other-font-file", 1, 0, 'd'}, {"postscript-output", 0, 0, 's'}, {"svg", 0, 0, 'g'}, {"print-outline", 0, 0, 'l'}, {"write-outline", 0, 0, 'w'}, {"include-range", 1, 0, 'i'}, {"exclude-range", 1, 0, 'x'}, {"style", 1, 0, 't'}, {"font-index", 1, 0, 'n'}, {"other-index", 1, 0, 'm'}, {"no-embed", 0, 0, 'e'}, {"use-pango", 0, 0, 'p'}, /* For compatibility with version <= 5.3 */ {0, 0, 0, 0} }; struct range { uint32_t first; uint32_t last; bool include; struct range *next; }; static const char *font_file_name; static const char *other_font_file_name; static const char *output_file_name; static bool postscript_output; static bool svg_output; static bool print_outline; static bool write_outline; static bool no_embed; static struct range *ranges; static struct range *last_range; static int font_index; static int other_index; struct fntsample_style { const char *const name; const char *const default_val; char *val; }; static struct fntsample_style styles[] = { { "header-font", "Sans Bold 12", NULL }, { "font-name-font", "Serif Bold 12", NULL }, { "table-numbers-font", "Sans 10", NULL }, { "cell-numbers-font", "Mono 8", NULL }, { NULL, NULL, NULL } }; struct table_fonts { PangoFontDescription *header; PangoFontDescription *font_name; PangoFontDescription *table_numbers; PangoFontDescription *cell_numbers; }; static struct table_fonts table_fonts; static double cell_label_offset; static double cell_glyph_bot_offset; static double glyph_baseline_offset; static double font_scale; static const struct unicode_block *unicode_blocks; static void usage(const char *); static struct fntsample_style *find_style(const char *name) { for (struct fntsample_style *style = styles; style->name; style++) { if (!strcmp(name, style->name)) { return style; } } return NULL; } static int set_style(const char *name, const char *val) { struct fntsample_style *style = find_style(name); if (!style) { return -1; } char *new_val = strdup(val); if (!new_val) { return -1; } if (style->val) { free(style->val); } style->val = new_val; return 0; } static const char *get_style(const char *name) { struct fntsample_style *style = find_style(name); if (!style) { return NULL; } return style->val ? style->val : style->default_val; } static int parse_style_string(char *s) { char *n = strchr(s, ':'); if (!n) { return -1; } *n++ = '\0'; return set_style(s, n); } /* * Update output range. * * Returns -1 on error. */ static int add_range(char *range, bool include) { uint32_t first = 0, last = 0xffffffff; char *endptr; char *minus = strchr(range, '-'); if (minus) { if (minus != range) { *minus = '\0'; first = strtoul(range, &endptr, 0); if (*endptr) { return -1; } } if (*(minus + 1)) { last = strtoul(minus + 1, &endptr, 0); if (*endptr) { return -1; } } else if (minus == range) { return -1; } } else { first = strtoul(range, &endptr, 0); if (*endptr) return -1; last = first; } if (first > last) { return -1; } struct range *r = malloc(sizeof(*r)); if (!r) { return -1; } r->first = first; r->last = last; r->include = include; r->next = NULL; if (ranges) { last_range->next = r; } else { ranges = r; } last_range = r; return 0; } /* * Check if character with the given code belongs * to output range specified by the user. */ static bool in_range(uint32_t c) { bool in = ranges ? (!ranges->include) : 1; for (struct range *r = ranges; r; r = r->next) { if ((c >= r->first) && (c <= r->last)) { in = r->include; } } return in; } /* * Get glyph index for the next glyph from the given font face, that * represents character from output range specified by the user. * * Returns character code, updates 'idx'. * 'idx' can became 0 if there are no more glyphs. */ static FT_ULong get_next_char(FT_Face face, FT_ULong charcode, FT_UInt *idx) { FT_ULong rval = charcode; do { rval = FT_Get_Next_Char(face, rval, idx); } while (*idx && !in_range(rval)); return rval; } /* * Locate first character from the given font face that belongs * to the user-specified output range. * * Returns character code, updates 'idx' with glyph index. * Glyph index can became 0 if there are no matching glyphs in the font. */ static FT_ULong get_first_char(FT_Face face, FT_UInt *idx) { FT_ULong rval = FT_Get_First_Char(face, idx); if (*idx && !in_range(rval)) { rval = get_next_char(face, rval, idx); } return rval; } /* * Create Pango layout for the given text. * Updates 'r' with text extents. * Returned layout should be freed using g_object_unref(). */ static PangoLayout *layout_text(cairo_t *cr, PangoFontDescription *ftdesc, const char *text, PangoRectangle *r) { PangoLayout *layout = pango_cairo_create_layout(cr); pango_layout_set_font_description(layout, ftdesc); pango_layout_set_text(layout, text, -1); pango_layout_get_extents(layout, r, NULL); return layout; } static void parse_options(int argc, char * const argv[]) { for (;;) { int n; int c = getopt_long(argc, argv, "b:f:o:hd:sglwi:x:t:n:m:ep", longopts, NULL); if (c == -1) { break; } switch (c) { case 'b': if (unicode_blocks) { fprintf(stderr, _("Unicode blocks file should be given at most once!\n")); exit(1); } unicode_blocks = read_blocks(optarg, &n); if (n == 0) { fprintf(stderr, _("Failed to load any blocks from the blocks file!\n")); exit(6); } break; case 'f': if (font_file_name) { fprintf(stderr, _("Font file name should be given only once!\n")); exit(1); } font_file_name = optarg; break; case 'o': if (output_file_name) { fprintf(stderr, _("Output file name should be given only once!\n")); exit(1); } output_file_name = optarg; break; case 'h': usage(argv[0]); exit(0); break; case 'd': if (other_font_file_name) { fprintf(stderr, _("Font file name should be given only once!\n")); exit(1); } other_font_file_name = optarg; break; case 's': postscript_output = true; break; case 'g': svg_output = true; break; case 'l': print_outline = true; break; case 'w': write_outline = true; break; case 'i': case 'x': if (add_range(optarg, c == 'i')) { usage(argv[0]); exit(1); } break; case 't': if (parse_style_string(optarg) == -1) { usage(argv[0]); exit(1); } break; case 'n': font_index = atoi(optarg); break; case 'm': other_index = atoi(optarg); break; case 'e': no_embed = true; break; case 'p': /* Ignored for compatibility */ break; case '?': default: usage(argv[0]); exit(1); break; } } if (!font_file_name || !output_file_name) { usage(argv[0]); exit(1); } if (font_index < 0 || other_index < 0) { fprintf(stderr, _("Font index should be non-negative!\n")); exit(1); } if (postscript_output && svg_output) { fprintf(stderr, _("-s and -g cannot be used together!\n")); exit(1); } if (!unicode_blocks) { unicode_blocks = static_unicode_blocks; } } /* * Locate unicode block that contains given character code. * Returns this block or NULL if not found. */ static const struct unicode_block *get_unicode_block(unsigned long charcode) { for (const struct unicode_block *block = unicode_blocks; block->name; block++) { if ((charcode >= block->start) && (charcode <= block->end)) { return block; } } return NULL; } /* * Check if the given character code belongs to the given Unicode block. */ static bool is_in_block(unsigned long charcode, const struct unicode_block *block) { return ((charcode >= block->start) && (charcode <= block->end)); } /* * Format and print/write outline information, if requested by the user. */ static void outline(cairo_surface_t *surface, int level, int page, const char *text) { if (print_outline) { printf("%d %d %s\n", level, page, text); } if (write_outline && cairo_surface_get_type(surface) == CAIRO_SURFACE_TYPE_PDF) { int len = snprintf(0, 0, "page=%d", page); char *dest = malloc(len + 1); sprintf(dest, "page=%d", page); /* FIXME passing level here is not correct. */ cairo_pdf_surface_add_outline(surface, level, text, dest, CAIRO_PDF_OUTLINE_FLAG_OPEN); free(dest); } } /* * Draw header of a page. * Header shows font name and current Unicode block. */ static void draw_header(cairo_t *cr, const char *face_name, const char *block_name) { PangoRectangle r; PangoLayout *layout = layout_text(cr, table_fonts.font_name, face_name, &r); cairo_move_to(cr, (A4_WIDTH - pango_units_to_double(r.width))/2.0, 30.0); pango_cairo_show_layout_line(cr, pango_layout_get_line_readonly(layout, 0)); g_object_unref(layout); layout = layout_text(cr, table_fonts.header, block_name, &r); cairo_move_to(cr, (A4_WIDTH - pango_units_to_double(r.width))/2.0, 50.0); pango_cairo_show_layout_line(cr, pango_layout_get_line_readonly(layout, 0)); g_object_unref(layout); } /* * Highlight the cell with given coordinates. * Used to highlight new glyphs. */ static void highlight_cell(cairo_t *cr, double x, double y) { cairo_save(cr); cairo_set_source_rgb(cr, 1.0, 1.0, 0.6); cairo_rectangle(cr, x, y, cell_width, cell_height); cairo_fill(cr); cairo_restore(cr); } /* * Draw table grid with row and column numbers. */ static void draw_grid(cairo_t *cr, unsigned int x_cells, unsigned long block_start) { const double x_min = (A4_WIDTH - x_cells * cell_width) / 2; const double x_max = (A4_WIDTH + x_cells * cell_width) / 2; const double table_height = A4_HEIGHT - ymin_border * 2; cairo_set_line_width(cr, 1.0); cairo_rectangle(cr, x_min, ymin_border, x_max - x_min, table_height); cairo_move_to(cr, x_min, ymin_border); cairo_line_to(cr, x_min, ymin_border - 15.0); cairo_move_to(cr, x_max, ymin_border); cairo_line_to(cr, x_max, ymin_border - 15.0); cairo_stroke(cr); cairo_set_line_width(cr, 0.5); /* draw horizontal lines */ for (int i = 1; i < 16; i++) { // TODO: use better name instead of just POINTS_PER_INCH cairo_move_to(cr, x_min, POINTS_PER_INCH + i * table_height/16); cairo_line_to(cr, x_max, POINTS_PER_INCH + i * table_height/16); } /* draw vertical lines */ for (unsigned int i = 1; i < x_cells; i++) { cairo_move_to(cr, x_min + i * cell_width, ymin_border); cairo_line_to(cr, x_min + i * cell_width, A4_HEIGHT - ymin_border); } cairo_stroke(cr); /* draw glyph numbers */ char buf[17]; buf[1] = '\0'; #define hexdigs "0123456789ABCDEF" for (int i = 0; i < 16; i++) { buf[0] = hexdigs[i]; PangoRectangle r; PangoLayout *layout = layout_text(cr, table_fonts.table_numbers, buf, &r); cairo_move_to(cr, x_min - pango_units_to_double(PANGO_RBEARING(r)) - 5.0, POINTS_PER_INCH + (i+0.5) * table_height/16 + pango_units_to_double(PANGO_DESCENT(r))/2); pango_cairo_show_layout_line(cr, pango_layout_get_line_readonly(layout, 0)); cairo_move_to(cr, x_min + x_cells * cell_width + 5.0, POINTS_PER_INCH + (i+0.5) * table_height/16 + pango_units_to_double(PANGO_DESCENT(r))/2); pango_cairo_show_layout_line(cr, pango_layout_get_line_readonly(layout, 0)); g_object_unref(layout); } for (unsigned int i = 0; i < x_cells; i++) { snprintf(buf, sizeof(buf), "%03lX", block_start / 16 + i); PangoRectangle r; PangoLayout *layout = layout_text(cr, table_fonts.table_numbers, buf, &r); cairo_move_to(cr, x_min + i*cell_width + (cell_width - pango_units_to_double(r.width))/2, ymin_border - 5.0); pango_cairo_show_layout_line(cr, pango_layout_get_line_readonly(layout, 0)); g_object_unref(layout); } } /* * Fill empty cell. Color of the fill depends on the character properties. */ static void fill_empty_cell(cairo_t *cr, double x, double y, unsigned long charcode) { cairo_save(cr); if (g_unichar_isdefined(charcode)) { if (g_unichar_iscntrl(charcode)) cairo_set_source_rgb(cr, 0.0, 0.0, 0.5); else cairo_set_source_rgb(cr, 0.5, 0.5, 0.5); } cairo_rectangle(cr, x, y, cell_width, cell_height); cairo_fill(cr); cairo_restore(cr); } /* * Draw label with character code. */ static void draw_charcode(cairo_t *cr, double x, double y, FT_ULong charcode) { char buf[9]; snprintf(buf, sizeof(buf), "%04lX", charcode); PangoRectangle r; PangoLayout *layout = layout_text(cr, table_fonts.cell_numbers, buf, &r); cairo_move_to(cr, x + (cell_width - pango_units_to_double(r.width))/2.0, y + cell_height - cell_label_offset); pango_cairo_show_layout_line(cr, pango_layout_get_line_readonly(layout, 0)); g_object_unref(layout); } /* * Draws tables for all characters in the given Unicode block. * Use font described by face and ft_face. Start from character * with given charcode (it should belong to the given Unicode * block). After return 'charcode' equals the last character code * of the block. * * Returns number of pages drawn. */ static int draw_unicode_block(cairo_t *cr, PangoLayout *layout, FT_Face ft_face, const char *font_name, unsigned long *charcode, const struct unicode_block *block, FT_Face ft_other_face) { unsigned long prev_charcode; unsigned long prev_cell; int npages = 0; FT_UInt idx = FT_Get_Char_Index(ft_face, *charcode); do { unsigned long offset = ((*charcode - block->start) / 0x100) * 0x100; unsigned long tbl_start = block->start + offset; unsigned long tbl_end = tbl_start + 0xFF > block->end ? block->end + 1 : tbl_start + 0x100; unsigned int rows = (tbl_end - tbl_start) / 16; double x_min = (A4_WIDTH - rows * cell_width) / 2; bool filled_cells[256]; /* 16x16 glyphs max */ cairo_save(cr); draw_header(cr, font_name, block->name); prev_cell = tbl_start - 1; memset(filled_cells, '\0', sizeof(filled_cells)); /* * Fill empty cells and calculate coordinates of the glyphs. * Also highlight cells if needed. */ do { /* the current glyph position in the table */ int charpos = *charcode - tbl_start; /* fill empty cells before the current glyph */ for (unsigned long i = prev_cell + 1; i < *charcode; i++) { int pos = i - tbl_start; fill_empty_cell(cr, cell_x(x_min, pos), cell_y(pos), i); } /* if it is new glyph - highlight the cell */ if (ft_other_face && !FT_Get_Char_Index(ft_other_face, *charcode)) { highlight_cell(cr, cell_x(x_min, charpos), cell_y(charpos)); } /* draw the character */ char buf[9]; gint len = g_unichar_to_utf8((gunichar)*charcode, buf); pango_layout_set_text(layout, buf, len); double baseline = pango_units_to_double(pango_layout_get_baseline(layout)); cairo_move_to(cr, cell_x(x_min, charpos), cell_y(charpos) + glyph_baseline_offset - baseline); if (no_embed) { pango_cairo_layout_path(cr, layout); } else { pango_cairo_show_layout(cr, layout); } filled_cells[charpos] = true; prev_charcode = *charcode; prev_cell = *charcode; *charcode = get_next_char(ft_face, *charcode, &idx); } while (idx && (*charcode < tbl_end) && is_in_block(*charcode, block)); /* Fill remaining empty cells */ for (unsigned long i = prev_cell + 1; i < tbl_end; i++) { int pos = i - tbl_start; fill_empty_cell(cr, cell_x(x_min, pos), cell_y(pos), i); } /* * Charcodes are drawn here to avoid switching between the charcode * font and the cell font for each filled cell. */ for (unsigned long i = 0; i < tbl_end - tbl_start; i++) { if (filled_cells[i]) { draw_charcode(cr, cell_x(x_min, i), cell_y(i), i + tbl_start); } } draw_grid(cr, rows, tbl_start); npages++; cairo_show_page(cr); cairo_restore(cr); } while (idx && is_in_block(*charcode, block)); *charcode = prev_charcode; return npages; } static PangoLayout *create_glyph_layout(cairo_t *cr, FcConfig *fc_config, FcPattern *fc_font) { PangoFontMap *fontmap = pango_cairo_font_map_new_for_font_type(CAIRO_FONT_TYPE_FT); pango_fc_font_map_set_config(PANGO_FC_FONT_MAP(fontmap), fc_config); PangoContext *context = pango_font_map_create_context(fontmap); pango_cairo_update_context(cr, context); PangoFontDescription *font_desc = pango_fc_font_description_from_pattern(fc_font, FALSE); PangoLayout *layout = pango_layout_new(context); pango_layout_set_font_description(layout, font_desc); pango_layout_set_width(layout, pango_units_from_double(cell_width)); pango_layout_set_alignment(layout, PANGO_ALIGN_CENTER); g_object_unref(context); g_object_unref(fontmap); pango_font_description_free(font_desc); return layout; } /* * The main drawing function. */ static void draw_glyphs(cairo_t *cr, FT_Face ft_face, FT_Face ft_other_face) { FcConfig *fc_config = FcConfigCreate(); FcConfigAppFontAddFile(fc_config, (const FcChar8 *)font_file_name); FcPattern *fc_pat = FcPatternCreate(); FcPatternAddInteger(fc_pat, FC_INDEX, font_index); FcFontSet *fc_fontset = FcFontList(fc_config, fc_pat, NULL); assert(fc_fontset->nfont > 0); FcPattern *fc_font = fc_fontset->fonts[0]; const char *font_name; if (FcPatternGetString(fc_font, FC_FULLNAME, 0, (FcChar8 **)&font_name) != FcResultMatch) { font_name = "Unknown"; } cairo_surface_t *surface = cairo_get_target(cr); int pageno = 1; outline(surface, 0, pageno, font_name); PangoLayout *layout = create_glyph_layout(cr, fc_config, fc_font); FT_UInt idx; FT_ULong charcode = get_first_char(ft_face, &idx); while (idx) { const struct unicode_block *block = get_unicode_block(charcode); if (block) { outline(surface, 1, pageno, block->name); int npages = draw_unicode_block(cr, layout, ft_face, font_name, &charcode, block, ft_other_face); pageno += npages; } charcode = get_next_char(ft_face, charcode, &idx); } g_object_unref(layout); FcPatternDestroy(fc_pat); FcFontSetDestroy(fc_fontset); FcConfigDestroy(fc_config); } /* * Print usage instructions and default values for styles */ static void usage(const char *cmd) { fprintf(stderr, _("Usage: %s [ OPTIONS ] -f FONT-FILE -o OUTPUT-FILE\n" " %s -h\n\n") , cmd, cmd); fprintf(stderr, _("Options:\n" " --blocks-file, -b BLOCKS-FILE Read Unicode blocks information from BLOCKS-FILE\n" " --font-file, -f FONT-FILE Create samples of FONT-FILE\n" " --font-index, -n IDX Font index in FONT-FILE\n" " --output-file, -o OUTPUT-FILE Save samples to OUTPUT-FILE\n" " --help, -h Show this information message and exit\n" " --other-font-file, -d OTHER-FONT Compare FONT-FILE with OTHER-FONT and highlight added glyphs\n" " --other-index, -m IDX Font index in OTHER-FONT\n" " --postscript-output, -s Use PostScript format for output instead of PDF\n" " --svg, -g Use SVG format for output\n" " --print-outline, -l Print document outlines data to standard output\n" " --write-outline, -w Write document outlines (only in PDF output)\n" " --no-embed, -e Don't embed the font in the output file, draw the glyphs instead\n" " --include-range, -i RANGE Show characters in RANGE\n" " --exclude-range, -x RANGE Do not show characters in RANGE\n" " --style, -t \"STYLE: VAL\" Set STYLE to value VAL\n")); fprintf(stderr, _("\nSupported styles (and default values):\n")); for (const struct fntsample_style *style = styles; style->name; style++) { fprintf(stderr, "\t%s (%s)\n", style->name, style->default_val); } } /* * Initialize fonts used to print table heders and character codes. */ static void init_table_fonts(void) { /* FIXME is this correct? */ PangoCairoFontMap *map = (PangoCairoFontMap *)pango_cairo_font_map_get_default(); pango_cairo_font_map_set_resolution(map, POINTS_PER_INCH); table_fonts.header = pango_font_description_from_string(get_style("header-font")); table_fonts.font_name = pango_font_description_from_string(get_style("font-name-font")); table_fonts.table_numbers = pango_font_description_from_string(get_style("table-numbers-font")); table_fonts.cell_numbers = pango_font_description_from_string(get_style("cell-numbers-font")); } /* * Calculate various offsets. */ static void calculate_offsets(cairo_t *cr) { PangoRectangle extents; /* Assume that vertical extents does not depend on actual text */ PangoLayout *l = layout_text(cr, table_fonts.cell_numbers, "0123456789ABCDEF", &extents); g_object_unref(l); /* Unsolved mistery of pango's font metrics.... */ double digits_ascent = pango_units_to_double(PANGO_DESCENT(extents)); double digits_descent = -pango_units_to_double(PANGO_ASCENT(extents)); cell_label_offset = digits_descent + 2; cell_glyph_bot_offset = cell_label_offset + digits_ascent + 2; } /* * Calculate font scaling */ void calc_font_scaling(FT_Face ft_face) { cairo_font_face_t *cr_face = cairo_ft_font_face_create_for_ft_face(ft_face, 0); cairo_font_options_t *options = cairo_font_options_create(); /* First create font with size 1 and measure it */ cairo_matrix_t font_matrix; cairo_matrix_init_identity(&font_matrix); cairo_matrix_t ctm; cairo_matrix_init_identity(&ctm); /* Turn off rounding, so we can get real metrics */ cairo_font_options_set_hint_metrics(options, CAIRO_HINT_METRICS_OFF); cairo_scaled_font_t *cr_font = cairo_scaled_font_create(cr_face, &font_matrix, &ctm, options); cairo_font_extents_t extents; cairo_scaled_font_extents(cr_font, &extents); /* Use some magic to find the best font size... */ double tgt_size = cell_height - cell_glyph_bot_offset - 2; if (tgt_size <= 0) { fprintf(stderr, _("Not enough space for rendering glyphs. Make cell font smaller.\n")); exit(5); } double act_size = extents.ascent + extents.descent; if (act_size <= 0) { fprintf(stderr, _("The font has strange metrics: ascent + descent = %g\n"), act_size); exit(5); } font_scale = tgt_size / act_size; if (font_scale > 1) font_scale = trunc(font_scale); // just to make numbers nicer if (font_scale > 20) font_scale = 20; // Do not make font larger than in previous versions cairo_scaled_font_destroy(cr_font); /* Create the font once again, but this time scaled */ cairo_matrix_init_scale(&font_matrix, font_scale, font_scale); cr_font = cairo_scaled_font_create(cr_face, &font_matrix, &ctm, options); cairo_scaled_font_extents(cr_font, &extents); glyph_baseline_offset = (tgt_size - (extents.ascent + extents.descent)) / 2 + 2 + extents.ascent; cairo_scaled_font_destroy(cr_font); } /* * Configure DPF surface metadata so fntsample can be used with * repeatable builds. */ static void set_repeatable_pdf_metadata(cairo_surface_t *surface) { char *source_date_epoch = getenv("SOURCE_DATE_EPOCH"); if (source_date_epoch) { char *endptr; time_t now = strtoul(source_date_epoch, &endptr, 10); if (*endptr != 0) { fprintf(stderr, _("Failed to parse environment variable SOURCE_DATE_EPOCH.\n")); exit(1); } struct tm *build_time = gmtime(&now); char buffer[25]; strftime(buffer, sizeof(buffer), "%Y-%m-%dT%H:%M:%S%z", build_time); cairo_pdf_surface_set_metadata(surface, CAIRO_PDF_METADATA_CREATE_DATE, buffer); } } int main(int argc, char **argv) { setlocale(LC_ALL, ""); bindtextdomain(CMAKE_PROJECT_NAME, CMAKE_INSTALL_FULL_LOCALEDIR); textdomain(CMAKE_PROJECT_NAME); parse_options(argc, argv); FT_Library library; FT_Error error = FT_Init_FreeType(&library); if (error) { /* TRANSLATORS: 'freetype' is a name of a library, and should be left untranslated */ fprintf(stderr, _("%s: freetype error\n"), argv[0]); exit(3); } FT_Face face; error = FT_New_Face(library, font_file_name, font_index, &face); if (error) { fprintf(stderr, _("%s: failed to open font file %s\n"), argv[0], font_file_name); exit(4); } FT_Face other_face = NULL; if (other_font_file_name) { error = FT_New_Face(library, other_font_file_name, other_index, &other_face); if (error) { fprintf(stderr, _("%s: failed to create new font face\n"), argv[0]); exit(4); } } cairo_surface_t *surface; if (postscript_output) { surface = cairo_ps_surface_create(output_file_name, A4_WIDTH, A4_HEIGHT); } else if (svg_output) { surface = cairo_svg_surface_create(output_file_name, A4_WIDTH, A4_HEIGHT); } else { surface = cairo_pdf_surface_create(output_file_name, A4_WIDTH, A4_HEIGHT); /* A4 paper */ set_repeatable_pdf_metadata(surface); } cairo_status_t cr_status = cairo_surface_status(surface); if (cr_status != CAIRO_STATUS_SUCCESS) { /* TRANSLATORS: 'cairo' is a name of a library, and should be left untranslated */ fprintf(stderr, _("%s: failed to create cairo surface: %s\n"), argv[0], cairo_status_to_string(cr_status)); exit(1); } cairo_t *cr = cairo_create(surface); cr_status = cairo_status(cr); if (cr_status != CAIRO_STATUS_SUCCESS) { fprintf(stderr, _("%s: cairo_create failed: %s\n"), argv[0], cairo_status_to_string(cr_status)); exit(1); } cairo_surface_destroy(surface); init_table_fonts(); calculate_offsets(cr); cairo_set_source_rgb(cr, 0.0, 0.0, 0.0); calc_font_scaling(face); draw_glyphs(cr, face, other_face); cairo_destroy(cr); return 0; } fntsample-release-5.4/src/gen_unicode_blocks.c000066400000000000000000000036411410154453100215420ustar00rootroot00000000000000/* Copyright © Євгеній Мещеряков * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 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 the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include "unicode_blocks.h" #include static void write_header(FILE *f) { fprintf(f, "#include \"static_unicode_blocks.h\"\n" "\n" "const struct unicode_block static_unicode_blocks[] = {\n" ); } static void write_footer(FILE *f) { fprintf(f, " {0, 0, NULL},\n" "};\n" ); } static void write_block(FILE *f, const struct unicode_block *block) { fprintf(f, " {0x%04lx, 0x%04lx, \"%s\"},\n", block->start, block->end, block->name); } static void write_blocks(FILE *f, const struct unicode_block *blocks, int n) { write_header(f); for (int i = 0; i < n; i++) { write_block(f, blocks + i); } write_footer(f); } int main(int argc, char **argv) { if (argc != 3) { fprintf(stderr, "Usage: %s Blocks.txt output.c\n", argv[0]); return 1; } int n; struct unicode_block *blocks = read_blocks(argv[1], &n); if (!blocks) { fprintf(stderr, "Failed to read unicode blocks file.\n"); return 2; } FILE *f = fopen(argv[2], "wb"); if (!f) { perror("fopen"); return 3; } write_blocks(f, blocks, n); free(blocks); fclose(f); return 0; } fntsample-release-5.4/src/read_blocks.c000066400000000000000000000050371410154453100201770ustar00rootroot00000000000000/* Copyright © Євгеній Мещеряков * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 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 the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include "unicode_blocks.h" #include #include #include struct unicode_block *read_blocks(const char *file_name, int *n) { int nalloc = 256; struct unicode_block *blocks = calloc(nalloc, sizeof(struct unicode_block)); *n = 0; FILE *input_file = fopen(file_name, "r"); if (!input_file) { perror("fopen"); exit(7); } char *line = NULL; size_t len = 0; ssize_t nread; while ((nread = getline(&line, &len, input_file)) != -1) { unsigned long block_start, block_end; char block_name[256]; if (nread >= (ssize_t)sizeof(block_name)) continue; int matched = sscanf(line, "%lx..%lx; %[^\r\n]", &block_start, &block_end, block_name); if (matched == 3) { struct unicode_block *b = blocks + *n; b->start = block_start; b->end = block_end; b->name = strdup(block_name); if (b->name == NULL) { perror("strdup"); exit(8); } *n += 1; if (*n >= nalloc) { int new_nalloc = nalloc + 256; struct unicode_block *new_blocks = realloc(blocks, new_nalloc * sizeof(struct unicode_block)); if (new_blocks == NULL) { perror("realloc"); exit(9); } memset(new_blocks + nalloc, 0, (new_nalloc - nalloc) * sizeof(struct unicode_block)); nalloc = new_nalloc; blocks = new_blocks; } } } free(line); if (*n == 0) { free(blocks); return NULL; } else if (*n < nalloc) { blocks = realloc(blocks, *n * sizeof(struct unicode_block)); } return blocks; } fntsample-release-5.4/src/static_unicode_blocks.h000066400000000000000000000003751410154453100222660ustar00rootroot00000000000000/* * This file is in public domain * Author: Ievgenii Meshcheriakov */ #ifndef STATIC_UNICODE_BLOCKS_H #define STATIC_UNICODE_BLOCKS_H #include "unicode_blocks.h" extern const struct unicode_block static_unicode_blocks[]; #endif fntsample-release-5.4/src/unicode_blocks.h000066400000000000000000000005121410154453100207100ustar00rootroot00000000000000/* * This file is in public domain * Author: Ievgenii Meshcheriakov */ #ifndef UNICODE_BLOCKS_H #define UNICODE_BLOCKS_H #include struct unicode_block { unsigned long start; unsigned long end; const char *name; }; struct unicode_block *read_blocks(const char *file_name, int *n); #endif