| 1 |
/* File: draw_line_breaker.h; Copyright and License: see below */ |
| 2 |
|
| 3 |
#ifndef DRAW_LINE_BREAKER_H |
| 4 |
#define DRAW_LINE_BREAKER_H |
| 5 |
|
| 6 |
/* public file for the doxygen documentation: */ |
| 7 |
/*! |
| 8 |
* \file |
| 9 |
* \brief Inserts zero-width spaces (U+200B) at possible line break positions. |
| 10 |
* |
| 11 |
* This allows the pango library to break lines at more suitable positions |
| 12 |
*/ |
| 13 |
|
| 14 |
#include "utf8stringbuf/utf8stringbuf.h" |
| 15 |
#include "utf8stringbuf/utf8stringview.h" |
| 16 |
#include "utf8stream/utf8stream_writer.h" |
| 17 |
#include <stdbool.h> |
| 18 |
|
| 19 |
/*! |
| 20 |
* \brief attributes of the line breaker |
| 21 |
*/ |
| 22 |
struct draw_line_breaker_struct { |
| 23 |
int dummy; /*!< empty structs are not allowed */ |
| 24 |
}; |
| 25 |
|
| 26 |
typedef struct draw_line_breaker_struct draw_line_breaker_t; |
| 27 |
|
| 28 |
/*! |
| 29 |
* \brief initializes the draw_line_breaker_t |
| 30 |
* |
| 31 |
* \param this_ pointer to own object attributes |
| 32 |
*/ |
| 33 |
static inline void draw_line_breaker_init( draw_line_breaker_t *this_ ); |
| 34 |
|
| 35 |
/*! |
| 36 |
* \brief destroys the draw_line_breaker_t |
| 37 |
* |
| 38 |
* \param this_ pointer to own object attributes |
| 39 |
*/ |
| 40 |
static inline void draw_line_breaker_destroy( draw_line_breaker_t *this_ ); |
| 41 |
|
| 42 |
/*! |
| 43 |
* \brief inserts zero-width spaces (U+200B) at possible line break positions. |
| 44 |
* |
| 45 |
* \param this_ pointer to own object attributes |
| 46 |
* \param in_text label, title or description that shall be processed |
| 47 |
* \param out_text stream where the result shall be written to |
| 48 |
* \return U8ERROR_NONE in case of success |
| 49 |
*/ |
| 50 |
static inline u8_error_t draw_line_breaker_append ( const draw_line_breaker_t *this_, |
| 51 |
const utf8stringview_t *in_text, |
| 52 |
utf8stream_writer_t *out_text |
| 53 |
); |
| 54 |
|
| 55 |
#include "draw_line_breaker.inl" |
| 56 |
|
| 57 |
#endif /* DRAW_LINE_BREAKER_H */ |
| 58 |
|
| 59 |
|
| 60 |
/* |
| 61 |
Copyright 2024-2026 Andreas Warnke |
| 62 |
|
| 63 |
Licensed under the Apache License, Version 2.0 (the "License"); |
| 64 |
you may not use this file except in compliance with the License. |
| 65 |
You may obtain a copy of the License at |
| 66 |
|
| 67 |
http://www.apache.org/licenses/LICENSE-2.0 |
| 68 |
|
| 69 |
Unless required by applicable law or agreed to in writing, software |
| 70 |
distributed under the License is distributed on an "AS IS" BASIS, |
| 71 |
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 72 |
See the License for the specific language governing permissions and |
| 73 |
limitations under the License. |
| 74 |
*/ |