1#![doc(
2 html_logo_url = "https://raw.githubusercontent.com/maps4print/azul/master/assets/images/azul_logo_full_min.svg.png",
3 html_favicon_url = "https://raw.githubusercontent.com/maps4print/azul/master/assets/images/favicon.ico"
4)]
5#![allow(warnings)]
6
7#[macro_use]
10extern crate alloc;
11extern crate core;
12
13pub mod font_traits;
14#[cfg(feature = "image_decoding")]
15pub mod image;
16#[cfg(feature = "text_layout")]
17pub mod managers;
18#[cfg(feature = "text_layout")]
19pub mod solver3;
20
21#[cfg(feature = "strfmt")]
23pub mod fmt;
24#[cfg(feature = "strfmt")]
25pub use fmt::{FmtArg, FmtArgVec, FmtArgVecDestructor, FmtValue, fmt_string};
26
27#[cfg(feature = "widgets")]
29pub mod widgets;
30
31#[cfg(feature = "extra")]
33pub mod desktop;
34#[cfg(feature = "extra")]
35pub mod extra;
36
37#[cfg(feature = "icu")]
39pub mod icu;
40#[cfg(feature = "icu")]
41pub use icu::{
42 DateTimeFieldSet, FormatLength, IcuDate, IcuDateTime, IcuError,
43 IcuLocalizer, IcuLocalizerHandle, IcuResult, IcuStringVec, IcuTime,
44 LayoutCallbackInfoIcuExt, ListType, PluralCategory,
45};
46
47#[cfg(feature = "fluent")]
49pub mod fluent;
50#[cfg(feature = "fluent")]
51pub use fluent::{
52 check_fluent_syntax, check_fluent_syntax_bytes, create_fluent_zip,
53 create_fluent_zip_from_strings, export_to_zip, FluentError,
54 FluentLanguageInfo, FluentLanguageInfoVec,
55 FluentLocalizerHandle, FluentResult, FluentSyntaxCheckResult,
56 FluentSyntaxError, FluentZipLoadResult, LayoutCallbackInfoFluentExt,
57};
58
59#[cfg(feature = "http")]
61pub mod url;
62#[cfg(feature = "http")]
63pub use url::{Url, UrlParseError, ResultUrlUrlParseError};
64
65pub mod file;
67pub use file::{
68 dir_create, dir_create_all, dir_list, dir_delete, dir_delete_all,
69 file_copy, path_exists, file_metadata, file_read, file_delete, file_rename, file_write,
70 path_is_dir, path_is_file, path_join, temp_dir,
71 DirEntry, DirEntryVec, DirEntryVecDestructor, DirEntryVecDestructorType,
72 FileError, FileErrorKind, FileMetadata, FilePath, OptionFilePath,
73};
74
75#[cfg(feature = "http")]
77pub mod http;
78#[cfg(feature = "http")]
79pub use http::{
80 download_bytes, download_bytes_with_config, http_get,
81 http_get_with_config, is_url_reachable, HttpError, HttpHeader,
82 HttpRequestConfig, HttpResponse, HttpResponseTooLargeError, HttpResult,
83 HttpStatusError,
84};
85
86#[cfg(feature = "json")]
88pub mod json;
89#[cfg(feature = "json")]
90pub use json::{
91 json_parse, json_parse_bytes, json_stringify, json_stringify_pretty,
92 Json, JsonInternal, JsonKeyValue, JsonKeyValueVec, JsonKeyValueVecDestructor, JsonKeyValueVecDestructorType,
93 JsonParseError, JsonType, JsonVec,
94 ResultJsonJsonParseError, OptionJson, OptionJsonVec, OptionJsonKeyValueVec,
95};
96
97#[cfg(feature = "zip_support")]
99pub mod zip;
100#[cfg(feature = "zip_support")]
101pub use zip::{
102 zip_create, zip_create_from_files, zip_extract_all, zip_list_contents,
103 ZipFile, ZipFileEntry, ZipFileEntryVec, ZipPathEntry, ZipPathEntryVec,
104 ZipReadConfig, ZipWriteConfig, ZipReadError, ZipWriteError,
105};
106
107pub mod icon;
109pub use icon::{
110 default_icon_resolver,
112 ImageIconData, FontIconData,
114 create_default_icon_provider,
116 register_material_icons,
117 register_embedded_material_icons,
118};
119pub use azul_core::icon::{
121 IconProviderHandle, IconResolverCallbackType,
122 resolve_icons_in_styled_dom, OptionIconProviderHandle,
123};
124
125#[cfg(feature = "text_layout")]
126pub mod callbacks;
127#[cfg(feature = "cpurender")]
128pub mod cpurender;
129#[cfg(feature = "text_layout")]
130pub mod default_actions;
131#[cfg(feature = "text_layout")]
132pub mod event_determination;
133#[cfg(feature = "text_layout")]
134pub mod font;
135#[cfg(feature = "text_layout")]
137pub use allsorts::subset::CmapTarget;
138#[cfg(feature = "text_layout")]
139pub use font::parsed::{
140 FontParseWarning, FontParseWarningSeverity, FontType, OwnedGlyph, ParsedFont, PdfFontMetrics,
141 SubsetFont,
142};
143#[cfg(feature = "text_layout_hyphenation")]
145pub use hyphenation;
146pub mod fragmentation;
147#[cfg(feature = "text_layout")]
148pub mod hit_test;
149pub mod paged;
150#[cfg(feature = "text_layout")]
151pub mod text3;
152#[cfg(feature = "text_layout")]
153pub mod thread;
154#[cfg(feature = "text_layout")]
155pub mod timer;
156#[cfg(feature = "text_layout")]
157pub mod scroll_timer;
158#[cfg(feature = "text_layout")]
159pub mod window;
160#[cfg(feature = "text_layout")]
161pub mod window_state;
162#[cfg(feature = "xml")]
163pub mod xml;
164
165pub use fragmentation::{
167 BoxBreakBehavior, BreakDecision, FragmentationDefaults, FragmentationLayoutContext,
168 KeepTogetherPriority, PageCounter, PageFragment, PageMargins, PageNumberStyle, PageSlot,
169 PageSlotContent, PageSlotPosition, PageTemplate,
170};
171#[cfg(feature = "text_layout")]
172pub use hit_test::{CursorTypeHitTest, FullHitTest};
173pub use paged::FragmentationState;
174#[cfg(feature = "text_layout")]
175pub use solver3::cache::LayoutCache as Solver3LayoutCache;
176#[cfg(feature = "text_layout")]
177pub use solver3::display_list::DisplayList as DisplayList3;
178#[cfg(feature = "text_layout")]
179pub use solver3::layout_document;
180#[cfg(feature = "text_layout")]
181pub use solver3::paged_layout::layout_document_paged;
182#[cfg(feature = "text_layout")]
183pub use solver3::{LayoutContext, LayoutError, Result as LayoutResult3};
184#[cfg(feature = "text_layout")]
185pub use text3::cache::{FontManager, LayoutCache as TextLayoutCache};
186#[cfg(feature = "text_layout")]
187pub use window::{CursorBlinkTimerAction, LayoutWindow, ScrollbarDragState};
188#[cfg(feature = "text_layout")]
189pub use managers::text_input::{PendingTextEdit, OptionPendingTextEdit};
190
191#[cfg(feature = "text_layout")]
194pub fn parse_font_fn(
195 source: azul_core::resources::LoadedFontSource,
196) -> Option<azul_css::props::basic::FontRef> {
197 use core::ffi::c_void;
198
199 use crate::font::parsed::ParsedFont;
200
201 fn parsed_font_destructor(ptr: *mut c_void) {
202 unsafe {
203 let _ = Box::from_raw(ptr as *mut ParsedFont);
204 }
205 }
206
207 ParsedFont::from_bytes(
208 source.data.as_ref(),
209 source.index as usize,
210 &mut Vec::new(), )
212 .map(|parsed_font| parsed_font_to_font_ref(parsed_font))
213}
214
215#[cfg(feature = "text_layout")]
216pub fn parsed_font_to_font_ref(
217 parsed_font: crate::font::parsed::ParsedFont,
218) -> azul_css::props::basic::FontRef {
219 use core::ffi::c_void;
220
221 extern "C" fn parsed_font_destructor(ptr: *mut c_void) {
222 unsafe {
223 let _ = Box::from_raw(ptr as *mut crate::font::parsed::ParsedFont);
224 }
225 }
226
227 let boxed = Box::new(parsed_font);
228 let raw_ptr = Box::into_raw(boxed) as *const c_void;
229 azul_css::props::basic::FontRef::new(raw_ptr, parsed_font_destructor)
230}
231
232#[cfg(feature = "text_layout")]
233pub fn font_ref_to_parsed_font(
234 font_ref: &azul_css::props::basic::FontRef,
235) -> &crate::font::parsed::ParsedFont {
236 unsafe { &*(font_ref.parsed as *const crate::font::parsed::ParsedFont) }
237}