MPLABĀ® Harmony Graphics Suite  GFX v3.13.0
Legato API Documentation
legato_stringutils.h
Go to the documentation of this file.
1 /*******************************************************************************
2 * Copyright (C) 2020 Microchip Technology Inc. and its subsidiaries.
3 *
4 * Subject to your compliance with these terms, you may use Microchip software
5 * and any derivatives exclusively with Microchip products. It is your
6 * responsibility to comply with third party license terms applicable to your
7 * use of third party software (including open source software) that may
8 * accompany Microchip software.
9 *
10 * THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
11 * EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED
12 * WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A
13 * PARTICULAR PURPOSE.
14 *
15 * IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
16 * INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
17 * WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS
18 * BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE
19 * FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN
20 * ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY,
21 * THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
22 *******************************************************************************/
23 
24 /*******************************************************************************
25  Module for Microchip Graphics Library - Legato User Interface Library
26 
27  Company:
28  Microchip Technology Inc.
29 
30  File Name:
31  legato_stringutils.h
32 
33  Summary:
34 
35 
36  Description:
37  This module implements various string utility functions.
38 *******************************************************************************/
45 #ifndef LE_STRINGUTILS_H
46 #define LE_STRINGUTILS_H
47 
49 
50 // *****************************************************************************
67 uint32_t leStringUtils_FromCStr(const char* str,
68  leChar* buf,
69  uint32_t size);
70 
71 // *****************************************************************************
88 uint32_t leStringUtils_ToCStr(const leChar* str,
89  uint32_t strSize,
90  char* buf,
91  uint32_t bufSize);
92 
93 // *****************************************************************************
109  uint32_t size,
110  const leFont* font,
111  leRect* rect);
112 
113 // *****************************************************************************
129 leResult leStringUtils_GetRectCStr(const char* str,
130  const leFont* font,
131  leRect* rect);
132 
133 // *****************************************************************************
147 uint32_t leStringUtils_GetLineCount(const leChar* str,
148  uint32_t size);
149 
150 // *****************************************************************************
161 uint32_t leStringUtils_GetLineCountCStr(const char* str);
162 
163 // *****************************************************************************
182  uint32_t size,
183  uint32_t line,
184  uint32_t* start,
185  uint32_t* end);
186 
198  uint32_t line,
199  uint32_t* start,
200  uint32_t* end);
215  uint32_t size,
216  const leFont* font,
217  uint32_t line,
218  leRect* rect);
219 
234  const leFont* font,
235  uint32_t line,
236  leRect* rect);
237 
249  uint32_t size,
250  const leFont* font,
251  uint32_t charIdx,
252  leRect* rect);
253 
265  const leFont* font,
266  uint32_t charIdx,
267  leRect* rect);
268 
279 leResult leStringUtils_GetCharIndexAtPoint(const leChar* str,
280  uint32_t size,
281  const leFont* font,
282  const lePoint pt,
283  uint32_t* charIdx);
284 
294 leResult leStringUtils_GetCharIndexAtPointCStr(const char* str,
295  const leFont* font,
296  const lePoint pt,
297  uint32_t* charIdx);
298 
310 leResult leDecodeCodePoint(uint32_t encoding,
311  uint8_t* data,
312  uint32_t max,
313  uint32_t* codePoint,
314  uint32_t* offset);
315 
327 leResult leStringUtils_KerningRect(const leRasterFont* fnt,
328  leRect* rect);
329 
330 #endif /* LE_STRINGUTILS_H */
leResult leStringUtils_GetCharRectCStr(const char *str, const leFont *font, uint32_t charIdx, leRect *rect)
Gets a glyph bounding rectangle for a C-style string.
Definition: legato_stringutils.c:439
uint32_t leStringUtils_FromCStr(const char *str, leChar *buf, uint32_t size)
Convert c-style string to leChar.
Definition: legato_stringutils.c:36
uint32_t leStringUtils_ToCStr(const leChar *str, uint32_t strSize, char *buf, uint32_t bufSize)
Convert leChar buffer to C-style string.
Definition: legato_stringutils.c:58
leResult leStringUtils_GetRectCStr(const char *str, const leFont *font, leRect *rect)
Gets the bounding rectangle for a C-style string.
Definition: legato_stringutils.c:128
This struct represents a font object.
Definition: legato_font.h:156
leResult
This enum represents function call results.
Definition: legato_common.h:123
This struct represents a rectangle.
Definition: legato_common.h:394
uint32_t leStringUtils_GetLineCountCStr(const char *str)
Get line count for a C-style string.
Definition: legato_stringutils.c:194
leResult leStringUtils_GetLineIndicesCStr(const char *str, uint32_t line, uint32_t *start, uint32_t *end)
Gets the line indices for a C-style string.
Definition: legato_stringutils.c:262
leResult leStringUtils_GetLineIndices(const leChar *str, uint32_t size, uint32_t line, uint32_t *start, uint32_t *end)
Get line indices for a leChar style string.
Definition: legato_stringutils.c:221
leResult leStringUtils_GetLineRect(const leChar *str, uint32_t size, const leFont *font, uint32_t line, leRect *rect)
Gets the line bounding rectangle for a leChar style string.
Definition: legato_stringutils.c:305
leResult leStringUtils_GetLineRectCStr(const char *str, const leFont *font, uint32_t line, leRect *rect)
Gets the line bounding rectangle for a C-style string.
Definition: legato_stringutils.c:347
This struct represents a rasterized font object.
Definition: legato_font.h:188
leResult leStringUtils_GetCharRect(const leChar *str, uint32_t size, const leFont *font, uint32_t charIdx, leRect *rect)
Gets a glyph bounding rectangle for a leChar style string.
Definition: legato_stringutils.c:393
This structure represents a integer Cartesian point.
Definition: legato_common.h:346
uint32_t leStringUtils_GetLineCount(const leChar *str, uint32_t size)
Get line count for a leChar style string.
Definition: legato_stringutils.c:172
uint16_t leChar
This typedef represents Legato character.
Definition: legato_common.h:414
leResult leStringUtils_GetRect(const leChar *str, uint32_t size, const leFont *font, leRect *rect)
Get bounding rectangle for a leChar style string.
Definition: legato_stringutils.c:86
Fixed string functions and definitions.