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 window;
158#[cfg(feature = "text_layout")]
159pub mod window_state;
160#[cfg(feature = "xml")]
161pub mod xml;
162
163pub use fragmentation::{
165 BoxBreakBehavior, BreakDecision, FragmentationDefaults, FragmentationLayoutContext,
166 KeepTogetherPriority, PageCounter, PageFragment, PageMargins, PageNumberStyle, PageSlot,
167 PageSlotContent, PageSlotPosition, PageTemplate,
168};
169#[cfg(feature = "text_layout")]
170pub use hit_test::{CursorTypeHitTest, FullHitTest};
171pub use paged::FragmentationState;
172#[cfg(feature = "text_layout")]
173pub use solver3::cache::LayoutCache as Solver3LayoutCache;
174#[cfg(feature = "text_layout")]
175pub use solver3::display_list::DisplayList as DisplayList3;
176#[cfg(feature = "text_layout")]
177pub use solver3::layout_document;
178#[cfg(feature = "text_layout")]
179pub use solver3::paged_layout::layout_document_paged;
180#[cfg(feature = "text_layout")]
181pub use solver3::{LayoutContext, LayoutError, Result as LayoutResult3};
182#[cfg(feature = "text_layout")]
183pub use text3::cache::{FontManager, LayoutCache as TextLayoutCache};
184#[cfg(feature = "text_layout")]
185pub use window::{CursorBlinkTimerAction, LayoutWindow, ScrollbarDragState};
186#[cfg(feature = "text_layout")]
187pub use managers::text_input::{PendingTextEdit, OptionPendingTextEdit};
188
189#[cfg(feature = "text_layout")]
192pub fn parse_font_fn(
193 source: azul_core::resources::LoadedFontSource,
194) -> Option<azul_css::props::basic::FontRef> {
195 use core::ffi::c_void;
196
197 use crate::font::parsed::ParsedFont;
198
199 fn parsed_font_destructor(ptr: *mut c_void) {
200 unsafe {
201 let _ = Box::from_raw(ptr as *mut ParsedFont);
202 }
203 }
204
205 ParsedFont::from_bytes(
206 source.data.as_ref(),
207 source.index as usize,
208 &mut Vec::new(), )
210 .map(|parsed_font| parsed_font_to_font_ref(parsed_font))
211}
212
213#[cfg(feature = "text_layout")]
214pub fn parsed_font_to_font_ref(
215 parsed_font: crate::font::parsed::ParsedFont,
216) -> azul_css::props::basic::FontRef {
217 use core::ffi::c_void;
218
219 extern "C" fn parsed_font_destructor(ptr: *mut c_void) {
220 unsafe {
221 let _ = Box::from_raw(ptr as *mut crate::font::parsed::ParsedFont);
222 }
223 }
224
225 let boxed = Box::new(parsed_font);
226 let raw_ptr = Box::into_raw(boxed) as *const c_void;
227 azul_css::props::basic::FontRef::new(raw_ptr, parsed_font_destructor)
228}
229
230#[cfg(feature = "text_layout")]
231pub fn font_ref_to_parsed_font(
232 font_ref: &azul_css::props::basic::FontRef,
233) -> &crate::font::parsed::ParsedFont {
234 unsafe { &*(font_ref.parsed as *const crate::font::parsed::ParsedFont) }
235}