Skip to content

Commit 2352c47

Browse files
committed
Fix CI
1 parent ce7308e commit 2352c47

File tree

12 files changed

+38
-80
lines changed

12 files changed

+38
-80
lines changed

src/date.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -200,10 +200,7 @@ impl DateTime {
200200

201201
#[cfg(not(target_arch = "wasm32"))]
202202
pub fn unix_timestamp(&self) -> i64 {
203-
use time::{
204-
Date as TimeDate, Month as TimeMonth, OffsetDateTime as TimeOffsetDateTime,
205-
PrimitiveDateTime, Time as TimeTime,
206-
};
203+
use time::{Date as TimeDate, Month as TimeMonth, PrimitiveDateTime, Time as TimeTime};
207204

208205
let month = match self.date.month {
209206
1 => TimeMonth::January,

src/deserialize.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use serde_derive::{Deserialize, Serialize};
1515
use crate::{
1616
cmap::ToUnicodeCMap,
1717
conformance::PdfConformance,
18-
date::{parse_pdf_date, Date, Offset, OffsetDateTime, Time, UtcOffset},
18+
date::{parse_pdf_date, OffsetDateTime},
1919
BuiltinFont, BuiltinOrExternalFontId, Color, DictItem, ExtendedGraphicsState,
2020
ExtendedGraphicsStateId, ExtendedGraphicsStateMap, FontId, LayerInternalId, Line,
2121
LineDashPattern, LinePoint, LinkAnnotation, Op, PageAnnotId, PageAnnotMap, PaintMode,
@@ -82,6 +82,7 @@ struct InitialPdf {
8282
objs_to_search_for_resources: Vec<(Object, Option<usize>)>,
8383
page_refs: Vec<(u32, u16)>,
8484
document_info: PdfDocumentInfo,
85+
#[allow(dead_code)]
8586
link_annots: Vec<LinkAnnotation>,
8687
}
8788

@@ -226,7 +227,7 @@ fn parse_pdf_from_bytes_end(
226227
objs_to_search_for_resources,
227228
page_refs,
228229
document_info,
229-
link_annots,
230+
link_annots: _, // TODO
230231
} = initial_pdf;
231232

232233
for (i, page_ref) in page_refs.into_iter().enumerate() {
@@ -1288,7 +1289,7 @@ pub fn parse_op(
12881289
op: &lopdf::content::Operation,
12891290
state: &mut PageState,
12901291
fonts: &BTreeMap<BuiltinOrExternalFontId, ParsedOrBuiltinFont>,
1291-
xobjects: &BTreeMap<XObjectId, XObject>,
1292+
_xobjects: &BTreeMap<XObjectId, XObject>,
12921293
warnings: &mut Vec<PdfWarnMsg>,
12931294
) -> Result<Vec<Op>, String> {
12941295
use crate::units::Pt;
@@ -3518,7 +3519,7 @@ mod parsefont {
35183519
/// Process font data (extract, decompress, parse) and handle ToUnicode CMap
35193520
fn process_font_data(
35203521
doc: &Document,
3521-
font_dict: &Dictionary,
3522+
_font_dict: &Dictionary,
35223523
font_descriptor: &Dictionary,
35233524
font_id: &FontId,
35243525
warnings: &mut Vec<PdfWarnMsg>,
@@ -3559,7 +3560,7 @@ mod parsefont {
35593560
fn get_font_data(
35603561
doc: &Document,
35613562
font_file_ref: &Object,
3562-
warnings: &mut Vec<PdfWarnMsg>,
3563+
_warnings: &mut Vec<PdfWarnMsg>,
35633564
) -> Option<Vec<u8>> {
35643565
// Get font stream
35653566
let font_stream = match font_file_ref {
@@ -3581,7 +3582,7 @@ mod parsefont {
35813582
/// Process a standard font (Type1, TrueType, etc.)
35823583
fn process_standard_font(
35833584
font_dict: &Dictionary,
3584-
font_id: &FontId,
3585+
_font_id: &FontId,
35853586
warnings: &mut Vec<PdfWarnMsg>,
35863587
page_num: usize,
35873588
) -> Option<ParsedOrBuiltinFont> {

src/font.rs

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -812,11 +812,6 @@ pub struct GlyphOutline {
812812
pub operations: Vec<GlyphOutlineOperation>,
813813
}
814814

815-
#[derive(Debug, Clone, PartialEq, PartialOrd)]
816-
struct GlyphOutlineBuilder {
817-
operations: Vec<GlyphOutlineOperation>,
818-
}
819-
820815
/*
821816
impl ttf_parser::OutlineBuilder for GlyphOutlineBuilder {
822817
fn move_to(&mut self, x: f32, y: f32) { self.operations.push(GlyphOutlineOperation::MoveTo(OutlineMoveTo { x, y })); }
@@ -2111,36 +2106,4 @@ mod azul_convert {
21112106
PdfOp::ClosePath => AzulOp::ClosePath,
21122107
}
21132108
}
2114-
2115-
/// Convert from azul_layout GlyphOutlineOperation to printpdf GlyphOutlineOperation
2116-
fn from_azul_glyph_outline_operation(
2117-
op: &azul_layout::text::shaping::GlyphOutlineOperation,
2118-
) -> crate::font::GlyphOutlineOperation {
2119-
use azul_layout::text::shaping::GlyphOutlineOperation as AzulOp;
2120-
2121-
use crate::font::{
2122-
GlyphOutlineOperation as PdfOp, OutlineCubicTo, OutlineLineTo, OutlineMoveTo,
2123-
OutlineQuadTo,
2124-
};
2125-
2126-
match op {
2127-
AzulOp::MoveTo(m) => PdfOp::MoveTo(OutlineMoveTo { x: m.x, y: m.y }),
2128-
AzulOp::LineTo(l) => PdfOp::LineTo(OutlineLineTo { x: l.x, y: l.y }),
2129-
AzulOp::QuadraticCurveTo(q) => PdfOp::QuadraticCurveTo(OutlineQuadTo {
2130-
ctrl_1_x: q.ctrl_1_x,
2131-
ctrl_1_y: q.ctrl_1_y,
2132-
end_x: q.end_x,
2133-
end_y: q.end_y,
2134-
}),
2135-
AzulOp::CubicCurveTo(c) => PdfOp::CubicCurveTo(OutlineCubicTo {
2136-
ctrl_1_x: c.ctrl_1_x,
2137-
ctrl_1_y: c.ctrl_1_y,
2138-
ctrl_2_x: c.ctrl_2_x,
2139-
ctrl_2_y: c.ctrl_2_y,
2140-
end_x: c.end_x,
2141-
end_y: c.end_y,
2142-
}),
2143-
AzulOp::ClosePath => PdfOp::ClosePath,
2144-
}
2145-
}
21462109
}

src/html.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ pub(crate) fn html_to_document_inner(
152152
images: &BTreeMap<String, Base64OrRaw>,
153153
fonts: &BTreeMap<String, Base64OrRaw>,
154154
options: &GeneratePdfOptions,
155-
warnings: &mut Vec<PdfWarnMsg>,
155+
_warnings: &mut Vec<PdfWarnMsg>,
156156
) -> Result<(String, PdfDocument, crate::XmlRenderOptions), String> {
157157
// Transform HTML to XML with extracted configuration
158158
let (transformed_xml, config) = crate::html::process_html_for_rendering(html);
@@ -560,7 +560,7 @@ fn displaylist_handle_rect_paginated(
560560
}
561561

562562
// The rest of the function is similar to the original, but uses the paginated rect
563-
let border_radius = get_border_radius(layout_result, html_node, original_node_id, styled_node);
563+
let _border_radius = get_border_radius(layout_result, html_node, original_node_id, styled_node);
564564
let background_content =
565565
get_background_content(layout_result, html_node, original_node_id, styled_node);
566566
let opt_border = get_opt_border(layout_result, html_node, original_node_id, styled_node);
@@ -601,7 +601,7 @@ fn displaylist_handle_rect_paginated(
601601
}
602602

603603
if let Some(border) = opt_border.as_ref() {
604-
let (color_top, color_right, color_bottom, color_left) = (
604+
let (color_top, _color_right, _color_bottom, _color_left) = (
605605
border
606606
.colors
607607
.top
@@ -624,7 +624,8 @@ fn displaylist_handle_rect_paginated(
624624
.unwrap_or_default(),
625625
);
626626

627-
let (width_top, width_right, width_bottom, width_left) = (
627+
// TODO! proper layout of rectangles!
628+
let (width_top, _width_right, _width_bottom, _width_left) = (
628629
border
629630
.widths
630631
.top
@@ -1007,8 +1008,11 @@ fn get_border_radius(
10071008
#[derive(Debug)]
10081009
struct LayoutRectContentBackground {
10091010
content: azul_core::display_list::RectBackground,
1011+
#[allow(dead_code)]
10101012
size: Option<azul_css::StyleBackgroundSize>,
1013+
#[allow(dead_code)]
10111014
offset: Option<azul_css::StyleBackgroundPosition>,
1015+
#[allow(dead_code)]
10121016
repeat: Option<azul_css::StyleBackgroundRepeat>,
10131017
}
10141018

@@ -1171,6 +1175,7 @@ fn get_text_node(
11711175
struct LayoutRectContentBorder {
11721176
widths: StyleBorderWidths,
11731177
colors: StyleBorderColors,
1178+
#[allow(dead_code)]
11741179
styles: StyleBorderStyles,
11751180
}
11761181

src/image.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ impl RawImageFormat {
202202
}
203203
}
204204

205+
#[allow(unused)]
205206
#[cfg(feature = "html")]
206207
fn from_internal(f: &azul_core::app_resources::RawImageFormat) -> Self {
207208
use azul_core::app_resources::RawImageFormat;
@@ -1778,6 +1779,7 @@ fn flate_encode(data: &[u8]) -> Option<Vec<u8>> {
17781779
}
17791780

17801781
// LZW encoding
1782+
#[allow(dead_code)]
17811783
fn lzw_encode(data: &[u8]) -> Option<Vec<u8>> {
17821784
use weezl::{encode::Encoder, BitOrder};
17831785
// Create encoder with MSB bit order (standard for PDF) and 8-bit code size
@@ -1786,6 +1788,7 @@ fn lzw_encode(data: &[u8]) -> Option<Vec<u8>> {
17861788
}
17871789

17881790
// Simple Run Length Encoding implementation
1791+
#[allow(dead_code)]
17891792
fn rle_encode(data: &[u8]) -> Option<Vec<u8>> {
17901793
let mut result = Vec::with_capacity(data.len());
17911794
let mut i = 0;
@@ -1967,6 +1970,7 @@ fn rgba_to_rgb(data: Vec<u8>) -> (Vec<u8>, Vec<u8>) {
19671970
(rgb, alpha)
19681971
}
19691972

1973+
#[allow(dead_code)]
19701974
fn rgba_to_rgb16(data: Vec<u16>) -> (Vec<u16>, Vec<u16>) {
19711975
let mut rgb = Vec::with_capacity(data.len() / 4 * 3);
19721976
let mut alpha = Vec::with_capacity(data.len() / 4);
@@ -1980,6 +1984,7 @@ fn rgba_to_rgb16(data: Vec<u16>) -> (Vec<u16>, Vec<u16>) {
19801984
(rgb, alpha)
19811985
}
19821986

1987+
#[allow(dead_code)]
19831988
fn rgba_to_rgbf32(data: Vec<f32>) -> (Vec<f32>, Vec<f32>) {
19841989
let mut rgb = Vec::with_capacity(data.len() / 4 * 3);
19851990
let mut alpha = Vec::with_capacity(data.len() / 4);

src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ impl PdfDocument {
249249
/// Looks up a text and shapes it without coordinate transformation.
250250
///
251251
/// Only returns `None` on an invalid `FontId`.
252+
#[cfg(feature = "text_layout")]
252253
pub fn shape_text(
253254
&self,
254255
text: &str,
@@ -453,6 +454,7 @@ pub struct PdfResources {
453454
// Add methods to PdfResources
454455
impl PdfResources {
455456
/// Shape text using a font from the document's resources
457+
#[cfg(feature = "text_layout")]
456458
pub fn shape_text(
457459
&self,
458460
text: &str,

src/ops.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ impl PdfPage {
109109
///
110110
/// # Returns
111111
/// A vector of text chunks extracted from text sections
112-
pub fn extract_text(&self, resources: &PdfResources) -> Vec<String> {
112+
pub fn extract_text(&self, _resources: &PdfResources) -> Vec<String> {
113113
let mut text_chunks = Vec::new();
114114
let mut current_chunk = String::new();
115115
let mut in_text_section = false;
@@ -166,13 +166,13 @@ impl PdfPage {
166166
}
167167
}
168168
Op::WriteCodepoints { font: _, cp } if in_text_section => {
169-
for (_, ch) in cp {
169+
for (_, _ch) in cp {
170170
// current_chunk.push(*ch);
171171
}
172172
// current_chunk.push(' ');
173173
}
174174
Op::WriteCodepointsWithKerning { font: _, cpk } if in_text_section => {
175-
for (_, _, ch) in cpk {
175+
for (_, _, _ch) in cpk {
176176
// current_chunk.push(*ch);
177177
}
178178
// current_chunk.push(' ');

src/render.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -962,18 +962,16 @@ fn transform_point(
962962

963963
// Apply CTM first
964964
let ctm_array = ctm.as_array();
965-
let final_x = ctm_array[0] * tx + ctm_array[2] * ty + ctm_array[4];
966-
let final_y = ctm_array[1] * tx + ctm_array[3] * ty + ctm_array[5];
965+
tx = ctm_array[0] * tx + ctm_array[2] * ty + ctm_array[4];
966+
ty = ctm_array[1] * tx + ctm_array[3] * ty + ctm_array[5];
967967

968968
// Apply text matrix
969969
let tm_array = text_matrix.as_array();
970-
let new_x = tm_array[0] * tx + tm_array[2] * ty + tm_array[4];
971-
let new_y = tm_array[1] * tx + tm_array[3] * ty + tm_array[5];
972-
tx = new_x;
973-
ty = new_y;
970+
tx = tm_array[0] * tx + tm_array[2] * ty + tm_array[4];
971+
ty = tm_array[1] * tx + tm_array[3] * ty + tm_array[5];
974972

975973
// Convert to SVG coordinates (flip Y)
976-
(final_x, page_height - final_y)
974+
(tx, page_height - ty)
977975
}
978976

979977
// Gets combined transform string for SVG elements

src/serialize.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,7 @@ pub(crate) fn translate_operations(
637637
matrix.as_array().iter().copied().map(Real).collect(),
638638
));
639639
}
640-
Op::LinkAnnotation { link } => {
640+
Op::LinkAnnotation { link: _ } => {
641641
// TODO!
642642
}
643643
Op::UseXobject { id, transform } => {

src/shape.rs

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,7 @@
44
//! allowing for complex text layout with precise positioning, line breaks,
55
//! and text flow around "holes" (like images or other non-text content).
66
7-
use std::collections::BTreeMap;
8-
9-
use allsorts_subset_browser::cff::Font;
10-
use azul_core::{
11-
callbacks::InlineText,
12-
ui_solver::ResolvedTextLayoutOptions,
13-
window::{LogicalPosition, LogicalRect, LogicalSize},
14-
};
15-
use azul_css::{LayoutSize, StyleTextAlign};
16-
use azul_layout::text::layout::{
17-
position_words, shape_words, split_text_into_words, word_positions_to_inline_text_layout,
18-
};
19-
20-
use crate::{FontId, Op, ParsedFont, PdfDocument, PdfResources, Point, Pt, Rect, TextItem};
7+
use crate::{FontId, Op, Point, Pt, Rect, TextItem};
218

229
/// Represents a "hole" in the text layout where text won't flow
2310
#[derive(Debug, Clone)]
@@ -148,9 +135,10 @@ pub struct ShapedText {
148135
/// A vector of PDF operations
149136
#[allow(non_snake_case)]
150137
impl ShapedText {
138+
#[cfg(feature = "text_layout")]
151139
pub(crate) fn from_inline_text(
152140
font_id: &FontId,
153-
inline_text: &InlineText,
141+
inline_text: &azul_core::callbacks::InlineText,
154142
options: &TextShapingOptions,
155143
) -> Self {
156144
let mut shaped_text = ShapedText {

src/utils.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ fn u8_to_char(input: u8) -> char {
9797
(b'A' + input) as char
9898
}
9999

100+
#[allow(dead_code)]
100101
pub(crate) fn compress(bytes: &[u8]) -> Vec<u8> {
101102
use std::io::prelude::*;
102103

tests/integration.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ use printpdf::{
66
wasm::structs::{
77
document_to_bytes, resources_for_page, DocumentToBytesInput, ResourcesForPageInput,
88
},
9-
BuiltinFont, Color, GeneratePdfOptions, Line, LinePoint, Mm, Op, PaintMode, PdfDocument,
10-
PdfPage, PdfParseOptions, PdfResources, PdfSaveOptions, PdfToSvgOptions, Point, Polygon,
11-
PolygonRing, Pt, Rgb, TextItem, WindingOrder, XObjectId, XObjectTransform,
9+
GeneratePdfOptions, Mm, Op, PdfDocument, PdfPage, PdfSaveOptions, XObjectId, XObjectTransform,
1210
};
1311

1412
#[test]

0 commit comments

Comments
 (0)