1use crate::bidi::Direction;
2use crate::unicode::{graphemes, line_breaks, LineBreak, LineBreaks, Script};
3use core::ops::Range;
4
5#[repr(transparent)]
6#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
7pub struct FontId(u64);
8
9impl FontId {
10 pub const fn new(value: u64) -> Self {
11 Self(value)
12 }
13
14 pub const fn value(self) -> u64 {
15 self.0
16 }
17}
18
19#[repr(transparent)]
20#[derive(Clone, Copy, Debug, Default, Eq, Hash, PartialEq)]
21pub struct GlyphId(u16);
22
23impl GlyphId {
24 pub const fn new(value: u16) -> Self {
25 Self(value)
26 }
27
28 pub const fn value(self) -> u16 {
29 self.0
30 }
31}
32
33#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
34pub struct FlowPoint {
35 pub x: i32,
36 pub y: i32,
37}
38
39#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
40pub struct FontMetrics {
41 pub units_per_em: u16,
42 pub ascender: i32,
43 pub descender: i32,
44 pub line_gap: i32,
45}
46
47#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
48pub struct TextRange {
49 pub start: u32,
50 pub end: u32,
51}
52
53impl TextRange {
54 pub const fn new(start: u32, end: u32) -> Self {
55 Self { start, end }
56 }
57
58 pub const fn len(self) -> u32 {
59 self.end.saturating_sub(self.start)
60 }
61
62 pub const fn is_empty(self) -> bool {
63 self.start >= self.end
64 }
65}
66
67#[derive(Clone, Copy, Debug, Eq, PartialEq)]
68pub struct FontFeature {
69 pub tag: [u8; 4],
70 pub value: u32,
71 pub range: TextRange,
72}
73
74#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
75pub struct LineEdges(u8);
76
77impl LineEdges {
78 pub const NONE: Self = Self(0);
79 pub const START: Self = Self(1);
80 pub const END: Self = Self(2);
81 pub const BOTH: Self = Self(3);
82
83 pub const fn has_start(self) -> bool {
84 self.0 & Self::START.0 != 0
85 }
86
87 pub const fn has_end(self) -> bool {
88 self.0 & Self::END.0 != 0
89 }
90}
91
92impl FontFeature {
93 pub const fn new(tag: [u8; 4], value: u32) -> Self {
94 Self {
95 tag,
96 value,
97 range: TextRange::new(0, u32::MAX),
98 }
99 }
100
101 pub const fn with_range(mut self, range: TextRange) -> Self {
102 self.range = range;
103 self
104 }
105}
106
107pub struct ShapeRequest<'a> {
108 pub text: &'a str,
109 pub range: Range<usize>,
110 pub direction: Direction,
111 pub script: Script,
112 pub language: Option<&'a str>,
113 pub features: &'a [FontFeature],
114 pub line_edges: LineEdges,
115}
116
117impl<'a> ShapeRequest<'a> {
118 pub fn new(text: &'a str, range: Range<usize>, direction: Direction, script: Script) -> Self {
119 Self {
120 text,
121 range,
122 direction,
123 script,
124 language: None,
125 features: &[],
126 line_edges: LineEdges::NONE,
127 }
128 }
129
130 pub fn with_language(mut self, language: &'a str) -> Self {
131 self.language = Some(language);
132 self
133 }
134
135 pub fn with_features(mut self, features: &'a [FontFeature]) -> Self {
136 self.features = features;
137 self
138 }
139
140 pub fn with_line_edges(mut self, edges: LineEdges) -> Self {
141 self.line_edges = edges;
142 self
143 }
144}
145
146#[derive(Clone, Copy, Debug, Eq, PartialEq)]
147pub enum ShapeError {
148 InvalidTextRange,
149 TextTooLong,
150 InsufficientCapacity { required: usize },
151 UnsupportedScript { script: Script },
152 UnsupportedFeature { tag: [u8; 4] },
153 UnsupportedCluster { offset: usize },
154 MissingGlyph { offset: usize },
155 Source(FontAccessError),
156}
157
158#[derive(Clone, Copy, Debug, Eq, PartialEq)]
159pub enum FontAccessError {
160 Unavailable,
161 Malformed,
162 Unsupported,
163}
164
165impl From<FontAccessError> for ShapeError {
166 fn from(error: FontAccessError) -> Self {
167 Self::Source(error)
168 }
169}
170
171#[repr(C)]
172#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
173pub struct ShapedGlyph {
174 glyph_id: GlyphId,
175 flags: u16,
176 pub cluster: TextRange,
177 pub advance: FlowPoint,
178 pub offset: FlowPoint,
179}
180
181impl ShapedGlyph {
182 const UNSAFE_TO_BREAK: u16 = 1;
183
184 pub const fn new(glyph_id: GlyphId, cluster: TextRange) -> Self {
185 Self {
186 glyph_id,
187 flags: 0,
188 cluster,
189 advance: FlowPoint { x: 0, y: 0 },
190 offset: FlowPoint { x: 0, y: 0 },
191 }
192 }
193
194 pub const fn glyph_id(self) -> GlyphId {
195 self.glyph_id
196 }
197
198 pub const fn unsafe_to_break(self) -> bool {
199 self.flags & Self::UNSAFE_TO_BREAK != 0
200 }
201
202 pub fn set_unsafe_to_break(&mut self, unsafe_to_break: bool) {
203 if unsafe_to_break {
204 self.flags |= Self::UNSAFE_TO_BREAK;
205 } else {
206 self.flags &= !Self::UNSAFE_TO_BREAK;
207 }
208 }
209}
210
211pub struct ShapedRun<'a> {
212 font_id: FontId,
213 text: TextRange,
214 bidi_level: u8,
215 glyphs: &'a [ShapedGlyph],
216}
217
218impl<'a> ShapedRun<'a> {
219 pub const fn new(
220 font_id: FontId,
221 text: TextRange,
222 bidi_level: u8,
223 glyphs: &'a [ShapedGlyph],
224 ) -> Self {
225 Self {
226 font_id,
227 text,
228 bidi_level,
229 glyphs,
230 }
231 }
232
233 pub const fn font_id(&self) -> FontId {
234 self.font_id
235 }
236
237 pub const fn text(&self) -> TextRange {
238 self.text
239 }
240
241 pub const fn direction(&self) -> Direction {
242 Direction::from_level(self.bidi_level)
243 }
244
245 pub const fn bidi_level(&self) -> u8 {
246 self.bidi_level
247 }
248
249 pub const fn glyphs(&self) -> &[ShapedGlyph] {
250 self.glyphs
251 }
252
253 pub fn is_safe_break(&self, offset: u32) -> bool {
254 if offset == self.text.start || offset == self.text.end {
255 return true;
256 }
257 if offset < self.text.start || offset > self.text.end {
258 return false;
259 }
260 !self.glyphs.iter().any(|glyph| {
261 glyph.cluster.start < offset && offset < glyph.cluster.end
262 || glyph.cluster.start == offset && glyph.unsafe_to_break()
263 })
264 }
265
266 pub fn line_breaks<'text, 'run>(
267 &'run self,
268 text: &'text str,
269 ) -> Result<SafeLineBreaks<'text, 'run, 'a>, ShapeError> {
270 let start = self.text.start as usize;
271 let end = self.text.end as usize;
272 if start > end
273 || end > text.len()
274 || !text.is_char_boundary(start)
275 || !text.is_char_boundary(end)
276 {
277 return Err(ShapeError::InvalidTextRange);
278 }
279 Ok(SafeLineBreaks {
280 inner: line_breaks(&text[start..end]),
281 run: self,
282 base: self.text.start,
283 })
284 }
285
286 pub fn position_into<'output>(
287 &self,
288 origin: FlowPoint,
289 output: &'output mut [PositionedGlyph],
290 ) -> Result<PositionedRun<'output>, PositionError> {
291 if output.len() < self.glyphs.len() {
292 return Err(PositionError::InsufficientCapacity {
293 required: self.glyphs.len(),
294 });
295 }
296 let mut pen = origin;
297 for (slot, glyph) in output.iter_mut().zip(self.glyphs) {
298 *slot = PositionedGlyph {
299 glyph_id: glyph.glyph_id(),
300 cluster: glyph.cluster,
301 origin: pen,
302 advance: glyph.advance,
303 offset: glyph.offset,
304 bidi_level: self.bidi_level,
305 };
306 pen.x = pen
307 .x
308 .checked_add(glyph.advance.x)
309 .ok_or(PositionError::CoordinateOverflow)?;
310 pen.y = pen
311 .y
312 .checked_add(glyph.advance.y)
313 .ok_or(PositionError::CoordinateOverflow)?;
314 }
315 Ok(PositionedRun {
316 font_id: self.font_id,
317 text: self.text,
318 direction: self.direction(),
319 bidi_level: self.bidi_level,
320 end: pen,
321 glyphs: &output[..self.glyphs.len()],
322 })
323 }
324}
325
326pub struct SafeLineBreaks<'text, 'run, 'glyph> {
327 inner: LineBreaks<'text>,
328 run: &'run ShapedRun<'glyph>,
329 base: u32,
330}
331
332impl Iterator for SafeLineBreaks<'_, '_, '_> {
333 type Item = LineBreak;
334
335 fn next(&mut self) -> Option<Self::Item> {
336 loop {
337 let mut next = self.inner.next()?;
338 next.offset += self.base as usize;
339 if self.run.is_safe_break(next.offset as u32) {
340 return Some(next);
341 }
342 }
343 }
344}
345
346#[derive(Clone, Copy, Debug, Eq, PartialEq)]
347pub enum PositionError {
348 InsufficientCapacity { required: usize },
349 CoordinateOverflow,
350}
351
352#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
353pub struct PositionedGlyph {
354 glyph_id: GlyphId,
355 pub cluster: TextRange,
356 pub origin: FlowPoint,
357 pub advance: FlowPoint,
358 pub offset: FlowPoint,
359 pub bidi_level: u8,
360}
361
362impl PositionedGlyph {
363 pub const fn glyph_id(self) -> GlyphId {
364 self.glyph_id
365 }
366}
367
368pub struct PositionedRun<'a> {
369 font_id: FontId,
370 text: TextRange,
371 direction: Direction,
372 bidi_level: u8,
373 end: FlowPoint,
374 glyphs: &'a [PositionedGlyph],
375}
376
377impl PositionedRun<'_> {
378 pub const fn font_id(&self) -> FontId {
379 self.font_id
380 }
381
382 pub const fn text(&self) -> TextRange {
383 self.text
384 }
385
386 pub const fn direction(&self) -> Direction {
387 self.direction
388 }
389
390 pub const fn end(&self) -> FlowPoint {
391 self.end
392 }
393
394 pub const fn glyphs(&self) -> &[PositionedGlyph] {
395 self.glyphs
396 }
397
398 pub fn carets_into<'output>(
399 &self,
400 output: &'output mut [CaretStop],
401 ) -> Result<&'output [CaretStop], PositionError> {
402 let mut required = 0;
403 let mut previous = None;
404 for glyph in self.glyphs {
405 let text_offset = match self.direction {
406 Direction::LeftToRight => glyph.cluster.start,
407 Direction::RightToLeft => glyph.cluster.end,
408 };
409 if previous != Some(text_offset) {
410 required += 1;
411 previous = Some(text_offset);
412 }
413 }
414 let final_offset = match self.direction {
415 Direction::LeftToRight => self.text.end,
416 Direction::RightToLeft => self.text.start,
417 };
418 if previous != Some(final_offset) {
419 required += 1;
420 }
421 if output.len() < required {
422 return Err(PositionError::InsufficientCapacity { required });
423 }
424 let mut count = 0;
425 for glyph in self.glyphs {
426 let text_offset = match self.direction {
427 Direction::LeftToRight => glyph.cluster.start,
428 Direction::RightToLeft => glyph.cluster.end,
429 };
430 if count == 0 || output[count - 1].text_offset != text_offset {
431 output[count] = CaretStop {
432 text_offset,
433 position: glyph.origin,
434 bidi_level: self.bidi_level,
435 };
436 count += 1;
437 }
438 }
439 let text_offset = match self.direction {
440 Direction::LeftToRight => self.text.end,
441 Direction::RightToLeft => self.text.start,
442 };
443 if count == 0 || output[count - 1].text_offset != text_offset {
444 output[count] = CaretStop {
445 text_offset,
446 position: self.end,
447 bidi_level: self.bidi_level,
448 };
449 count += 1;
450 }
451 Ok(&output[..count])
452 }
453}
454
455#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
456pub struct CaretStop {
457 pub text_offset: u32,
458 pub position: FlowPoint,
459 pub bidi_level: u8,
460}
461
462pub trait Typeface {
463 fn id(&self) -> FontId;
464 fn metrics(&self) -> Result<FontMetrics, FontAccessError>;
465 fn covers(&self, grapheme: &str) -> Result<bool, FontAccessError>;
466 fn shape_into(
467 &self,
468 request: &ShapeRequest<'_>,
469 output: &mut [ShapedGlyph],
470 ) -> Result<usize, ShapeError>;
471}
472
473pub trait GlyphSource {
474 fn id(&self) -> FontId;
475 fn metrics(&self) -> Result<FontMetrics, FontAccessError>;
476 fn glyph_for(&self, character: char) -> Result<Option<GlyphId>, FontAccessError>;
477 fn glyph_advance(&self, glyph: GlyphId) -> Result<FlowPoint, FontAccessError>;
478
479 fn notdef_glyph(&self) -> Result<Option<GlyphId>, FontAccessError> {
480 Ok(Some(GlyphId::new(0)))
481 }
482
483 fn kerning(&self, _left: GlyphId, _right: GlyphId) -> Result<i32, FontAccessError> {
484 Ok(0)
485 }
486}
487
488pub struct SimpleTypeface<'a, T> {
489 source: &'a T,
490}
491
492impl<'a, T> SimpleTypeface<'a, T> {
493 pub const fn new(source: &'a T) -> Self {
494 Self { source }
495 }
496}
497
498impl<T> Typeface for SimpleTypeface<'_, T>
499where
500 T: GlyphSource,
501{
502 fn id(&self) -> FontId {
503 self.source.id()
504 }
505
506 fn metrics(&self) -> Result<FontMetrics, FontAccessError> {
507 self.source.metrics()
508 }
509
510 fn covers(&self, grapheme: &str) -> Result<bool, FontAccessError> {
511 let mut characters = grapheme.chars();
512 let Some(character) = characters.next() else {
513 return Ok(false);
514 };
515 if characters.next().is_some() {
516 return Ok(false);
517 }
518 Ok(self.source.glyph_for(character)?.is_some())
519 }
520
521 fn shape_into(
522 &self,
523 request: &ShapeRequest<'_>,
524 output: &mut [ShapedGlyph],
525 ) -> Result<usize, ShapeError> {
526 validate_request(request)?;
527 if matches!(request.script, Script::Arabic | Script::Devanagari) {
528 return Err(ShapeError::UnsupportedScript {
529 script: request.script,
530 });
531 }
532 let kern = kerning_enabled(request.features)?;
533 let text = &request.text[request.range.clone()];
534 let required = graphemes(text).count();
535 if output.len() < required {
536 return Err(ShapeError::InsufficientCapacity { required });
537 }
538
539 let mut previous: Option<(usize, GlyphId)> = None;
540 for (logical_index, cluster) in graphemes(text).enumerate() {
541 let mut characters = cluster.text.chars();
542 let character = characters.next().unwrap();
543 if characters.next().is_some() {
544 return Err(ShapeError::UnsupportedCluster {
545 offset: request.range.start + cluster.range.start,
546 });
547 }
548 let glyph_id = match self.source.glyph_for(character)? {
549 Some(glyph) => glyph,
550 None => self
551 .source
552 .notdef_glyph()?
553 .ok_or(ShapeError::MissingGlyph {
554 offset: request.range.start + cluster.range.start,
555 })?,
556 };
557 let output_index = match request.direction {
558 Direction::LeftToRight => logical_index,
559 Direction::RightToLeft => required - logical_index - 1,
560 };
561 let start = request.range.start + cluster.range.start;
562 let end = request.range.start + cluster.range.end;
563 output[output_index] = ShapedGlyph {
564 glyph_id,
565 flags: 0,
566 cluster: TextRange::new(start as u32, end as u32),
567 advance: self.source.glyph_advance(glyph_id)?,
568 offset: FlowPoint::default(),
569 };
570 if kern {
571 if let Some((previous_index, previous_glyph)) = previous {
572 output[previous_index].advance.x +=
573 self.source.kerning(previous_glyph, glyph_id)?;
574 }
575 previous = Some((output_index, glyph_id));
576 }
577 }
578 Ok(required)
579 }
580}
581
582fn validate_request(request: &ShapeRequest<'_>) -> Result<(), ShapeError> {
583 if request.range.start > request.range.end
584 || request.range.end > request.text.len()
585 || !request.text.is_char_boundary(request.range.start)
586 || !request.text.is_char_boundary(request.range.end)
587 {
588 return Err(ShapeError::InvalidTextRange);
589 }
590 if request.text.len() > u32::MAX as usize {
591 return Err(ShapeError::TextTooLong);
592 }
593 Ok(())
594}
595
596fn kerning_enabled(features: &[FontFeature]) -> Result<bool, ShapeError> {
597 let mut enabled = true;
598 for feature in features {
599 if feature.tag == *b"kern" {
600 enabled = feature.value != 0;
601 } else {
602 return Err(ShapeError::UnsupportedFeature { tag: feature.tag });
603 }
604 }
605 Ok(enabled)
606}
607
608#[cfg(test)]
609mod tests {
610 use super::*;
611 use std::prelude::v1::*;
612
613 struct MockFont;
614
615 impl GlyphSource for MockFont {
616 fn id(&self) -> FontId {
617 FontId::new(4)
618 }
619
620 fn metrics(&self) -> Result<FontMetrics, FontAccessError> {
621 Ok(FontMetrics {
622 units_per_em: 1000,
623 ascender: 800,
624 descender: -200,
625 line_gap: 0,
626 })
627 }
628
629 fn glyph_for(&self, character: char) -> Result<Option<GlyphId>, FontAccessError> {
630 Ok(character
631 .is_ascii()
632 .then_some(GlyphId::new(character as u16)))
633 }
634
635 fn glyph_advance(&self, _glyph: GlyphId) -> Result<FlowPoint, FontAccessError> {
636 Ok(FlowPoint { x: 600, y: 0 })
637 }
638
639 fn kerning(&self, left: GlyphId, right: GlyphId) -> Result<i32, FontAccessError> {
640 Ok(
641 if left.value() == b'A' as u16 && right.value() == b'V' as u16 {
642 -80
643 } else {
644 0
645 },
646 )
647 }
648 }
649
650 #[test]
651 fn shapes_into_caller_storage_with_kerning() {
652 let face = SimpleTypeface::new(&MockFont);
653 let text = "AV";
654 let mut output = [ShapedGlyph::default(); 2];
655 let count = face
656 .shape_into(
657 &ShapeRequest::new(text, 0..text.len(), Direction::LeftToRight, Script::Latin),
658 &mut output,
659 )
660 .unwrap();
661
662 assert_eq!(count, 2);
663 assert_eq!(output[0].advance.x, 520);
664 assert_eq!(output[1].advance.x, 600);
665 }
666
667 #[test]
668 fn reverses_rtl_output_without_heap_storage() {
669 let face = SimpleTypeface::new(&MockFont);
670 let text = "abc";
671 let mut output = [ShapedGlyph::default(); 3];
672 face.shape_into(
673 &ShapeRequest::new(text, 0..text.len(), Direction::RightToLeft, Script::Hebrew),
674 &mut output,
675 )
676 .unwrap();
677
678 assert_eq!(output[0].glyph_id(), GlyphId::new(b'c' as u16));
679 assert_eq!(output[2].glyph_id(), GlyphId::new(b'a' as u16));
680 }
681
682 #[test]
683 fn reports_capacity_and_unsupported_clusters() {
684 let face = SimpleTypeface::new(&MockFont);
685 let mut output = [ShapedGlyph::default(); 1];
686 let text = "ab";
687 assert_eq!(
688 face.shape_into(
689 &ShapeRequest::new(text, 0..text.len(), Direction::LeftToRight, Script::Latin,),
690 &mut output,
691 ),
692 Err(ShapeError::InsufficientCapacity { required: 2 })
693 );
694 let combined = "a\u{301}";
695 assert_eq!(
696 face.shape_into(
697 &ShapeRequest::new(
698 combined,
699 0..combined.len(),
700 Direction::LeftToRight,
701 Script::Latin,
702 ),
703 &mut output,
704 ),
705 Err(ShapeError::UnsupportedCluster { offset: 0 })
706 );
707 }
708
709 #[test]
710 fn run_rejects_breaks_inside_or_before_unsafe_clusters() {
711 let mut glyphs = [
712 ShapedGlyph::new(GlyphId::new(1), TextRange::new(0, 3)),
713 ShapedGlyph::new(GlyphId::new(2), TextRange::new(3, 4)),
714 ];
715 glyphs[1].set_unsafe_to_break(true);
716 let run = ShapedRun::new(FontId::new(4), TextRange::new(0, 4), 0, &glyphs);
717
718 assert!(run.is_safe_break(0));
719 assert!(!run.is_safe_break(1));
720 assert!(!run.is_safe_break(3));
721 assert!(run.is_safe_break(4));
722 assert!(!run.is_safe_break(5));
723 }
724
725 #[test]
726 fn run_filters_unsafe_unicode_breaks() {
727 let text = "hello world";
728 let mut glyphs = [ShapedGlyph::default(); 11];
729 for (index, glyph) in glyphs.iter_mut().enumerate() {
730 *glyph = ShapedGlyph::new(
731 GlyphId::new(index as u16),
732 TextRange::new(index as u32, index as u32 + 1),
733 );
734 }
735 glyphs[6].set_unsafe_to_break(true);
736 let run = ShapedRun::new(
737 FontId::new(4),
738 TextRange::new(0, text.len() as u32),
739 0,
740 &glyphs,
741 );
742 let breaks = run.line_breaks(text).unwrap().collect::<Vec<_>>();
743
744 assert_eq!(breaks.len(), 1);
745 assert_eq!(breaks[0].offset, text.len());
746 }
747
748 #[test]
749 fn positions_glyphs_and_emits_visual_carets() {
750 let mut glyphs = [
751 ShapedGlyph::new(GlyphId::new(1), TextRange::new(0, 1)),
752 ShapedGlyph::new(GlyphId::new(2), TextRange::new(1, 2)),
753 ];
754 glyphs[0].advance.x = 3;
755 glyphs[1].advance.x = 4;
756 let run = ShapedRun::new(FontId::new(4), TextRange::new(0, 2), 0, &glyphs);
757 let mut positioned = [PositionedGlyph::default(); 2];
758 let positioned = run
759 .position_into(FlowPoint { x: 10, y: 20 }, &mut positioned)
760 .unwrap();
761
762 assert_eq!(positioned.glyphs()[0].origin, FlowPoint { x: 10, y: 20 });
763 assert_eq!(positioned.glyphs()[1].origin, FlowPoint { x: 13, y: 20 });
764 assert_eq!(positioned.end(), FlowPoint { x: 17, y: 20 });
765
766 let mut carets = [CaretStop::default(); 3];
767 let carets = positioned.carets_into(&mut carets).unwrap();
768 assert_eq!(carets[0].text_offset, 0);
769 assert_eq!(carets[1].text_offset, 1);
770 assert_eq!(carets[2].text_offset, 2);
771 assert_eq!(carets[2].position.x, 17);
772 }
773
774 #[test]
775 fn request_carries_explicit_line_edges() {
776 let request = ShapeRequest::new("a", 0..1, Direction::LeftToRight, Script::Latin)
777 .with_line_edges(LineEdges::BOTH);
778
779 assert!(request.line_edges.has_start());
780 assert!(request.line_edges.has_end());
781 }
782
783 #[test]
784 fn uses_notdef_for_an_uncovered_scalar() {
785 let face = SimpleTypeface::new(&MockFont);
786 let text = "δΈ–";
787 let mut output = [ShapedGlyph::default(); 1];
788 let count = face
789 .shape_into(
790 &ShapeRequest::new(text, 0..text.len(), Direction::LeftToRight, Script::Han),
791 &mut output,
792 )
793 .unwrap();
794
795 assert_eq!(count, 1);
796 assert_eq!(output[0].glyph_id(), GlyphId::new(0));
797 }
798}