brst-binding-ruby 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG.md +23 -0
- data/CMakeLists.txt +95 -0
- data/LICENSE +31 -0
- data/README.md +173 -0
- data/lib/brst/binding/ruby/asian.rb +46 -0
- data/lib/brst/binding/ruby/base.rb +50 -0
- data/lib/brst/binding/ruby/date.rb +42 -0
- data/lib/brst/binding/ruby/destination.rb +46 -0
- data/lib/brst/binding/ruby/doc_compression.rb +39 -0
- data/lib/brst/binding/ruby/doc_embedded_file.rb +39 -0
- data/lib/brst/binding/ruby/doc_encoder.rb +41 -0
- data/lib/brst/binding/ruby/doc_encoding_utf.rb +39 -0
- data/lib/brst/binding/ruby/doc_ext_gstate.rb +39 -0
- data/lib/brst/binding/ruby/doc_font.rb +43 -0
- data/lib/brst/binding/ruby/doc_image_jpeg.rb +40 -0
- data/lib/brst/binding/ruby/doc_image_png.rb +41 -0
- data/lib/brst/binding/ruby/doc_image_tiff.rb +41 -0
- data/lib/brst/binding/ruby/doc_info.rb +40 -0
- data/lib/brst/binding/ruby/doc_matrix.rb +46 -0
- data/lib/brst/binding/ruby/doc_output_intent.rb +40 -0
- data/lib/brst/binding/ruby/doc_page.rb +48 -0
- data/lib/brst/binding/ruby/doc_page_pattern.rb +46 -0
- data/lib/brst/binding/ruby/doc_pattern.rb +40 -0
- data/lib/brst/binding/ruby/doc_pdfa.rb +41 -0
- data/lib/brst/binding/ruby/doc_save.rb +40 -0
- data/lib/brst/binding/ruby/doc_security.rb +41 -0
- data/lib/brst/binding/ruby/doc_viewer.rb +41 -0
- data/lib/brst/binding/ruby/doc_xobject.rb +39 -0
- data/lib/brst/binding/ruby/error.rb +43 -0
- data/lib/brst/binding/ruby/ext_gstate.rb +41 -0
- data/lib/brst/binding/ruby/font.rb +40 -0
- data/lib/brst/binding/ruby/geometry.rb +93 -0
- data/lib/brst/binding/ruby/image.rb +45 -0
- data/lib/brst/binding/ruby/library.rb +46 -0
- data/lib/brst/binding/ruby/page_routines.rb +56 -0
- data/lib/brst/binding/ruby/page_sizes.rb +38 -0
- data/lib/brst/binding/ruby/page_xobject.rb +40 -0
- data/lib/brst/binding/ruby/stream_geometry.rb +81 -0
- data/lib/brst/binding/ruby/stream_text.rb +48 -0
- data/lib/brst/binding/ruby/text.rb +67 -0
- data/lib/brst/binding/ruby/types.rb +622 -0
- data/lib/brst/binding/ruby/unicode_glyph.rb +40 -0
- data/lib/brst/binding/ruby/version.rb +7 -0
- data/lib/brst/binding/ruby/xobject.rb +39 -0
- data/lib/brst/binding/ruby.rb +30 -0
- data/lib/brst-binding-ruby.rb +5 -0
- metadata +139 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 54c4fa065230ed0b5d146ceb3f19af099fb7805a213eec93422e6e3c46fcf181
|
|
4
|
+
data.tar.gz: f9f4a583a5219c3f9cedf77341c4e5198eb53b726745474c4fbfa2f0b1dd3566
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 671ec68d5dbe28eeb03bd5030df24f42bc6c518ec108b792973b8f660516300451dd32690d172ff76cd9fcdacf0cf7b626b915cca4305300effbfc1e5ed5532f
|
|
7
|
+
data.tar.gz: e63a282508e61837fdd628ce71275e1a8e5a242e61f383c7cd941234de4e4137664e3e7b4279c9dfee627556a99d175251217ae22349aeb9b2e5c44ea5298027
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [0.1.0] - 2026-11-21
|
|
4
|
+
|
|
5
|
+
Initial experimental release.
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
- Low-level FFI bindings auto-generated from libBeresta's canonical
|
|
9
|
+
S-expression definitions (`gen/data/*.lsp`), generated from libBeresta 1.0.1.
|
|
10
|
+
- S-expression parser and Ruby FFI renderer in `generator/`.
|
|
11
|
+
- Smoke tests that generate PDFs, run in CI on macOS 15 and Ubuntu 24.04.
|
|
12
|
+
- mandatory baseline: README.md + CMakeLists.txt at repository root
|
|
13
|
+
(per libBeresta org-wide `brst-binding-<lang>` family convention).
|
|
14
|
+
- Release workflow that publishes to rubygems.org through Trusted Publishing
|
|
15
|
+
when a `v<version>` tag is pushed.
|
|
16
|
+
|
|
17
|
+
### Known limitations
|
|
18
|
+
- Low-level surface only. An idiomatic high-level API is planned as a
|
|
19
|
+
separate gem.
|
|
20
|
+
- libBeresta is not bundled. A `libbrst` shared library must be built and
|
|
21
|
+
installed separately (see README).
|
|
22
|
+
|
|
23
|
+
[0.1.0]: https://github.com/libBeresta/brst-binding-ruby/releases/tag/v0.1.0
|
data/CMakeLists.txt
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# brst-binding-ruby — mandatory baseline build entry point
|
|
2
|
+
#
|
|
3
|
+
# This CMakeLists.txt fulfils the libBeresta org-wide baseline for
|
|
4
|
+
# `brst-binding-<lang>` repositories (README + CMakeLists.txt). It exists to
|
|
5
|
+
# build the libBeresta shared library so that the Ruby FFI bindings can load
|
|
6
|
+
# it at runtime.
|
|
7
|
+
#
|
|
8
|
+
# Two modes are supported:
|
|
9
|
+
#
|
|
10
|
+
# 1. Vendored source mode:
|
|
11
|
+
# Drop libBeresta source into ext/libBeresta/ (e.g. via git submodule or
|
|
12
|
+
# tarball) and build from this directory:
|
|
13
|
+
# cmake -S . -B build
|
|
14
|
+
# cmake --build build
|
|
15
|
+
#
|
|
16
|
+
# 2. External source mode (development convenience):
|
|
17
|
+
# Pass -DLIBBRST_SOURCE_DIR=/path/to/libBeresta clone:
|
|
18
|
+
# cmake -S . -B build -DLIBBRST_SOURCE_DIR=$HOME/src/libBeresta
|
|
19
|
+
# cmake --build build
|
|
20
|
+
#
|
|
21
|
+
# The resulting shared library (libbrst.dylib / libbrst.so) is copied into
|
|
22
|
+
# ext/libBeresta/lib/ where the Ruby loader looks for it.
|
|
23
|
+
|
|
24
|
+
cmake_minimum_required(VERSION 3.16)
|
|
25
|
+
project(brst_binding_ruby NONE)
|
|
26
|
+
|
|
27
|
+
set(_default_libbrst_src "${CMAKE_CURRENT_LIST_DIR}/ext/libBeresta")
|
|
28
|
+
set(LIBBRST_SOURCE_DIR "${_default_libbrst_src}" CACHE PATH
|
|
29
|
+
"Path to libBeresta source tree to build (defaults to ext/libBeresta)")
|
|
30
|
+
|
|
31
|
+
if(NOT EXISTS "${LIBBRST_SOURCE_DIR}/CMakeLists.txt")
|
|
32
|
+
message(WARNING
|
|
33
|
+
"libBeresta source not found at ${LIBBRST_SOURCE_DIR}.\n"
|
|
34
|
+
"Either:\n"
|
|
35
|
+
" - Place libBeresta source in ext/libBeresta/ (e.g. git submodule), or\n"
|
|
36
|
+
" - Pass -DLIBBRST_SOURCE_DIR=/path/to/libBeresta\n"
|
|
37
|
+
"Skipping libBeresta build target.")
|
|
38
|
+
return()
|
|
39
|
+
endif()
|
|
40
|
+
|
|
41
|
+
enable_language(C)
|
|
42
|
+
|
|
43
|
+
set(LIBBRST_SHARED_LIB ON CACHE BOOL "" FORCE)
|
|
44
|
+
set(LIBBRST_EXAMPLES OFF CACHE BOOL "" FORCE)
|
|
45
|
+
set(LIBBRST_TESTS OFF CACHE BOOL "" FORCE)
|
|
46
|
+
|
|
47
|
+
add_subdirectory("${LIBBRST_SOURCE_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/libBeresta-build")
|
|
48
|
+
|
|
49
|
+
set(_outdir "${CMAKE_CURRENT_LIST_DIR}/ext/libBeresta/lib")
|
|
50
|
+
file(MAKE_DIRECTORY "${_outdir}")
|
|
51
|
+
|
|
52
|
+
add_custom_target(brst_binding_ruby_stage ALL
|
|
53
|
+
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
|
54
|
+
$<TARGET_FILE:brst>
|
|
55
|
+
"${_outdir}/libbrst${CMAKE_SHARED_LIBRARY_SUFFIX}"
|
|
56
|
+
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
|
57
|
+
$<TARGET_FILE:brst>
|
|
58
|
+
"${_outdir}/$<TARGET_FILE_NAME:brst>"
|
|
59
|
+
DEPENDS brst
|
|
60
|
+
COMMENT "Staging libbrst shared library into ext/libBeresta/lib/")
|
|
61
|
+
|
|
62
|
+
# ---------------------------------------------------------------------------
|
|
63
|
+
# Mandatory libBeresta org-wide CMake targets
|
|
64
|
+
#
|
|
65
|
+
# Per dmitrys99's guidance (libBeresta/libBeresta#19), every
|
|
66
|
+
# brst-binding-<lang> repository exposes three standard targets so that
|
|
67
|
+
# cross-language CI/CD pipelines can drive each binding uniformly:
|
|
68
|
+
#
|
|
69
|
+
# - binding: regenerate the FFI bindings from libBeresta/gen/data/*.lsp
|
|
70
|
+
# - check: run the binding's test suite
|
|
71
|
+
# - bundle: produce the language-native distribution archive
|
|
72
|
+
#
|
|
73
|
+
# For Ruby these shell out to ruby / bundle / gem respectively.
|
|
74
|
+
# ---------------------------------------------------------------------------
|
|
75
|
+
|
|
76
|
+
set(_gen_data_dir "${LIBBRST_SOURCE_DIR}/gen/data")
|
|
77
|
+
set(_binding_out_dir "${CMAKE_CURRENT_LIST_DIR}/lib/brst/binding/ruby")
|
|
78
|
+
|
|
79
|
+
add_custom_target(binding
|
|
80
|
+
COMMAND ruby
|
|
81
|
+
"${CMAKE_CURRENT_LIST_DIR}/generator/bin/brst-binding-ruby-gen"
|
|
82
|
+
--data-dir "${_gen_data_dir}"
|
|
83
|
+
--out-dir "${_binding_out_dir}"
|
|
84
|
+
WORKING_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}"
|
|
85
|
+
COMMENT "Regenerating FFI bindings from ${_gen_data_dir}")
|
|
86
|
+
|
|
87
|
+
add_custom_target(check
|
|
88
|
+
COMMAND bundle exec rspec
|
|
89
|
+
WORKING_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}"
|
|
90
|
+
COMMENT "Running rspec to verify the bindings")
|
|
91
|
+
|
|
92
|
+
add_custom_target(bundle
|
|
93
|
+
COMMAND gem build brst-binding-ruby.gemspec
|
|
94
|
+
WORKING_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}"
|
|
95
|
+
COMMENT "Building brst-binding-ruby .gem archive")
|
data/LICENSE
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
brst-binding-ruby — Ruby FFI bindings for libBeresta
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Kenta Ishizaki and contributors
|
|
4
|
+
|
|
5
|
+
This software is provided 'as-is', without any express or implied
|
|
6
|
+
warranty. In no event will the authors be held liable for any damages
|
|
7
|
+
arising from the use of this software.
|
|
8
|
+
|
|
9
|
+
Permission is granted to anyone to use this software for any purpose,
|
|
10
|
+
including commercial applications, and to alter it and redistribute it
|
|
11
|
+
freely, subject to the following restrictions:
|
|
12
|
+
|
|
13
|
+
1. The origin of this software must not be misrepresented; you must not
|
|
14
|
+
claim that you wrote the original software. If you use this software
|
|
15
|
+
in a product, an acknowledgment in the product documentation would be
|
|
16
|
+
appreciated but is not required.
|
|
17
|
+
|
|
18
|
+
2. Altered source versions must be plainly marked as such, and must not be
|
|
19
|
+
misrepresented as being the original software.
|
|
20
|
+
|
|
21
|
+
3. This notice may not be removed or altered from any source distribution.
|
|
22
|
+
|
|
23
|
+
----------------------------------------------------------------------
|
|
24
|
+
|
|
25
|
+
This gem provides bindings to libBeresta (https://github.com/libBeresta/libBeresta),
|
|
26
|
+
which is itself distributed under the zlib/libpng license. libBeresta is
|
|
27
|
+
originally a fork of libHaru (https://github.com/libharu/libharu), also under
|
|
28
|
+
the zlib/libpng license. Original libHaru copyright belongs to Takeshi Kanno
|
|
29
|
+
and contributors; libBeresta copyright belongs to Dmitry Solomennikov and
|
|
30
|
+
contributors. Bindings here are generated from libBeresta's canonical
|
|
31
|
+
S-expression definitions (gen/data/*.lsp).
|
data/README.md
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
# brst-binding-ruby
|
|
2
|
+
|
|
3
|
+
[](https://github.com/libBeresta/brst-binding-ruby/actions/workflows/ci.yml)
|
|
4
|
+
|
|
5
|
+
**Experimental, low-level Ruby FFI bindings for [libBeresta][libBeresta]**, a
|
|
6
|
+
free, cross-platform PDF generation C library forked from [libHaru][libHaru].
|
|
7
|
+
|
|
8
|
+
This is the Ruby member of the libBeresta org's `brst-binding-<lang>` family of
|
|
9
|
+
language bindings. Bindings are auto-generated from libBeresta's canonical
|
|
10
|
+
S-expression definitions in [`gen/data/*.lsp`][gen-data], so they stay faithful
|
|
11
|
+
to the upstream API.
|
|
12
|
+
|
|
13
|
+
## Status: v0.1.0 — experimental
|
|
14
|
+
|
|
15
|
+
- Auto-generated low-level FFI surface from `gen/data/*.lsp`. This release is
|
|
16
|
+
generated from libBeresta 1.0.1.
|
|
17
|
+
- Tested in CI on macOS 15 and Ubuntu 24.04 with Ruby 3.2 – 3.4.
|
|
18
|
+
- An idiomatic, higher-level Ruby API is **not** part of this gem; that is
|
|
19
|
+
planned as a separate gem on top of these low-level bindings.
|
|
20
|
+
- libBeresta itself is **not** bundled. The gem loads a `libbrst` shared
|
|
21
|
+
library that you build and install separately (see below).
|
|
22
|
+
|
|
23
|
+
## Mandatory baseline
|
|
24
|
+
|
|
25
|
+
Per the libBeresta org-wide convention for `brst-binding-<lang>` repositories,
|
|
26
|
+
this repository ships:
|
|
27
|
+
|
|
28
|
+
- `README.md` (this file)
|
|
29
|
+
- `CMakeLists.txt` — entry point that builds libBeresta (vendored or external)
|
|
30
|
+
into a shared library that the Ruby loader can `dlopen`.
|
|
31
|
+
|
|
32
|
+
Everything else (gemspec, `lib/`, `spec/`, generator, CI) follows Ruby
|
|
33
|
+
community conventions on top of that baseline.
|
|
34
|
+
|
|
35
|
+
## Quick start
|
|
36
|
+
|
|
37
|
+
### Install
|
|
38
|
+
|
|
39
|
+
```sh
|
|
40
|
+
gem install brst-binding-ruby
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
The gem does not ship libBeresta. Build libBeresta 1.0.1 as a shared library
|
|
44
|
+
and install it where the system loader can find it (`/usr/local` by default):
|
|
45
|
+
|
|
46
|
+
```sh
|
|
47
|
+
git clone --depth=1 --branch 1.0.1 https://github.com/libBeresta/libBeresta.git
|
|
48
|
+
cmake -S libBeresta -B libBeresta/build -DCMAKE_BUILD_TYPE=Release \
|
|
49
|
+
-DLIBBRST_TESTS=OFF
|
|
50
|
+
cmake --build libBeresta/build -j
|
|
51
|
+
sudo cmake --install libBeresta/build
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Alternatively, point the gem at an existing build by setting
|
|
55
|
+
`BRST_BINDING_RUBY_LIB=/path/to/libbrst.{dylib,so}` (see
|
|
56
|
+
[Library resolution](#library-resolution)).
|
|
57
|
+
|
|
58
|
+
### Development checkout
|
|
59
|
+
|
|
60
|
+
```sh
|
|
61
|
+
git clone https://github.com/libBeresta/brst-binding-ruby.git
|
|
62
|
+
cd brst-binding-ruby
|
|
63
|
+
git clone --depth=1 https://github.com/libBeresta/libBeresta.git ../libBeresta
|
|
64
|
+
# Native deps — macOS:
|
|
65
|
+
brew install cmake libpng
|
|
66
|
+
# Native deps — Ubuntu:
|
|
67
|
+
# sudo apt-get install -y cmake libpng-dev zlib1g-dev pkg-config build-essential
|
|
68
|
+
bundle install
|
|
69
|
+
cmake -S . -B build -DLIBBRST_SOURCE_DIR=$(cd ../libBeresta && pwd) \
|
|
70
|
+
-DCMAKE_BUILD_TYPE=Release
|
|
71
|
+
cmake --build build --config Release -j
|
|
72
|
+
bundle exec rspec
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Hello PDF in Ruby
|
|
76
|
+
|
|
77
|
+
```ruby
|
|
78
|
+
require "brst/binding/ruby"
|
|
79
|
+
|
|
80
|
+
include Brst::Binding::Ruby
|
|
81
|
+
|
|
82
|
+
pdf = Base.BRST_Doc_New(nil, nil)
|
|
83
|
+
page = DocPage.BRST_Doc_Page_Add(pdf)
|
|
84
|
+
PageRoutines.BRST_Page_SetSize(page, :A4, :PAGE_ORIENTATION_PORTRAIT)
|
|
85
|
+
|
|
86
|
+
font = DocFont.BRST_Doc_Font(pdf, "Helvetica", nil)
|
|
87
|
+
Text.BRST_Page_BeginText(page)
|
|
88
|
+
Text.BRST_Page_SetFontAndSize(page, font, 20.0)
|
|
89
|
+
Text.BRST_Page_MoveTextPos(page, 50.0, 750.0)
|
|
90
|
+
Text.BRST_Page_ShowText(page, "Hello, Beresta from Ruby!")
|
|
91
|
+
Text.BRST_Page_EndText(page)
|
|
92
|
+
|
|
93
|
+
DocSave.BRST_Doc_SaveToFile(pdf, "hello.pdf")
|
|
94
|
+
Base.BRST_Doc_Free(pdf)
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## How it's built
|
|
98
|
+
|
|
99
|
+
```
|
|
100
|
+
libBeresta/gen/data/*.lsp (S-expression — Source of Truth)
|
|
101
|
+
│
|
|
102
|
+
▼
|
|
103
|
+
generator/bin/brst-binding-ruby-gen (Ruby S-exp parser + FFI renderer)
|
|
104
|
+
│
|
|
105
|
+
▼
|
|
106
|
+
lib/brst/binding/ruby/types.rb (consolidated typedefs / enums / structs)
|
|
107
|
+
lib/brst/binding/ruby/<file>.rb (one FFI module per .lsp file)
|
|
108
|
+
│
|
|
109
|
+
▼
|
|
110
|
+
ext/libBeresta/lib/libbrst.{dylib,so} (cmake-built native library)
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
The generator parses S-expressions directly. The `gen/json/*.json` files are
|
|
114
|
+
themselves auto-generated from the same `.lsp` files and are useful for
|
|
115
|
+
structural cross-checking but are **not** the source of truth.
|
|
116
|
+
|
|
117
|
+
To regenerate after pulling new `.lsp` data:
|
|
118
|
+
|
|
119
|
+
```sh
|
|
120
|
+
bundle exec rake generate
|
|
121
|
+
# or:
|
|
122
|
+
ruby generator/bin/brst-binding-ruby-gen \
|
|
123
|
+
--data-dir ../libBeresta/gen/data \
|
|
124
|
+
--out-dir lib/brst/binding/ruby
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
CI guards against generator drift: the workflow regenerates on every push and
|
|
128
|
+
fails if the committed bindings differ from the generator's output.
|
|
129
|
+
|
|
130
|
+
## Library resolution
|
|
131
|
+
|
|
132
|
+
At load time, `Brst::Binding::Ruby::Library` searches in this order:
|
|
133
|
+
|
|
134
|
+
1. `ENV["BRST_BINDING_RUBY_LIB"]` — explicit override (path or library name).
|
|
135
|
+
2. `ext/libBeresta/lib/libbrst.{dylib,so}` — vendored build output.
|
|
136
|
+
3. `ext/libBeresta/build/src/libbrst.{dylib,so}` — in-tree cmake build output.
|
|
137
|
+
4. `build/libBeresta-build/src/libbrst.{dylib,so}` — alternative in-tree.
|
|
138
|
+
5. Falls back to `libbrst` / `brst` via the system loader.
|
|
139
|
+
|
|
140
|
+
If a function or type referenced by upstream `.lsp` data is absent from the
|
|
141
|
+
loaded native library (e.g. caption / C-symbol drift, or a feature compiled
|
|
142
|
+
out of this build), the corresponding `attach_function` is recorded in
|
|
143
|
+
`<Module>::MISSING_SYMBOLS` and the rest of the gem still loads.
|
|
144
|
+
|
|
145
|
+
## Releasing
|
|
146
|
+
|
|
147
|
+
Releases are published to rubygems.org by
|
|
148
|
+
[`.github/workflows/release.yml`](.github/workflows/release.yml) through
|
|
149
|
+
[Trusted Publishing][trusted-publishing]; no API token is stored in the
|
|
150
|
+
repository. To cut a release, bump `VERSION`, give the version a dated entry in
|
|
151
|
+
`CHANGELOG.md`, merge to `main`, then push a matching `v<version>` tag. The
|
|
152
|
+
workflow refuses to publish when the tag, `VERSION` and `CHANGELOG.md` disagree.
|
|
153
|
+
|
|
154
|
+
## Acknowledgements
|
|
155
|
+
|
|
156
|
+
- [@dmitrys99][dmitrys99] — libBeresta maintainer, designer of the S-expression
|
|
157
|
+
source-of-truth pipeline, and gracious mentor for this binding effort. The
|
|
158
|
+
`brst-binding-<lang>` org structure and the `README + CMakeLists.txt`
|
|
159
|
+
baseline come from his guidance.
|
|
160
|
+
- [libHaru][libHaru] — original PDF C library this work ultimately descends
|
|
161
|
+
from. Original copyright belongs to Takeshi Kanno and contributors.
|
|
162
|
+
- Russian-language docs in the upstream `.lsp` data are preserved verbatim in
|
|
163
|
+
the parsed tree but not surfaced in v0.1.0 bindings.
|
|
164
|
+
|
|
165
|
+
## License
|
|
166
|
+
|
|
167
|
+
[zlib/libpng License](LICENSE) — same as libBeresta and libHaru.
|
|
168
|
+
|
|
169
|
+
[libBeresta]: https://github.com/libBeresta/libBeresta
|
|
170
|
+
[libHaru]: https://github.com/libharu/libharu
|
|
171
|
+
[gen-data]: https://github.com/libBeresta/libBeresta/tree/master/gen/data
|
|
172
|
+
[dmitrys99]: https://github.com/dmitrys99
|
|
173
|
+
[trusted-publishing]: https://guides.rubygems.org/trusted-publishing/
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
#
|
|
3
|
+
# AUTO-GENERATED by brst-binding-ruby's generator (generator/bin/brst-binding-ruby-gen).
|
|
4
|
+
# Source of truth: libBeresta gen/data/*.lsp (S-expression definitions).
|
|
5
|
+
# DO NOT EDIT BY HAND. Re-generate with `rake generate`.
|
|
6
|
+
|
|
7
|
+
require "ffi"
|
|
8
|
+
require_relative "library"
|
|
9
|
+
require_relative "types"
|
|
10
|
+
|
|
11
|
+
module Brst
|
|
12
|
+
module Binding
|
|
13
|
+
module Ruby
|
|
14
|
+
module Asian
|
|
15
|
+
extend FFI::Library
|
|
16
|
+
ffi_lib Brst::Binding::Ruby::Library.lib_path
|
|
17
|
+
|
|
18
|
+
Brst::Binding::Ruby::Types.apply(self)
|
|
19
|
+
|
|
20
|
+
MISSING_SYMBOLS = []
|
|
21
|
+
|
|
22
|
+
# Wraps `attach_function` so that captions whose actual C symbol
|
|
23
|
+
# is missing from the loaded libBeresta build (e.g. caption /
|
|
24
|
+
# symbol drift in upstream .lsp data, or features compiled
|
|
25
|
+
# out) — or whose declared parameter types reference a struct
|
|
26
|
+
# / enum the .lsp data never declared — don't break the entire
|
|
27
|
+
# gem load. Each miss is recorded in MISSING_SYMBOLS for
|
|
28
|
+
# diagnostic surfaces.
|
|
29
|
+
def self.safe_attach(name, args, ret)
|
|
30
|
+
attach_function(name, args, ret)
|
|
31
|
+
rescue FFI::NotFoundError, TypeError => e
|
|
32
|
+
MISSING_SYMBOLS << [name, e.message]
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
safe_attach :BRST_Doc_UseJPFonts, [:Doc], :uint32
|
|
36
|
+
safe_attach :BRST_Doc_UseKRFonts, [:Doc], :uint32
|
|
37
|
+
safe_attach :BRST_Doc_UseCNSFonts, [:Doc], :uint32
|
|
38
|
+
safe_attach :BRST_Doc_UseCNTFonts, [:Doc], :uint32
|
|
39
|
+
safe_attach :BRST_Doc_UseJPEncodings, [:Doc], :uint32
|
|
40
|
+
safe_attach :BRST_Doc_UseKREncodings, [:Doc], :uint32
|
|
41
|
+
safe_attach :BRST_Doc_UseCNSEncodings, [:Doc], :uint32
|
|
42
|
+
safe_attach :BRST_Doc_UseCNTEncodings, [:Doc], :uint32
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
#
|
|
3
|
+
# AUTO-GENERATED by brst-binding-ruby's generator (generator/bin/brst-binding-ruby-gen).
|
|
4
|
+
# Source of truth: libBeresta gen/data/*.lsp (S-expression definitions).
|
|
5
|
+
# DO NOT EDIT BY HAND. Re-generate with `rake generate`.
|
|
6
|
+
|
|
7
|
+
require "ffi"
|
|
8
|
+
require_relative "library"
|
|
9
|
+
require_relative "types"
|
|
10
|
+
|
|
11
|
+
module Brst
|
|
12
|
+
module Binding
|
|
13
|
+
module Ruby
|
|
14
|
+
module Base
|
|
15
|
+
extend FFI::Library
|
|
16
|
+
ffi_lib Brst::Binding::Ruby::Library.lib_path
|
|
17
|
+
|
|
18
|
+
Brst::Binding::Ruby::Types.apply(self)
|
|
19
|
+
|
|
20
|
+
MISSING_SYMBOLS = []
|
|
21
|
+
|
|
22
|
+
# Wraps `attach_function` so that captions whose actual C symbol
|
|
23
|
+
# is missing from the loaded libBeresta build (e.g. caption /
|
|
24
|
+
# symbol drift in upstream .lsp data, or features compiled
|
|
25
|
+
# out) — or whose declared parameter types reference a struct
|
|
26
|
+
# / enum the .lsp data never declared — don't break the entire
|
|
27
|
+
# gem load. Each miss is recorded in MISSING_SYMBOLS for
|
|
28
|
+
# diagnostic surfaces.
|
|
29
|
+
def self.safe_attach(name, args, ret)
|
|
30
|
+
attach_function(name, args, ret)
|
|
31
|
+
rescue FFI::NotFoundError, TypeError => e
|
|
32
|
+
MISSING_SYMBOLS << [name, e.message]
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
safe_attach :BRST_Doc_New_Ex, [:pointer, :pointer, :pointer, :uint32, :pointer], :Doc
|
|
36
|
+
safe_attach :BRST_Version, [], :string
|
|
37
|
+
safe_attach :BRST_Doc_New, [:pointer, :pointer], :Doc
|
|
38
|
+
safe_attach :BRST_Doc_New_Empty, [], :Doc
|
|
39
|
+
safe_attach :BRST_Doc_Initialize, [:Doc], :uint32
|
|
40
|
+
safe_attach :BRST_Doc_Destroy, [:Doc], :void
|
|
41
|
+
safe_attach :BRST_Doc_Initialized, [:Doc], :int32
|
|
42
|
+
safe_attach :BRST_Doc_Destroy_All, [:Doc], :void
|
|
43
|
+
safe_attach :BRST_Doc_MMgr, [:Doc], :MMgr
|
|
44
|
+
safe_attach :BRST_Doc_Free, [:Doc], :void
|
|
45
|
+
safe_attach :BRST_PageSize_Width, [:PageSizes, :PageOrientation], :float
|
|
46
|
+
safe_attach :BRST_PageSize_Height, [:PageSizes, :PageOrientation], :float
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
#
|
|
3
|
+
# AUTO-GENERATED by brst-binding-ruby's generator (generator/bin/brst-binding-ruby-gen).
|
|
4
|
+
# Source of truth: libBeresta gen/data/*.lsp (S-expression definitions).
|
|
5
|
+
# DO NOT EDIT BY HAND. Re-generate with `rake generate`.
|
|
6
|
+
|
|
7
|
+
require "ffi"
|
|
8
|
+
require_relative "library"
|
|
9
|
+
require_relative "types"
|
|
10
|
+
|
|
11
|
+
module Brst
|
|
12
|
+
module Binding
|
|
13
|
+
module Ruby
|
|
14
|
+
module Date
|
|
15
|
+
extend FFI::Library
|
|
16
|
+
ffi_lib Brst::Binding::Ruby::Library.lib_path
|
|
17
|
+
|
|
18
|
+
Brst::Binding::Ruby::Types.apply(self)
|
|
19
|
+
|
|
20
|
+
MISSING_SYMBOLS = []
|
|
21
|
+
|
|
22
|
+
# Wraps `attach_function` so that captions whose actual C symbol
|
|
23
|
+
# is missing from the loaded libBeresta build (e.g. caption /
|
|
24
|
+
# symbol drift in upstream .lsp data, or features compiled
|
|
25
|
+
# out) — or whose declared parameter types reference a struct
|
|
26
|
+
# / enum the .lsp data never declared — don't break the entire
|
|
27
|
+
# gem load. Each miss is recorded in MISSING_SYMBOLS for
|
|
28
|
+
# diagnostic surfaces.
|
|
29
|
+
def self.safe_attach(name, args, ret)
|
|
30
|
+
attach_function(name, args, ret)
|
|
31
|
+
rescue FFI::NotFoundError, TypeError => e
|
|
32
|
+
MISSING_SYMBOLS << [name, e.message]
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
safe_attach :BRST_Doc_Date_Now, [:Doc], :Date
|
|
36
|
+
safe_attach :BRST_Date_Part, [:Date, :Date_Parts], :int32
|
|
37
|
+
safe_attach :BRST_Date_Validate, [:Date], :uint32
|
|
38
|
+
safe_attach :BRST_Date_Free, [:Date], :void
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
#
|
|
3
|
+
# AUTO-GENERATED by brst-binding-ruby's generator (generator/bin/brst-binding-ruby-gen).
|
|
4
|
+
# Source of truth: libBeresta gen/data/*.lsp (S-expression definitions).
|
|
5
|
+
# DO NOT EDIT BY HAND. Re-generate with `rake generate`.
|
|
6
|
+
|
|
7
|
+
require "ffi"
|
|
8
|
+
require_relative "library"
|
|
9
|
+
require_relative "types"
|
|
10
|
+
|
|
11
|
+
module Brst
|
|
12
|
+
module Binding
|
|
13
|
+
module Ruby
|
|
14
|
+
module Destination
|
|
15
|
+
extend FFI::Library
|
|
16
|
+
ffi_lib Brst::Binding::Ruby::Library.lib_path
|
|
17
|
+
|
|
18
|
+
Brst::Binding::Ruby::Types.apply(self)
|
|
19
|
+
|
|
20
|
+
MISSING_SYMBOLS = []
|
|
21
|
+
|
|
22
|
+
# Wraps `attach_function` so that captions whose actual C symbol
|
|
23
|
+
# is missing from the loaded libBeresta build (e.g. caption /
|
|
24
|
+
# symbol drift in upstream .lsp data, or features compiled
|
|
25
|
+
# out) — or whose declared parameter types reference a struct
|
|
26
|
+
# / enum the .lsp data never declared — don't break the entire
|
|
27
|
+
# gem load. Each miss is recorded in MISSING_SYMBOLS for
|
|
28
|
+
# diagnostic surfaces.
|
|
29
|
+
def self.safe_attach(name, args, ret)
|
|
30
|
+
attach_function(name, args, ret)
|
|
31
|
+
rescue FFI::NotFoundError, TypeError => e
|
|
32
|
+
MISSING_SYMBOLS << [name, e.message]
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
safe_attach :BRST_Destination_SetXYZ, [:Destination, :float, :float, :float], :uint32
|
|
36
|
+
safe_attach :BRST_Destination_SetFit, [:Destination], :uint32
|
|
37
|
+
safe_attach :BRST_Destination_SetFitH, [:Destination, :float], :uint32
|
|
38
|
+
safe_attach :BRST_Destination_SetFitV, [:Destination, :float], :uint32
|
|
39
|
+
safe_attach :BRST_Destination_SetFitR, [:Destination, :float, :float, :float, :float], :uint32
|
|
40
|
+
safe_attach :BRST_Destination_SetFitB, [:Destination], :uint32
|
|
41
|
+
safe_attach :BRST_Destination_SetFitBH, [:Destination, :float], :uint32
|
|
42
|
+
safe_attach :BRST_Destination_SetFitBV, [:Destination, :float], :uint32
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
#
|
|
3
|
+
# AUTO-GENERATED by brst-binding-ruby's generator (generator/bin/brst-binding-ruby-gen).
|
|
4
|
+
# Source of truth: libBeresta gen/data/*.lsp (S-expression definitions).
|
|
5
|
+
# DO NOT EDIT BY HAND. Re-generate with `rake generate`.
|
|
6
|
+
|
|
7
|
+
require "ffi"
|
|
8
|
+
require_relative "library"
|
|
9
|
+
require_relative "types"
|
|
10
|
+
|
|
11
|
+
module Brst
|
|
12
|
+
module Binding
|
|
13
|
+
module Ruby
|
|
14
|
+
module DocCompression
|
|
15
|
+
extend FFI::Library
|
|
16
|
+
ffi_lib Brst::Binding::Ruby::Library.lib_path
|
|
17
|
+
|
|
18
|
+
Brst::Binding::Ruby::Types.apply(self)
|
|
19
|
+
|
|
20
|
+
MISSING_SYMBOLS = []
|
|
21
|
+
|
|
22
|
+
# Wraps `attach_function` so that captions whose actual C symbol
|
|
23
|
+
# is missing from the loaded libBeresta build (e.g. caption /
|
|
24
|
+
# symbol drift in upstream .lsp data, or features compiled
|
|
25
|
+
# out) — or whose declared parameter types reference a struct
|
|
26
|
+
# / enum the .lsp data never declared — don't break the entire
|
|
27
|
+
# gem load. Each miss is recorded in MISSING_SYMBOLS for
|
|
28
|
+
# diagnostic surfaces.
|
|
29
|
+
def self.safe_attach(name, args, ret)
|
|
30
|
+
attach_function(name, args, ret)
|
|
31
|
+
rescue FFI::NotFoundError, TypeError => e
|
|
32
|
+
MISSING_SYMBOLS << [name, e.message]
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
safe_attach :BRST_Doc_SetCompressionMode, [:Doc, :uint32], :uint32
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
#
|
|
3
|
+
# AUTO-GENERATED by brst-binding-ruby's generator (generator/bin/brst-binding-ruby-gen).
|
|
4
|
+
# Source of truth: libBeresta gen/data/*.lsp (S-expression definitions).
|
|
5
|
+
# DO NOT EDIT BY HAND. Re-generate with `rake generate`.
|
|
6
|
+
|
|
7
|
+
require "ffi"
|
|
8
|
+
require_relative "library"
|
|
9
|
+
require_relative "types"
|
|
10
|
+
|
|
11
|
+
module Brst
|
|
12
|
+
module Binding
|
|
13
|
+
module Ruby
|
|
14
|
+
module DocEmbeddedFile
|
|
15
|
+
extend FFI::Library
|
|
16
|
+
ffi_lib Brst::Binding::Ruby::Library.lib_path
|
|
17
|
+
|
|
18
|
+
Brst::Binding::Ruby::Types.apply(self)
|
|
19
|
+
|
|
20
|
+
MISSING_SYMBOLS = []
|
|
21
|
+
|
|
22
|
+
# Wraps `attach_function` so that captions whose actual C symbol
|
|
23
|
+
# is missing from the loaded libBeresta build (e.g. caption /
|
|
24
|
+
# symbol drift in upstream .lsp data, or features compiled
|
|
25
|
+
# out) — or whose declared parameter types reference a struct
|
|
26
|
+
# / enum the .lsp data never declared — don't break the entire
|
|
27
|
+
# gem load. Each miss is recorded in MISSING_SYMBOLS for
|
|
28
|
+
# diagnostic surfaces.
|
|
29
|
+
def self.safe_attach(name, args, ret)
|
|
30
|
+
attach_function(name, args, ret)
|
|
31
|
+
rescue FFI::NotFoundError, TypeError => e
|
|
32
|
+
MISSING_SYMBOLS << [name, e.message]
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
safe_attach :BRST_Doc_AttachFile, [:Doc, :string], :EmbeddedFile
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
#
|
|
3
|
+
# AUTO-GENERATED by brst-binding-ruby's generator (generator/bin/brst-binding-ruby-gen).
|
|
4
|
+
# Source of truth: libBeresta gen/data/*.lsp (S-expression definitions).
|
|
5
|
+
# DO NOT EDIT BY HAND. Re-generate with `rake generate`.
|
|
6
|
+
|
|
7
|
+
require "ffi"
|
|
8
|
+
require_relative "library"
|
|
9
|
+
require_relative "types"
|
|
10
|
+
|
|
11
|
+
module Brst
|
|
12
|
+
module Binding
|
|
13
|
+
module Ruby
|
|
14
|
+
module DocEncoder
|
|
15
|
+
extend FFI::Library
|
|
16
|
+
ffi_lib Brst::Binding::Ruby::Library.lib_path
|
|
17
|
+
|
|
18
|
+
Brst::Binding::Ruby::Types.apply(self)
|
|
19
|
+
|
|
20
|
+
MISSING_SYMBOLS = []
|
|
21
|
+
|
|
22
|
+
# Wraps `attach_function` so that captions whose actual C symbol
|
|
23
|
+
# is missing from the loaded libBeresta build (e.g. caption /
|
|
24
|
+
# symbol drift in upstream .lsp data, or features compiled
|
|
25
|
+
# out) — or whose declared parameter types reference a struct
|
|
26
|
+
# / enum the .lsp data never declared — don't break the entire
|
|
27
|
+
# gem load. Each miss is recorded in MISSING_SYMBOLS for
|
|
28
|
+
# diagnostic surfaces.
|
|
29
|
+
def self.safe_attach(name, args, ret)
|
|
30
|
+
attach_function(name, args, ret)
|
|
31
|
+
rescue FFI::NotFoundError, TypeError => e
|
|
32
|
+
MISSING_SYMBOLS << [name, e.message]
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
safe_attach :BRST_Doc_Encoder_SetCurrent, [:Doc, :string], :uint32
|
|
36
|
+
safe_attach :BRST_Doc_Encoder_Prepare, [:Doc, :string], :Encoder
|
|
37
|
+
safe_attach :BRST_Doc_Encoder_Current, [:Doc], :Encoder
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
#
|
|
3
|
+
# AUTO-GENERATED by brst-binding-ruby's generator (generator/bin/brst-binding-ruby-gen).
|
|
4
|
+
# Source of truth: libBeresta gen/data/*.lsp (S-expression definitions).
|
|
5
|
+
# DO NOT EDIT BY HAND. Re-generate with `rake generate`.
|
|
6
|
+
|
|
7
|
+
require "ffi"
|
|
8
|
+
require_relative "library"
|
|
9
|
+
require_relative "types"
|
|
10
|
+
|
|
11
|
+
module Brst
|
|
12
|
+
module Binding
|
|
13
|
+
module Ruby
|
|
14
|
+
module DocEncodingUtf
|
|
15
|
+
extend FFI::Library
|
|
16
|
+
ffi_lib Brst::Binding::Ruby::Library.lib_path
|
|
17
|
+
|
|
18
|
+
Brst::Binding::Ruby::Types.apply(self)
|
|
19
|
+
|
|
20
|
+
MISSING_SYMBOLS = []
|
|
21
|
+
|
|
22
|
+
# Wraps `attach_function` so that captions whose actual C symbol
|
|
23
|
+
# is missing from the loaded libBeresta build (e.g. caption /
|
|
24
|
+
# symbol drift in upstream .lsp data, or features compiled
|
|
25
|
+
# out) — or whose declared parameter types reference a struct
|
|
26
|
+
# / enum the .lsp data never declared — don't break the entire
|
|
27
|
+
# gem load. Each miss is recorded in MISSING_SYMBOLS for
|
|
28
|
+
# diagnostic surfaces.
|
|
29
|
+
def self.safe_attach(name, args, ret)
|
|
30
|
+
attach_function(name, args, ret)
|
|
31
|
+
rescue FFI::NotFoundError, TypeError => e
|
|
32
|
+
MISSING_SYMBOLS << [name, e.message]
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
safe_attach :BRST_Doc_UseUTFEncodings, [:Doc], :uint32
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|