mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-09 23:34:20 +00:00
SheenBidi: Update bundled sources to v2.9.0
This commit is contained in:
parent
7f22db449a
commit
e8beaa4a1f
59 changed files with 4439 additions and 3432 deletions
|
|
@ -1,80 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2018 Muhammad Tayyab Akram
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef _SB_PUBLIC_CODEPOINT_H
|
||||
#define _SB_PUBLIC_CODEPOINT_H
|
||||
|
||||
#include "SBBase.h"
|
||||
#include "SBBidiType.h"
|
||||
#include "SBGeneralCategory.h"
|
||||
#include "SBScript.h"
|
||||
|
||||
/**
|
||||
* A type to represent a unicode code point.
|
||||
*/
|
||||
typedef SBUInt32 SBCodepoint;
|
||||
|
||||
/**
|
||||
* A value representing an invalid code point.
|
||||
*/
|
||||
#define SBCodepointInvalid UINT32_MAX
|
||||
|
||||
/**
|
||||
* A value representing a faulty code point, used as a replacement by the decoder.
|
||||
*/
|
||||
#define SBCodepointFaulty 0xFFFD
|
||||
|
||||
/**
|
||||
* Returns the bidirectional type of a code point.
|
||||
*
|
||||
* @param codepoint
|
||||
* The code point whose bidirectional type is returned.
|
||||
* @return
|
||||
* The bidirectional type of specified code point.
|
||||
*/
|
||||
SBBidiType SBCodepointGetBidiType(SBCodepoint codepoint);
|
||||
|
||||
/**
|
||||
* Returns the general category of a code point.
|
||||
*
|
||||
* @param codepoint
|
||||
* The code point whose general category is returned.
|
||||
* @return
|
||||
* The general category of specified code point.
|
||||
*/
|
||||
SBGeneralCategory SBCodepointGetGeneralCategory(SBCodepoint codepoint);
|
||||
|
||||
/**
|
||||
* Returns the mirror of a code point.
|
||||
*
|
||||
* @param codepoint
|
||||
* The code point whose mirror is returned.
|
||||
* @return
|
||||
* The mirror of specified code point if available, 0 otherwise.
|
||||
*/
|
||||
SBCodepoint SBCodepointGetMirror(SBCodepoint codepoint);
|
||||
|
||||
/**
|
||||
* Returns the script of a code point.
|
||||
*
|
||||
* @param codepoint
|
||||
* The code point whose script is returned.
|
||||
* @return
|
||||
* The script of specified code point.
|
||||
*/
|
||||
SBScript SBCodepointGetScript(SBCodepoint codepoint);
|
||||
|
||||
#endif
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2016-2018 Muhammad Tayyab Akram
|
||||
* Copyright (C) 2016-2025 Muhammad Tayyab Akram
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -17,10 +17,12 @@
|
|||
#ifndef _SB_PUBLIC_ALGORITHM_H
|
||||
#define _SB_PUBLIC_ALGORITHM_H
|
||||
|
||||
#include "SBBase.h"
|
||||
#include "SBBidiType.h"
|
||||
#include "SBCodepointSequence.h"
|
||||
#include "SBParagraph.h"
|
||||
#include <SheenBidi/SBBase.h>
|
||||
#include <SheenBidi/SBBidiType.h>
|
||||
#include <SheenBidi/SBCodepointSequence.h>
|
||||
#include <SheenBidi/SBParagraph.h>
|
||||
|
||||
SB_EXTERN_C_BEGIN
|
||||
|
||||
typedef struct _SBAlgorithm *SBAlgorithmRef;
|
||||
|
||||
|
|
@ -33,7 +35,7 @@ typedef struct _SBAlgorithm *SBAlgorithmRef;
|
|||
* @return
|
||||
* A reference to an algorithm object if the call was successful, NULL otherwise.
|
||||
*/
|
||||
SBAlgorithmRef SBAlgorithmCreate(const SBCodepointSequence *codepointSequence);
|
||||
SB_PUBLIC SBAlgorithmRef SBAlgorithmCreate(const SBCodepointSequence *codepointSequence);
|
||||
|
||||
/**
|
||||
* Returns a direct pointer to the bidirectional types of code units, stored in the algorithm
|
||||
|
|
@ -45,7 +47,7 @@ SBAlgorithmRef SBAlgorithmCreate(const SBCodepointSequence *codepointSequence);
|
|||
* A valid pointer to an array of SBBidiType structures, whose length will be equal to that of
|
||||
* string buffer.
|
||||
*/
|
||||
const SBBidiType *SBAlgorithmGetBidiTypesPtr(SBAlgorithmRef algorithm);
|
||||
SB_PUBLIC const SBBidiType *SBAlgorithmGetBidiTypesPtr(SBAlgorithmRef algorithm);
|
||||
|
||||
/**
|
||||
* Determines the boundary of first paragraph within the specified range.
|
||||
|
|
@ -69,7 +71,7 @@ const SBBidiType *SBAlgorithmGetBidiTypesPtr(SBAlgorithmRef algorithm);
|
|||
* On output, the length of paragraph separator. This parameter can be set to NULL if not
|
||||
* needed.
|
||||
*/
|
||||
void SBAlgorithmGetParagraphBoundary(SBAlgorithmRef algorithm,
|
||||
SB_PUBLIC void SBAlgorithmGetParagraphBoundary(SBAlgorithmRef algorithm,
|
||||
SBUInteger paragraphOffset, SBUInteger suggestedLength,
|
||||
SBUInteger *acutalLength, SBUInteger *separatorLength);
|
||||
|
||||
|
|
@ -94,7 +96,7 @@ void SBAlgorithmGetParagraphBoundary(SBAlgorithmRef algorithm,
|
|||
* @return
|
||||
* A reference to a paragraph object if the call was successful, NULL otherwise.
|
||||
*/
|
||||
SBParagraphRef SBAlgorithmCreateParagraph(SBAlgorithmRef algorithm,
|
||||
SB_PUBLIC SBParagraphRef SBAlgorithmCreateParagraph(SBAlgorithmRef algorithm,
|
||||
SBUInteger paragraphOffset, SBUInteger suggestedLength, SBLevel baseLevel);
|
||||
|
||||
/**
|
||||
|
|
@ -105,7 +107,7 @@ SBParagraphRef SBAlgorithmCreateParagraph(SBAlgorithmRef algorithm,
|
|||
* @return
|
||||
* The same algorithm object passed in as the parameter.
|
||||
*/
|
||||
SBAlgorithmRef SBAlgorithmRetain(SBAlgorithmRef algorithm);
|
||||
SB_PUBLIC SBAlgorithmRef SBAlgorithmRetain(SBAlgorithmRef algorithm);
|
||||
|
||||
/**
|
||||
* Decrements the reference count of an algorithm object. The object will be deallocated when its
|
||||
|
|
@ -114,6 +116,8 @@ SBAlgorithmRef SBAlgorithmRetain(SBAlgorithmRef algorithm);
|
|||
* @param algorithm
|
||||
* The algorithm object whose reference count will be decremented.
|
||||
*/
|
||||
void SBAlgorithmRelease(SBAlgorithmRef algorithm);
|
||||
SB_PUBLIC void SBAlgorithmRelease(SBAlgorithmRef algorithm);
|
||||
|
||||
SB_EXTERN_C_END
|
||||
|
||||
#endif
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2014-2018 Muhammad Tayyab Akram
|
||||
* Copyright (C) 2014-2025 Muhammad Tayyab Akram
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -17,9 +17,44 @@
|
|||
#ifndef _SB_PUBLIC_BASE_H
|
||||
#define _SB_PUBLIC_BASE_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define SB_EXTERN_C_BEGIN extern "C" {
|
||||
#define SB_EXTERN_C_END }
|
||||
#else
|
||||
#define SB_EXTERN_C_BEGIN
|
||||
#define SB_EXTERN_C_END
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
#if defined(SB_CONFIG_DLL_EXPORT)
|
||||
#define SB_PUBLIC __declspec(dllexport)
|
||||
#elif defined(SB_CONFIG_DLL_IMPORT)
|
||||
#define SB_PUBLIC __declspec(dllimport)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef SB_PUBLIC
|
||||
#define SB_PUBLIC
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus) && __cplusplus >= 201402L
|
||||
#define SB_DEPRECATED [[deprecated]]
|
||||
#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
|
||||
#define SB_DEPRECATED [[deprecated]]
|
||||
#elif defined(__clang__) || defined(__GNUC__)
|
||||
#define SB_DEPRECATED __attribute__((deprecated))
|
||||
#elif defined(_MSC_VER)
|
||||
#define SB_DEPRECATED __declspec(deprecated)
|
||||
#else
|
||||
#define SB_DEPRECATED
|
||||
#endif
|
||||
|
||||
SB_EXTERN_C_BEGIN
|
||||
|
||||
/**
|
||||
* A type to represent an 8-bit signed integer.
|
||||
*/
|
||||
|
|
@ -116,4 +151,6 @@ typedef SBUInt8 SBLevel;
|
|||
*/
|
||||
#define SBLevelDefaultRTL 0xFD
|
||||
|
||||
SB_EXTERN_C_END
|
||||
|
||||
#endif
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2018 Muhammad Tayyab Akram
|
||||
* Copyright (C) 2018-2025 Muhammad Tayyab Akram
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -17,7 +17,9 @@
|
|||
#ifndef _SB_PUBLIC_BIDI_TYPE_H
|
||||
#define _SB_PUBLIC_BIDI_TYPE_H
|
||||
|
||||
#include "SBBase.h"
|
||||
#include <SheenBidi/SBBase.h>
|
||||
|
||||
SB_EXTERN_C_BEGIN
|
||||
|
||||
/**
|
||||
* Constants that specify the bidirectional types of a character.
|
||||
|
|
@ -78,4 +80,6 @@ typedef SBUInt8 SBBidiType;
|
|||
*/
|
||||
#define SBBidiTypeIsFormat(t) SBUInt8InRange(t, SBBidiTypeLRI, SBBidiTypePDF)
|
||||
|
||||
SB_EXTERN_C_END
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,184 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2025 Muhammad Tayyab Akram
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef _SB_PUBLIC_CODEPOINT_H
|
||||
#define _SB_PUBLIC_CODEPOINT_H
|
||||
|
||||
#include <SheenBidi/SBBase.h>
|
||||
#include <SheenBidi/SBBidiType.h>
|
||||
#include <SheenBidi/SBGeneralCategory.h>
|
||||
#include <SheenBidi/SBScript.h>
|
||||
|
||||
SB_EXTERN_C_BEGIN
|
||||
|
||||
/**
|
||||
* A type to represent a Unicode code point.
|
||||
*/
|
||||
typedef SBUInt32 SBCodepoint;
|
||||
|
||||
/**
|
||||
* A value representing an invalid Unicode code point.
|
||||
*/
|
||||
#define SBCodepointInvalid UINT32_MAX
|
||||
|
||||
/**
|
||||
* A value representing a faulty Unicode code point.
|
||||
*
|
||||
* This value is used as a replacement for unrecognized code points during decoding.
|
||||
*/
|
||||
#define SBCodepointFaulty 0xFFFD
|
||||
|
||||
/**
|
||||
* The maximum valid Unicode code point value.
|
||||
*
|
||||
* Unicode code points are valid in the range [0x0000, 0x10FFFF].
|
||||
*/
|
||||
#define SBCodepointMax 0x10FFFF
|
||||
|
||||
/**
|
||||
* Checks if a code point is a UTF-16 surrogate.
|
||||
*
|
||||
* Surrogate code points lie within the range [0xD800, 0xDFFF] and are not valid Unicode scalar
|
||||
* values.
|
||||
*
|
||||
* @param c
|
||||
* The code point to check.
|
||||
* @return
|
||||
* `true` if the code point is a surrogate, `false` otherwise.
|
||||
*/
|
||||
#define SBCodepointIsSurrogate(c) SBUInt32InRange(c, 0xD800, 0xDFFF)
|
||||
|
||||
/**
|
||||
* Checks if a code point is a valid Unicode scalar value.
|
||||
*
|
||||
* A code point is considered valid if:
|
||||
* - It is not a surrogate (i.e., not in the range 0xD800 to 0xDFFF)
|
||||
* - It is less than or equal to SBCodepointMax (0x10FFFF).
|
||||
*
|
||||
* @param c
|
||||
* The code point to check.
|
||||
* @return
|
||||
* `true` if the code point is valid, `false` otherwise.
|
||||
*/
|
||||
#define SBCodepointIsValid(c) (!SBCodepointIsSurrogate(c) && (c) <= SBCodepointMax)
|
||||
|
||||
/**
|
||||
* Returns the bidirectional type of a Unicode code point.
|
||||
*
|
||||
* @param codepoint
|
||||
* The code point whose bidirectional type is returned.
|
||||
* @return
|
||||
* The bidirectional type of the specified code point.
|
||||
*/
|
||||
SB_PUBLIC SBBidiType SBCodepointGetBidiType(SBCodepoint codepoint);
|
||||
|
||||
/**
|
||||
* Returns the general category of a Unicode code point.
|
||||
*
|
||||
* @param codepoint
|
||||
* The code point whose general category is returned.
|
||||
* @return
|
||||
* The general category of the specified code point.
|
||||
*/
|
||||
SB_PUBLIC SBGeneralCategory SBCodepointGetGeneralCategory(SBCodepoint codepoint);
|
||||
|
||||
/**
|
||||
* Returns the mirrored code point for a given Unicode code point.
|
||||
*
|
||||
* @param codepoint
|
||||
* The code point whose mirrored counterpart is returned.
|
||||
* @return
|
||||
* The mirrored code point if available, or 0 if no mirror exists.
|
||||
*/
|
||||
SB_PUBLIC SBCodepoint SBCodepointGetMirror(SBCodepoint codepoint);
|
||||
|
||||
/**
|
||||
* Returns the script associated with a Unicode code point.
|
||||
*
|
||||
* @param codepoint
|
||||
* The code point whose script is returned.
|
||||
* @return
|
||||
* The script of the specified code point.
|
||||
*/
|
||||
SB_PUBLIC SBScript SBCodepointGetScript(SBCodepoint codepoint);
|
||||
|
||||
/**
|
||||
* Decodes the next Unicode code point from a UTF-8 encoded buffer.
|
||||
*
|
||||
* @param buffer
|
||||
* The buffer containing UTF-8 encoded code units.
|
||||
* @param length
|
||||
* The length of the buffer.
|
||||
* @param index
|
||||
* The index at which decoding starts. On output, it is updated to the start of the next code
|
||||
* point.
|
||||
* @return
|
||||
* The decoded code point, or `SBCodepointInvalid` if `index` is out of bounds.
|
||||
*/
|
||||
SB_PUBLIC SBCodepoint SBCodepointDecodeNextFromUTF8(const SBUInt8 *buffer, SBUInteger length,
|
||||
SBUInteger *index);
|
||||
|
||||
/**
|
||||
* Decodes the previous Unicode code point from a UTF-8 encoded buffer.
|
||||
*
|
||||
* @param buffer
|
||||
* The buffer containing UTF-8 encoded code units.
|
||||
* @param length
|
||||
* The length of the buffer.
|
||||
* @param index
|
||||
* The index before which decoding occurs. On output, it is updated to the start of the
|
||||
* decoded code point.
|
||||
* @return
|
||||
* The decoded code point, or `SBCodepointInvalid` if `index` is zero or out of bounds.
|
||||
*/
|
||||
SB_PUBLIC SBCodepoint SBCodepointDecodePreviousFromUTF8(const SBUInt8 *buffer, SBUInteger length,
|
||||
SBUInteger *index);
|
||||
|
||||
/**
|
||||
* Decodes the next Unicode code point from a UTF-16 encoded buffer.
|
||||
*
|
||||
* @param buffer
|
||||
* The buffer containing UTF-16 encoded code units.
|
||||
* @param length
|
||||
* The length of the buffer.
|
||||
* @param index
|
||||
* The index at which decoding starts. On output, it is updated to the start of the next code
|
||||
* point.
|
||||
* @return
|
||||
* The decoded code point, or `SBCodepointInvalid` if `index` is out of bounds.
|
||||
*/
|
||||
SB_PUBLIC SBCodepoint SBCodepointDecodeNextFromUTF16(const SBUInt16 *buffer, SBUInteger length,
|
||||
SBUInteger *index);
|
||||
|
||||
/**
|
||||
* Decodes the previous Unicode code point from a UTF-16 encoded buffer.
|
||||
*
|
||||
* @param buffer
|
||||
* The buffer containing UTF-16 encoded code units.
|
||||
* @param length
|
||||
* The length of the buffer.
|
||||
* @param index
|
||||
* The index before which decoding occurs. On output, it is updated to the start of the
|
||||
* decoded code point.
|
||||
* @return
|
||||
* The decoded code point, or `SBCodepointInvalid` if `index` is zero or out of bounds.
|
||||
*/
|
||||
SB_PUBLIC SBCodepoint SBCodepointDecodePreviousFromUTF16(const SBUInt16 *buffer, SBUInteger length,
|
||||
SBUInteger *index);
|
||||
|
||||
SB_EXTERN_C_END
|
||||
|
||||
#endif
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2016-2018 Muhammad Tayyab Akram
|
||||
* Copyright (C) 2016-2025 Muhammad Tayyab Akram
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -17,8 +17,10 @@
|
|||
#ifndef _SB_PUBLIC_CODEPOINT_SEQUENCE_H
|
||||
#define _SB_PUBLIC_CODEPOINT_SEQUENCE_H
|
||||
|
||||
#include "SBBase.h"
|
||||
#include "SBCodepoint.h"
|
||||
#include <SheenBidi/SBBase.h>
|
||||
#include <SheenBidi/SBCodepoint.h>
|
||||
|
||||
SB_EXTERN_C_BEGIN
|
||||
|
||||
enum {
|
||||
SBStringEncodingUTF8 = 0, /**< An 8-bit representation of Unicode code points. */
|
||||
|
|
@ -29,7 +31,7 @@ typedef SBUInt32 SBStringEncoding;
|
|||
|
||||
typedef struct _SBCodepointSequence {
|
||||
SBStringEncoding stringEncoding; /**< The encoding of the string. */
|
||||
void *stringBuffer; /**< The source string containing the code units. */
|
||||
const void *stringBuffer; /**< The source string containing the code units. */
|
||||
SBUInteger stringLength; /**< The length of the string in terms of code units. */
|
||||
} SBCodepointSequence;
|
||||
|
||||
|
|
@ -45,8 +47,8 @@ typedef struct _SBCodepointSequence {
|
|||
* The code point before the given string index, or SBCodepointInvalid if stringIndex is equal
|
||||
* to zero or larger than actual length of source string.
|
||||
*/
|
||||
SBCodepoint SBCodepointSequenceGetCodepointBefore(const SBCodepointSequence *codepointSequence,
|
||||
SBUInteger *stringIndex);
|
||||
SB_PUBLIC SBCodepoint SBCodepointSequenceGetCodepointBefore(
|
||||
const SBCodepointSequence *codepointSequence, SBUInteger *stringIndex);
|
||||
|
||||
/**
|
||||
* Returns the code point at the given string index.
|
||||
|
|
@ -60,7 +62,9 @@ SBCodepoint SBCodepointSequenceGetCodepointBefore(const SBCodepointSequence *cod
|
|||
* The code point at the given string index, or SBCodepointInvalid if stringIndex is larger
|
||||
* than or equal to actual length of source string.
|
||||
*/
|
||||
SBCodepoint SBCodepointSequenceGetCodepointAt(const SBCodepointSequence *codepointSequence,
|
||||
SBUInteger *stringIndex);
|
||||
SB_PUBLIC SBCodepoint SBCodepointSequenceGetCodepointAt(
|
||||
const SBCodepointSequence *codepointSequence, SBUInteger *stringIndex);
|
||||
|
||||
SB_EXTERN_C_END
|
||||
|
||||
#endif
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2014 Muhammad Tayyab Akram
|
||||
* Copyright (C) 2014-2025 Muhammad Tayyab Akram
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -17,6 +17,8 @@
|
|||
#ifndef _SB_PUBLIC_CONFIG_H
|
||||
#define _SB_PUBLIC_CONFIG_H
|
||||
|
||||
/* #define SB_CONFIG_DLL_EXPORT */
|
||||
/* #define SB_CONFIG_DLL_IMPORT */
|
||||
/* #define SB_CONFIG_LOG */
|
||||
/* #define SB_CONFIG_UNITY */
|
||||
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2018 Muhammad Tayyab Akram
|
||||
* Copyright (C) 2018-2025 Muhammad Tayyab Akram
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -17,7 +17,9 @@
|
|||
#ifndef _SB_PUBLIC_GENERAL_CATEGORY_H
|
||||
#define _SB_PUBLIC_GENERAL_CATEGORY_H
|
||||
|
||||
#include "SBBase.h"
|
||||
#include <SheenBidi/SBBase.h>
|
||||
|
||||
SB_EXTERN_C_BEGIN
|
||||
|
||||
/**
|
||||
* Constants that specify the general category of a character.
|
||||
|
|
@ -103,4 +105,6 @@ typedef SBUInt8 SBGeneralCategory;
|
|||
*/
|
||||
#define SBGeneralCategoryIsOther(gc) SBUInt8InRange(gc, SBGeneralCategoryCC, SBGeneralCategoryCN)
|
||||
|
||||
SB_EXTERN_C_END
|
||||
|
||||
#endif
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2014-2018 Muhammad Tayyab Akram
|
||||
* Copyright (C) 2014-2025 Muhammad Tayyab Akram
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -17,8 +17,10 @@
|
|||
#ifndef _SB_PUBLIC_LINE_H
|
||||
#define _SB_PUBLIC_LINE_H
|
||||
|
||||
#include "SBBase.h"
|
||||
#include "SBRun.h"
|
||||
#include <SheenBidi/SBBase.h>
|
||||
#include <SheenBidi/SBRun.h>
|
||||
|
||||
SB_EXTERN_C_BEGIN
|
||||
|
||||
typedef struct _SBLine *SBLineRef;
|
||||
|
||||
|
|
@ -30,7 +32,7 @@ typedef struct _SBLine *SBLineRef;
|
|||
* @return
|
||||
* The offset of the line passed in.
|
||||
*/
|
||||
SBUInteger SBLineGetOffset(SBLineRef line);
|
||||
SB_PUBLIC SBUInteger SBLineGetOffset(SBLineRef line);
|
||||
|
||||
/**
|
||||
* Returns the number of code units coverting the length of the line.
|
||||
|
|
@ -40,7 +42,7 @@ SBUInteger SBLineGetOffset(SBLineRef line);
|
|||
* @return
|
||||
* The length of the line passed in.
|
||||
*/
|
||||
SBUInteger SBLineGetLength(SBLineRef line);
|
||||
SB_PUBLIC SBUInteger SBLineGetLength(SBLineRef line);
|
||||
|
||||
/**
|
||||
* Returns the number of runs in the line.
|
||||
|
|
@ -50,7 +52,7 @@ SBUInteger SBLineGetLength(SBLineRef line);
|
|||
* @return
|
||||
* The number of runs in the line passed in.
|
||||
*/
|
||||
SBUInteger SBLineGetRunCount(SBLineRef line);
|
||||
SB_PUBLIC SBUInteger SBLineGetRunCount(SBLineRef line);
|
||||
|
||||
/**
|
||||
* Returns a direct pointer to the run array, stored in the line.
|
||||
|
|
@ -60,7 +62,7 @@ SBUInteger SBLineGetRunCount(SBLineRef line);
|
|||
* @return
|
||||
* A valid pointer to an array of SBRun structures.
|
||||
*/
|
||||
const SBRun *SBLineGetRunsPtr(SBLineRef line);
|
||||
SB_PUBLIC const SBRun *SBLineGetRunsPtr(SBLineRef line);
|
||||
|
||||
/**
|
||||
* Increments the reference count of a line object.
|
||||
|
|
@ -70,7 +72,7 @@ const SBRun *SBLineGetRunsPtr(SBLineRef line);
|
|||
* @return
|
||||
* The same line object passed in as the parameter.
|
||||
*/
|
||||
SBLineRef SBLineRetain(SBLineRef line);
|
||||
SB_PUBLIC SBLineRef SBLineRetain(SBLineRef line);
|
||||
|
||||
/**
|
||||
* Decrements the reference count of a line object. The object will be deallocated when its
|
||||
|
|
@ -79,6 +81,8 @@ SBLineRef SBLineRetain(SBLineRef line);
|
|||
* @param line
|
||||
* The line object whose reference count will be decremented.
|
||||
*/
|
||||
void SBLineRelease(SBLineRef line);
|
||||
SB_PUBLIC void SBLineRelease(SBLineRef line);
|
||||
|
||||
SB_EXTERN_C_END
|
||||
|
||||
#endif
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2014-2018 Muhammad Tayyab Akram
|
||||
* Copyright (C) 2014-2025 Muhammad Tayyab Akram
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -17,9 +17,11 @@
|
|||
#ifndef _SB_PUBLIC_MIRROR_LOCATOR_H
|
||||
#define _SB_PUBLIC_MIRROR_LOCATOR_H
|
||||
|
||||
#include "SBBase.h"
|
||||
#include "SBCodepoint.h"
|
||||
#include "SBLine.h"
|
||||
#include <SheenBidi/SBBase.h>
|
||||
#include <SheenBidi/SBCodepoint.h>
|
||||
#include <SheenBidi/SBLine.h>
|
||||
|
||||
SB_EXTERN_C_BEGIN
|
||||
|
||||
typedef struct _SBMirrorLocator *SBMirrorLocatorRef;
|
||||
|
||||
|
|
@ -38,7 +40,7 @@ typedef struct _SBMirrorAgent {
|
|||
* @return
|
||||
* A reference to a mirror locator object.
|
||||
*/
|
||||
SBMirrorLocatorRef SBMirrorLocatorCreate(void);
|
||||
SB_PUBLIC SBMirrorLocatorRef SBMirrorLocatorCreate(void);
|
||||
|
||||
/**
|
||||
* Loads a line in the locator so that its mirror can be located.
|
||||
|
|
@ -50,7 +52,8 @@ SBMirrorLocatorRef SBMirrorLocatorCreate(void);
|
|||
* @param stringBuffer
|
||||
* The string buffer from which the line's algorithm was created.
|
||||
*/
|
||||
void SBMirrorLocatorLoadLine(SBMirrorLocatorRef locator, SBLineRef line, void *stringBuffer);
|
||||
SB_PUBLIC void SBMirrorLocatorLoadLine(SBMirrorLocatorRef locator, SBLineRef line,
|
||||
void *stringBuffer);
|
||||
|
||||
/**
|
||||
* Returns the agent containing the information of current located mirror.
|
||||
|
|
@ -58,7 +61,7 @@ void SBMirrorLocatorLoadLine(SBMirrorLocatorRef locator, SBLineRef line, void *s
|
|||
* @param locator
|
||||
* The locator whose agent is returned.
|
||||
*/
|
||||
const SBMirrorAgent *SBMirrorLocatorGetAgent(SBMirrorLocatorRef locator);
|
||||
SB_PUBLIC const SBMirrorAgent *SBMirrorLocatorGetAgent(SBMirrorLocatorRef locator);
|
||||
|
||||
/**
|
||||
* Instructs the locator to find next mirror in the loaded line.
|
||||
|
|
@ -70,7 +73,7 @@ const SBMirrorAgent *SBMirrorLocatorGetAgent(SBMirrorLocatorRef locator);
|
|||
* @note
|
||||
* The locator will be reset after locating last mirror.
|
||||
*/
|
||||
SBBoolean SBMirrorLocatorMoveNext(SBMirrorLocatorRef locator);
|
||||
SB_PUBLIC SBBoolean SBMirrorLocatorMoveNext(SBMirrorLocatorRef locator);
|
||||
|
||||
/**
|
||||
* Instructs the locator to reset itself so that mirrors of the loaded line can be obatained from
|
||||
|
|
@ -79,7 +82,7 @@ SBBoolean SBMirrorLocatorMoveNext(SBMirrorLocatorRef locator);
|
|||
* @param locator
|
||||
* The locator whom you want to reset.
|
||||
*/
|
||||
void SBMirrorLocatorReset(SBMirrorLocatorRef locator);
|
||||
SB_PUBLIC void SBMirrorLocatorReset(SBMirrorLocatorRef locator);
|
||||
|
||||
/**
|
||||
* Increments the reference count of a mirror locator object.
|
||||
|
|
@ -89,7 +92,7 @@ void SBMirrorLocatorReset(SBMirrorLocatorRef locator);
|
|||
* @return
|
||||
* The same mirror locator object passed in as the parameter.
|
||||
*/
|
||||
SBMirrorLocatorRef SBMirrorLocatorRetain(SBMirrorLocatorRef locator);
|
||||
SB_PUBLIC SBMirrorLocatorRef SBMirrorLocatorRetain(SBMirrorLocatorRef locator);
|
||||
|
||||
/**
|
||||
* Decrements the reference count of a mirror locator object. The object will be deallocated when
|
||||
|
|
@ -98,6 +101,8 @@ SBMirrorLocatorRef SBMirrorLocatorRetain(SBMirrorLocatorRef locator);
|
|||
* @param locator
|
||||
* The mirror locator object whose reference count will be decremented.
|
||||
*/
|
||||
void SBMirrorLocatorRelease(SBMirrorLocatorRef locator);
|
||||
SB_PUBLIC void SBMirrorLocatorRelease(SBMirrorLocatorRef locator);
|
||||
|
||||
SB_EXTERN_C_END
|
||||
|
||||
#endif
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2014-2018 Muhammad Tayyab Akram
|
||||
* Copyright (C) 2014-2025 Muhammad Tayyab Akram
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -17,8 +17,10 @@
|
|||
#ifndef _SB_PUBLIC_PARAGRAPH_H
|
||||
#define _SB_PUBLIC_PARAGRAPH_H
|
||||
|
||||
#include "SBBase.h"
|
||||
#include "SBLine.h"
|
||||
#include <SheenBidi/SBBase.h>
|
||||
#include <SheenBidi/SBLine.h>
|
||||
|
||||
SB_EXTERN_C_BEGIN
|
||||
|
||||
typedef struct _SBParagraph *SBParagraphRef;
|
||||
|
||||
|
|
@ -30,7 +32,7 @@ typedef struct _SBParagraph *SBParagraphRef;
|
|||
* @return
|
||||
* The offset of the paragraph passed in.
|
||||
*/
|
||||
SBUInteger SBParagraphGetOffset(SBParagraphRef paragraph);
|
||||
SB_PUBLIC SBUInteger SBParagraphGetOffset(SBParagraphRef paragraph);
|
||||
|
||||
/**
|
||||
* Returns the number of code units covering the length of the paragraph.
|
||||
|
|
@ -40,7 +42,7 @@ SBUInteger SBParagraphGetOffset(SBParagraphRef paragraph);
|
|||
* @return
|
||||
* The length of the paragraph passed in.
|
||||
*/
|
||||
SBUInteger SBParagraphGetLength(SBParagraphRef paragraph);
|
||||
SB_PUBLIC SBUInteger SBParagraphGetLength(SBParagraphRef paragraph);
|
||||
|
||||
/**
|
||||
* Returns the base level of the paragraph.
|
||||
|
|
@ -50,7 +52,7 @@ SBUInteger SBParagraphGetLength(SBParagraphRef paragraph);
|
|||
* @return
|
||||
* The base level of the paragraph passed in.
|
||||
*/
|
||||
SBLevel SBParagraphGetBaseLevel(SBParagraphRef paragraph);
|
||||
SB_PUBLIC SBLevel SBParagraphGetBaseLevel(SBParagraphRef paragraph);
|
||||
|
||||
/**
|
||||
* Returns a direct pointer to the embedding levels, stored in the paragraph.
|
||||
|
|
@ -60,7 +62,7 @@ SBLevel SBParagraphGetBaseLevel(SBParagraphRef paragraph);
|
|||
* @return
|
||||
* A valid pointer to an array of SBLevel structures.
|
||||
*/
|
||||
const SBLevel *SBParagraphGetLevelsPtr(SBParagraphRef paragraph);
|
||||
SB_PUBLIC const SBLevel *SBParagraphGetLevelsPtr(SBParagraphRef paragraph);
|
||||
|
||||
/**
|
||||
* Creates a line object of specified range by applying rules L1-L2 of Unicode Bidirectional
|
||||
|
|
@ -76,7 +78,8 @@ const SBLevel *SBParagraphGetLevelsPtr(SBParagraphRef paragraph);
|
|||
* @return
|
||||
* A reference to a line object if the call was successful, NULL otherwise.
|
||||
*/
|
||||
SBLineRef SBParagraphCreateLine(SBParagraphRef paragraph, SBUInteger lineOffset, SBUInteger lineLength);
|
||||
SB_PUBLIC SBLineRef SBParagraphCreateLine(SBParagraphRef paragraph, SBUInteger lineOffset,
|
||||
SBUInteger lineLength);
|
||||
|
||||
/**
|
||||
* Increments the reference count of a paragraph object.
|
||||
|
|
@ -86,7 +89,7 @@ SBLineRef SBParagraphCreateLine(SBParagraphRef paragraph, SBUInteger lineOffset,
|
|||
* @return
|
||||
* The same paragraph object passed in as the parameter.
|
||||
*/
|
||||
SBParagraphRef SBParagraphRetain(SBParagraphRef paragraph);
|
||||
SB_PUBLIC SBParagraphRef SBParagraphRetain(SBParagraphRef paragraph);
|
||||
|
||||
/**
|
||||
* Decrements the reference count of a paragraph object. The object will be deallocated when its
|
||||
|
|
@ -95,6 +98,8 @@ SBParagraphRef SBParagraphRetain(SBParagraphRef paragraph);
|
|||
* @param paragraph
|
||||
* The paragraph object whose reference count will be decremented.
|
||||
*/
|
||||
void SBParagraphRelease(SBParagraphRef paragraph);
|
||||
SB_PUBLIC void SBParagraphRelease(SBParagraphRef paragraph);
|
||||
|
||||
SB_EXTERN_C_END
|
||||
|
||||
#endif
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2016-2018 Muhammad Tayyab Akram
|
||||
* Copyright (C) 2016-2025 Muhammad Tayyab Akram
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -17,7 +17,9 @@
|
|||
#ifndef _SB_PUBLIC_RUN_H
|
||||
#define _SB_PUBLIC_RUN_H
|
||||
|
||||
#include "SBBase.h"
|
||||
#include <SheenBidi/SBBase.h>
|
||||
|
||||
SB_EXTERN_C_BEGIN
|
||||
|
||||
/**
|
||||
* A structure containing the information of a sequence of characters having the same embedding
|
||||
|
|
@ -29,4 +31,6 @@ typedef struct _SBRun {
|
|||
SBLevel level; /**< The embedding level of the run. */
|
||||
} SBRun;
|
||||
|
||||
SB_EXTERN_C_END
|
||||
|
||||
#endif
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2021 Muhammad Tayyab Akram
|
||||
* Copyright (C) 2018-2025 Muhammad Tayyab Akram
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -17,7 +17,9 @@
|
|||
#ifndef _SB_PUBLIC_SCRIPT_H
|
||||
#define _SB_PUBLIC_SCRIPT_H
|
||||
|
||||
#include "SBBase.h"
|
||||
#include <SheenBidi/SBBase.h>
|
||||
|
||||
SB_EXTERN_C_BEGIN
|
||||
|
||||
/**
|
||||
* Constants that specify the script of a character.
|
||||
|
|
@ -230,7 +232,16 @@ enum {
|
|||
|
||||
/* Unicde 15.1 */
|
||||
SBScriptKAWI = 0xA3, /**< Kawi */
|
||||
SBScriptNAGM = 0xA4 /**< Nag_Mundari */
|
||||
SBScriptNAGM = 0xA4, /**< Nag_Mundari */
|
||||
|
||||
/* Unicde 16.0 */
|
||||
SBScriptGARA = 0xA5, /**< Garay */
|
||||
SBScriptGUKH = 0xA6, /**< Gurung_Khema */
|
||||
SBScriptKRAI = 0xA7, /**< Kirat_Rai */
|
||||
SBScriptONAO = 0xA8, /**< Ol_Onal */
|
||||
SBScriptSUNU = 0xA9, /**< Sunuwar */
|
||||
SBScriptTODR = 0xAA, /**< Todhri */
|
||||
SBScriptTUTG = 0xAB /**< Tulu_Tigalari */
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -253,6 +264,26 @@ typedef SBUInt8 SBScript;
|
|||
* @return
|
||||
* The OpenType tag of specified script as UInt32 in big endian byte order.
|
||||
*/
|
||||
SBUInt32 SBScriptGetOpenTypeTag(SBScript script);
|
||||
SB_DEPRECATED
|
||||
SB_PUBLIC SBUInt32 SBScriptGetOpenTypeTag(SBScript script);
|
||||
|
||||
/**
|
||||
* Returns the 4-letter Unicode Script abbreviation tag for a given SBScript value.
|
||||
*
|
||||
* The tag is returned as a UInt32 value in big-endian byte order (e.g., 'Arab' is 0x41726162),
|
||||
* suitable for use in shaping engines and script tagging.
|
||||
*
|
||||
* The tag is based on the Unicode Script property aliases as defined in PropertyValueAliases.txt,
|
||||
* section: "sc" (Script).
|
||||
*
|
||||
* @param script
|
||||
* The SBScript enum value.
|
||||
* @return
|
||||
* A big-endian UInt32 representing the 4-letter script tag, or 0 if the script has no
|
||||
* associated tag.
|
||||
*/
|
||||
SB_PUBLIC SBUInt32 SBScriptGetUnicodeTag(SBScript script);
|
||||
|
||||
SB_EXTERN_C_END
|
||||
|
||||
#endif
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2018 Muhammad Tayyab Akram
|
||||
* Copyright (C) 2018-2025 Muhammad Tayyab Akram
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -17,9 +17,11 @@
|
|||
#ifndef _SB_PUBLIC_SCRIPT_LOCATOR_H
|
||||
#define _SB_PUBLIC_SCRIPT_LOCATOR_H
|
||||
|
||||
#include "SBBase.h"
|
||||
#include "SBCodepointSequence.h"
|
||||
#include "SBScript.h"
|
||||
#include <SheenBidi/SBBase.h>
|
||||
#include <SheenBidi/SBCodepointSequence.h>
|
||||
#include <SheenBidi/SBScript.h>
|
||||
|
||||
SB_EXTERN_C_BEGIN
|
||||
|
||||
typedef struct _SBScriptLocator *SBScriptLocatorRef;
|
||||
|
||||
|
|
@ -38,7 +40,7 @@ typedef struct _SBScriptAgent {
|
|||
* @return
|
||||
* A reference to a script locator object.
|
||||
*/
|
||||
SBScriptLocatorRef SBScriptLocatorCreate(void);
|
||||
SB_PUBLIC SBScriptLocatorRef SBScriptLocatorCreate(void);
|
||||
|
||||
/**
|
||||
* Loads a code point sequence in the locator so that its script runs can be located.
|
||||
|
|
@ -48,7 +50,8 @@ SBScriptLocatorRef SBScriptLocatorCreate(void);
|
|||
* @param codepointSequence
|
||||
* The code point sequence which will be loaded in the locator.
|
||||
*/
|
||||
void SBScriptLocatorLoadCodepoints(SBScriptLocatorRef locator, const SBCodepointSequence *codepointSequence);
|
||||
SB_PUBLIC void SBScriptLocatorLoadCodepoints(SBScriptLocatorRef locator,
|
||||
const SBCodepointSequence *codepointSequence);
|
||||
|
||||
/**
|
||||
* Returns the agent containing the information of current located script run.
|
||||
|
|
@ -56,7 +59,7 @@ void SBScriptLocatorLoadCodepoints(SBScriptLocatorRef locator, const SBCodepoint
|
|||
* @param locator
|
||||
* The locator whose agent is returned.
|
||||
*/
|
||||
const SBScriptAgent *SBScriptLocatorGetAgent(SBScriptLocatorRef locator);
|
||||
SB_PUBLIC const SBScriptAgent *SBScriptLocatorGetAgent(SBScriptLocatorRef locator);
|
||||
|
||||
/**
|
||||
* Instructs the locator to find next script run in the loaded code point sequence.
|
||||
|
|
@ -68,7 +71,7 @@ const SBScriptAgent *SBScriptLocatorGetAgent(SBScriptLocatorRef locator);
|
|||
* @note
|
||||
* The locator will be reset after locating last script run.
|
||||
*/
|
||||
SBBoolean SBScriptLocatorMoveNext(SBScriptLocatorRef locator);
|
||||
SB_PUBLIC SBBoolean SBScriptLocatorMoveNext(SBScriptLocatorRef locator);
|
||||
|
||||
/**
|
||||
* Instructs the locator to reset itself so that script runs of the loaded line can be obatained
|
||||
|
|
@ -77,7 +80,7 @@ SBBoolean SBScriptLocatorMoveNext(SBScriptLocatorRef locator);
|
|||
* @param locator
|
||||
* The locator whom you want to reset.
|
||||
*/
|
||||
void SBScriptLocatorReset(SBScriptLocatorRef locator);
|
||||
SB_PUBLIC void SBScriptLocatorReset(SBScriptLocatorRef locator);
|
||||
|
||||
/**
|
||||
* Increments the reference count of a script locator object.
|
||||
|
|
@ -87,7 +90,7 @@ void SBScriptLocatorReset(SBScriptLocatorRef locator);
|
|||
* @return
|
||||
* The same script locator object passed in as the parameter.
|
||||
*/
|
||||
SBScriptLocatorRef SBScriptLocatorRetain(SBScriptLocatorRef locator);
|
||||
SB_PUBLIC SBScriptLocatorRef SBScriptLocatorRetain(SBScriptLocatorRef locator);
|
||||
|
||||
/**
|
||||
* Decrements the reference count of a script locator object. The object will be deallocated when
|
||||
|
|
@ -96,6 +99,8 @@ SBScriptLocatorRef SBScriptLocatorRetain(SBScriptLocatorRef locator);
|
|||
* @param locator
|
||||
* The script locator object whose reference count will be decremented.
|
||||
*/
|
||||
void SBScriptLocatorRelease(SBScriptLocatorRef locator);
|
||||
SB_PUBLIC void SBScriptLocatorRelease(SBScriptLocatorRef locator);
|
||||
|
||||
SB_EXTERN_C_END
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* Copyright (C) 2025 Muhammad Tayyab Akram
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef _SB_PUBLIC_VERSION_H
|
||||
#define _SB_PUBLIC_VERSION_H
|
||||
|
||||
#include <SheenBidi/SBBase.h>
|
||||
|
||||
SB_EXTERN_C_BEGIN
|
||||
|
||||
#define SHEENBIDI_VERSION_MAJOR 2
|
||||
#define SHEENBIDI_VERSION_MINOR 9
|
||||
#define SHEENBIDI_VERSION_PATCH 0
|
||||
#define SHEENBIDI_VERSION_STRING "2.9.0"
|
||||
|
||||
/**
|
||||
* Returns the version string of the SheenBidi library.
|
||||
*
|
||||
* This function returns a constant null-terminated string representing the version of the linked
|
||||
* SheenBidi library, in the format "MAJOR.MINOR.PATCH".
|
||||
*
|
||||
* @return A string representing the version (e.g. "2.9.0").
|
||||
*/
|
||||
SB_PUBLIC const char *SBVersionGetString(void);
|
||||
|
||||
SB_EXTERN_C_END
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* Copyright (C) 2014-2025 Muhammad Tayyab Akram
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef _SHEEN_BIDI_H
|
||||
#define _SHEEN_BIDI_H
|
||||
|
||||
#include <SheenBidi/SBAlgorithm.h>
|
||||
#include <SheenBidi/SBBase.h>
|
||||
#include <SheenBidi/SBBidiType.h>
|
||||
#include <SheenBidi/SBCodepoint.h>
|
||||
#include <SheenBidi/SBCodepointSequence.h>
|
||||
#include <SheenBidi/SBGeneralCategory.h>
|
||||
#include <SheenBidi/SBLine.h>
|
||||
#include <SheenBidi/SBMirrorLocator.h>
|
||||
#include <SheenBidi/SBParagraph.h>
|
||||
#include <SheenBidi/SBRun.h>
|
||||
#include <SheenBidi/SBScript.h>
|
||||
#include <SheenBidi/SBScriptLocator.h>
|
||||
#include <SheenBidi/SBVersion.h>
|
||||
|
||||
#endif
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
- The include of SBRun.h in SBLine.c was changed to use angle brackets.
|
||||
- Include paths to SheenBidi headers in <angle brackets> have been swapped for
|
||||
versions that explicitly point inside the juce_graphics module.
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2014-2019 Muhammad Tayyab Akram
|
||||
* Copyright (C) 2014-2025 Muhammad Tayyab Akram
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -14,16 +14,17 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <juce_graphics/unicode/sheenbidi/Headers/SBConfig.h>
|
||||
#include <SheenBidi/SBConfig.h>
|
||||
|
||||
#include "SBBase.h"
|
||||
#include "BidiChain.h"
|
||||
|
||||
SB_INTERNAL void BidiChainInitialize(BidiChainRef chain,
|
||||
SBBidiType *types, SBLevel *levels, BidiLink *links)
|
||||
SBBidiType *types, SBLevel *levels, BidiFlag *flags, BidiLink *links)
|
||||
{
|
||||
chain->types = types;
|
||||
chain->levels = levels;
|
||||
chain->flags = flags;
|
||||
chain->links = links;
|
||||
chain->roller = 0;
|
||||
chain->last = 0;
|
||||
|
|
@ -31,33 +32,30 @@ SB_INTERNAL void BidiChainInitialize(BidiChainRef chain,
|
|||
/* Make first link empty. */
|
||||
chain->types[0] = SBBidiTypeNil;
|
||||
chain->levels[0] = SBLevelInvalid;
|
||||
chain->flags[0] = BidiFlagNone;
|
||||
chain->links[0] = BidiLinkNone;
|
||||
}
|
||||
|
||||
SB_INTERNAL void BidiChainAdd(BidiChainRef chain, SBBidiType type, SBUInteger length)
|
||||
SB_INTERNAL void BidiChainAdd(BidiChainRef chain, SBBidiType type, SBUInteger lastLinkLength)
|
||||
{
|
||||
BidiLink last = chain->last;
|
||||
BidiLink current = last + (SBUInt32)length;
|
||||
BidiLink current = last + (SBUInt32)lastLinkLength;
|
||||
|
||||
chain->types[current] = type;
|
||||
chain->flags[current] = BidiFlagNone;
|
||||
chain->links[current] = chain->roller;
|
||||
|
||||
if (lastLinkLength == 1) {
|
||||
chain->flags[last] |= BidiFlagSingle;
|
||||
}
|
||||
|
||||
chain->links[last] = current;
|
||||
chain->last = current;
|
||||
}
|
||||
|
||||
SB_INTERNAL SBBoolean BidiChainIsSingle(BidiChainRef chain, BidiLink link)
|
||||
{
|
||||
BidiLink next = chain->links[link];
|
||||
|
||||
/* Check the type of in between code units. */
|
||||
while (++link != next) {
|
||||
if (chain->types[link] != SBBidiTypeBN) {
|
||||
return SBFalse;
|
||||
}
|
||||
}
|
||||
|
||||
return SBTrue;
|
||||
return chain->flags[link] & BidiFlagSingle;
|
||||
}
|
||||
|
||||
SB_INTERNAL SBBidiType BidiChainGetType(BidiChainRef chain, BidiLink link)
|
||||
|
|
@ -98,11 +96,21 @@ SB_INTERNAL void BidiChainAbandonNext(BidiChainRef chain, BidiLink link)
|
|||
chain->links[link] = limit;
|
||||
}
|
||||
|
||||
SB_INTERNAL SBBoolean BidiChainMergeIfEqual(BidiChainRef chain, BidiLink first, BidiLink second)
|
||||
SB_INTERNAL void BidiChainAbsorbNext(BidiChainRef chain, BidiLink link)
|
||||
{
|
||||
if (chain->types[first] == chain->types[second]
|
||||
&& chain->levels[first] == chain->levels[second]) {
|
||||
chain->links[first] = chain->links[second];
|
||||
BidiLink next = chain->links[link];
|
||||
|
||||
chain->links[link] = chain->links[next];
|
||||
chain->flags[link] &= ~BidiFlagSingle;
|
||||
}
|
||||
|
||||
SB_INTERNAL SBBoolean BidiChainMergeNext(BidiChainRef chain, BidiLink link)
|
||||
{
|
||||
BidiLink next = chain->links[link];
|
||||
|
||||
if (chain->types[link] == chain->types[next]
|
||||
&& chain->levels[link] == chain->levels[next]) {
|
||||
BidiChainAbsorbNext(chain, link);
|
||||
return SBTrue;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2014-2019 Muhammad Tayyab Akram
|
||||
* Copyright (C) 2014-2025 Muhammad Tayyab Akram
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -17,24 +17,32 @@
|
|||
#ifndef _SB_INTERNAL_BIDI_CHAIN_H
|
||||
#define _SB_INTERNAL_BIDI_CHAIN_H
|
||||
|
||||
#include <juce_graphics/unicode/sheenbidi/Headers/SBConfig.h>
|
||||
#include <SheenBidi/SBConfig.h>
|
||||
|
||||
#include "SBBase.h"
|
||||
|
||||
typedef SBUInt32 BidiLink;
|
||||
|
||||
#define BidiLinkNone (SBUInt32)(-1)
|
||||
|
||||
enum {
|
||||
BidiFlagNone = 0x00,
|
||||
BidiFlagSingle = 0x01
|
||||
};
|
||||
typedef SBUInt8 BidiFlag;
|
||||
|
||||
typedef struct _BidiChain {
|
||||
SBBidiType *types;
|
||||
SBLevel *levels;
|
||||
BidiFlag *flags;
|
||||
BidiLink *links;
|
||||
BidiLink roller;
|
||||
BidiLink last;
|
||||
} BidiChain, *BidiChainRef;
|
||||
|
||||
SB_INTERNAL void BidiChainInitialize(BidiChainRef chain,
|
||||
SBBidiType *types, SBLevel *levels, BidiLink *links);
|
||||
SB_INTERNAL void BidiChainAdd(BidiChainRef chain, SBBidiType type, SBUInteger length);
|
||||
SBBidiType *types, SBLevel *levels, BidiFlag *flags, BidiLink *links);
|
||||
SB_INTERNAL void BidiChainAdd(BidiChainRef chain, SBBidiType type, SBUInteger lastLinkLength);
|
||||
|
||||
#define BidiChainGetOffset(chain, link) \
|
||||
( \
|
||||
|
|
@ -52,7 +60,8 @@ SB_INTERNAL void BidiChainSetLevel(BidiChainRef chain, BidiLink link, SBLevel le
|
|||
SB_INTERNAL BidiLink BidiChainGetNext(BidiChainRef chain, BidiLink link);
|
||||
SB_INTERNAL void BidiChainSetNext(BidiChainRef chain, BidiLink link, BidiLink next);
|
||||
SB_INTERNAL void BidiChainAbandonNext(BidiChainRef chain, BidiLink link);
|
||||
SB_INTERNAL SBBoolean BidiChainMergeIfEqual(BidiChainRef chain, BidiLink first, BidiLink second);
|
||||
SB_INTERNAL void BidiChainAbsorbNext(BidiChainRef chain, BidiLink link);
|
||||
SB_INTERNAL SBBoolean BidiChainMergeNext(BidiChainRef chain, BidiLink link);
|
||||
|
||||
#define BidiChainForEach(chain, roller, link) \
|
||||
for (link = chain->links[roller]; link != roller; link = chain->links[link])
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -6,10 +6,10 @@
|
|||
#ifndef _SB_INTERNAL_BIDI_TYPE_LOOKUP_H
|
||||
#define _SB_INTERNAL_BIDI_TYPE_LOOKUP_H
|
||||
|
||||
#include <juce_graphics/unicode/sheenbidi/Headers/SBBidiType.h>
|
||||
#include <juce_graphics/unicode/sheenbidi/Headers/SBConfig.h>
|
||||
|
||||
#include "SBBase.h"
|
||||
#include <SheenBidi/SBBase.h>
|
||||
#include <SheenBidi/SBBidiType.h>
|
||||
#include <SheenBidi/SBCodepoint.h>
|
||||
#include <SheenBidi/SBConfig.h>
|
||||
|
||||
SB_INTERNAL SBBidiType LookupBidiType(SBCodepoint codepoint);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2014-2022 Muhammad Tayyab Akram
|
||||
* Copyright (C) 2014-2025 Muhammad Tayyab Akram
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -14,13 +14,15 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <juce_graphics/unicode/sheenbidi/Headers/SBConfig.h>
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <SheenBidi/SBConfig.h>
|
||||
|
||||
#include "BidiChain.h"
|
||||
#include "Object.h"
|
||||
#include "SBAssert.h"
|
||||
#include "SBBase.h"
|
||||
#include "SBCodepoint.h"
|
||||
#include "BracketQueue.h"
|
||||
|
||||
static SBBoolean BracketQueueInsertElement(BracketQueueRef queue)
|
||||
|
|
@ -32,7 +34,7 @@ static SBBoolean BracketQueueInsertElement(BracketQueueRef queue)
|
|||
BracketQueueListRef rearList = previousList->next;
|
||||
|
||||
if (!rearList) {
|
||||
rearList = malloc(sizeof(BracketQueueList));
|
||||
rearList = ObjectAddMemory(&queue->_object, sizeof(BracketQueueList));
|
||||
if (!rearList) {
|
||||
return SBFalse;
|
||||
}
|
||||
|
|
@ -70,6 +72,8 @@ static void BracketQueueFinalizePairs(BracketQueueRef queue, BracketQueueListRef
|
|||
|
||||
SB_INTERNAL void BracketQueueInitialize(BracketQueueRef queue)
|
||||
{
|
||||
ObjectInitialize(&queue->_object);
|
||||
|
||||
queue->_firstList.previous = NULL;
|
||||
queue->_firstList.next = NULL;
|
||||
queue->_frontList = NULL;
|
||||
|
|
@ -161,21 +165,6 @@ SB_INTERNAL void BracketQueueClosePair(BracketQueueRef queue, BidiLink closingLi
|
|||
{
|
||||
BracketQueueListRef list = queue->_rearList;
|
||||
SBInteger top = queue->_rearTop;
|
||||
SBCodepoint canonical;
|
||||
|
||||
switch (bracket) {
|
||||
case 0x232A:
|
||||
canonical = 0x3009;
|
||||
break;
|
||||
|
||||
case 0x3009:
|
||||
canonical = 0x232A;
|
||||
break;
|
||||
|
||||
default:
|
||||
canonical = bracket;
|
||||
break;
|
||||
}
|
||||
|
||||
while (1) {
|
||||
SBBoolean isFrontList = (list == queue->_frontList);
|
||||
|
|
@ -184,7 +173,7 @@ SB_INTERNAL void BracketQueueClosePair(BracketQueueRef queue, BidiLink closingLi
|
|||
do {
|
||||
if (list->openingLink[top] != BidiLinkNone
|
||||
&& list->closingLink[top] == BidiLinkNone
|
||||
&& (list->bracket[top] == bracket || list->bracket[top] == canonical)) {
|
||||
&& SBCodepointIsCanonicalEquivalentBracket(list->bracket[top], bracket)) {
|
||||
list->closingLink[top] = closingLink;
|
||||
BracketQueueFinalizePairs(queue, list, top);
|
||||
|
||||
|
|
@ -232,11 +221,5 @@ SB_INTERNAL SBBidiType BracketQueueGetStrongType(BracketQueueRef queue)
|
|||
|
||||
SB_INTERNAL void BracketQueueFinalize(BracketQueueRef queue)
|
||||
{
|
||||
BracketQueueListRef list = queue->_firstList.next;
|
||||
|
||||
while (list) {
|
||||
BracketQueueListRef next = list->next;
|
||||
free(list);
|
||||
list = next;
|
||||
}
|
||||
ObjectFinalize(&queue->_object);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2014-2022 Muhammad Tayyab Akram
|
||||
* Copyright (C) 2014-2025 Muhammad Tayyab Akram
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -17,10 +17,12 @@
|
|||
#ifndef _SB_INTERNAL_BRACKET_QUEUE_H
|
||||
#define _SB_INTERNAL_BRACKET_QUEUE_H
|
||||
|
||||
#include <juce_graphics/unicode/sheenbidi/Headers/SBConfig.h>
|
||||
#include <SheenBidi/SBBase.h>
|
||||
#include <SheenBidi/SBCodepoint.h>
|
||||
#include <SheenBidi/SBConfig.h>
|
||||
|
||||
#include "BidiChain.h"
|
||||
#include "SBBase.h"
|
||||
#include "Object.h"
|
||||
|
||||
#define BracketQueueList_Length 8
|
||||
#define BracketQueueList_MaxIndex (BracketQueueList_Length - 1)
|
||||
|
|
@ -37,6 +39,7 @@ typedef struct _BracketQueueList {
|
|||
} BracketQueueList, *BracketQueueListRef;
|
||||
|
||||
typedef struct _BracketQueue {
|
||||
Object _object;
|
||||
BracketQueueList _firstList;
|
||||
BracketQueueListRef _frontList;
|
||||
BracketQueueListRef _rearList;
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -6,10 +6,10 @@
|
|||
#ifndef _SB_INTERNAL_GENERAL_CATEGORY_LOOKUP_H
|
||||
#define _SB_INTERNAL_GENERAL_CATEGORY_LOOKUP_H
|
||||
|
||||
#include <juce_graphics/unicode/sheenbidi/Headers/SBConfig.h>
|
||||
#include <juce_graphics/unicode/sheenbidi/Headers/SBGeneralCategory.h>
|
||||
|
||||
#include "SBBase.h"
|
||||
#include <SheenBidi/SBBase.h>
|
||||
#include <SheenBidi/SBCodepoint.h>
|
||||
#include <SheenBidi/SBConfig.h>
|
||||
#include <SheenBidi/SBGeneralCategory.h>
|
||||
|
||||
SB_INTERNAL SBGeneralCategory LookupGeneralCategory(SBCodepoint codepoint);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2014-2022 Muhammad Tayyab Akram
|
||||
* Copyright (C) 2014-2025 Muhammad Tayyab Akram
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <juce_graphics/unicode/sheenbidi/Headers/SBConfig.h>
|
||||
#include <SheenBidi/SBConfig.h>
|
||||
|
||||
#include "BidiChain.h"
|
||||
#include "BracketQueue.h"
|
||||
|
|
@ -23,6 +23,7 @@
|
|||
#include "PairingLookup.h"
|
||||
#include "SBAssert.h"
|
||||
#include "SBBase.h"
|
||||
#include "SBCodepoint.h"
|
||||
#include "SBLog.h"
|
||||
#include "IsolatingRun.h"
|
||||
|
||||
|
|
@ -129,7 +130,7 @@ static BidiLink ResolveWeakTypes(IsolatingRunRef isolatingRun)
|
|||
}
|
||||
|
||||
if ((type != SBBidiTypeON && BidiChainGetType(chain, priorLink) == type) || forceMerge) {
|
||||
BidiChainAbandonNext(chain, priorLink);
|
||||
BidiChainAbsorbNext(chain, priorLink);
|
||||
} else {
|
||||
priorLink = link;
|
||||
}
|
||||
|
|
@ -200,7 +201,7 @@ static BidiLink ResolveWeakTypes(IsolatingRunRef isolatingRun)
|
|||
}
|
||||
|
||||
if (type != SBBidiTypeON && BidiChainGetType(chain, priorLink) == type) {
|
||||
BidiChainAbandonNext(chain, priorLink);
|
||||
BidiChainAbsorbNext(chain, priorLink);
|
||||
} else {
|
||||
priorLink = link;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
#ifndef _SB_INTERNAL_ISOLATING_RUN_H
|
||||
#define _SB_INTERNAL_ISOLATING_RUN_H
|
||||
|
||||
#include <juce_graphics/unicode/sheenbidi/Headers/SBConfig.h>
|
||||
#include <SheenBidi/SBConfig.h>
|
||||
|
||||
#include "BidiChain.h"
|
||||
#include "BracketQueue.h"
|
||||
|
|
|
|||
|
|
@ -14,7 +14,8 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <juce_graphics/unicode/sheenbidi/Headers/SBConfig.h>
|
||||
#include <SheenBidi/SBConfig.h>
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include "BidiChain.h"
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
#ifndef _SB_INTERNAL_LEVEL_RUN_H
|
||||
#define _SB_INTERNAL_LEVEL_RUN_H
|
||||
|
||||
#include <juce_graphics/unicode/sheenbidi/Headers/SBConfig.h>
|
||||
#include <SheenBidi/SBConfig.h>
|
||||
|
||||
#include "BidiChain.h"
|
||||
#include "RunExtrema.h"
|
||||
|
|
|
|||
156
modules/juce_graphics/unicode/sheenbidi/Source/Object.c
Normal file
156
modules/juce_graphics/unicode/sheenbidi/Source/Object.c
Normal file
|
|
@ -0,0 +1,156 @@
|
|||
/*
|
||||
* Copyright (C) 2025 Muhammad Tayyab Akram
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <SheenBidi/SBConfig.h>
|
||||
|
||||
#include "SBAssert.h"
|
||||
#include "SBBase.h"
|
||||
#include "Object.h"
|
||||
|
||||
/**
|
||||
* Calculates the total size from a list of chunk sizes.
|
||||
*/
|
||||
static SBUInteger CalculateTotalSize(const SBUInteger *sizes, SBUInteger count)
|
||||
{
|
||||
SBUInteger totalSize = 0;
|
||||
SBUInteger index;
|
||||
|
||||
for (index = 0; index < count; index++) {
|
||||
totalSize += sizes[index];
|
||||
}
|
||||
|
||||
return totalSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allocates a single block of memory large enough to store an optional header followed by a
|
||||
* sequence of memory chunks. Initializes the `pointers` array with addresses to each chunk.
|
||||
*/
|
||||
static void *AllocateMemory(SBUInteger headerSize, SBUInteger totalSize,
|
||||
const SBUInteger *sizes, SBUInteger count, void **pointers)
|
||||
{
|
||||
void *base = malloc(headerSize + totalSize);
|
||||
|
||||
if (base) {
|
||||
SBUInt8 *memory = (SBUInt8 *)base;
|
||||
SBUInteger offset = headerSize;
|
||||
SBUInteger index;
|
||||
|
||||
for (index = 0; index < count; index++) {
|
||||
pointers[index] = memory + offset;
|
||||
offset += sizes[index];
|
||||
}
|
||||
}
|
||||
|
||||
return base;
|
||||
}
|
||||
|
||||
SB_INTERNAL ObjectRef ObjectCreate(const SBUInteger *sizes, SBUInteger count, void **pointers)
|
||||
{
|
||||
SBUInteger totalSize = CalculateTotalSize(sizes, count);
|
||||
ObjectRef object;
|
||||
|
||||
/* Total size MUST be greater than the size of Object structure. */
|
||||
SBAssert(totalSize > sizeof(Object));
|
||||
|
||||
object = AllocateMemory(0, totalSize, sizes, count, pointers);
|
||||
|
||||
if (object) {
|
||||
ObjectInitialize(object);
|
||||
}
|
||||
|
||||
return object;
|
||||
}
|
||||
|
||||
SB_INTERNAL void ObjectInitialize(ObjectRef object)
|
||||
{
|
||||
object->_memoryList = NULL;
|
||||
}
|
||||
|
||||
SB_INTERNAL void *ObjectAddMemory(ObjectRef object, SBUInteger size)
|
||||
{
|
||||
void *pointer;
|
||||
|
||||
if (ObjectAddMemoryWithChunks(object, &size, 1, &pointer)) {
|
||||
return pointer;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SB_INTERNAL SBBoolean ObjectAddMemoryWithChunks(ObjectRef object,
|
||||
const SBUInteger *sizes, SBUInteger count, void **pointers)
|
||||
{
|
||||
MemoryListRef memoryList = object->_memoryList;
|
||||
SBUInteger totalSize = CalculateTotalSize(sizes, count);
|
||||
|
||||
/* Total size MUST be greater than zero. */
|
||||
SBAssert(totalSize > 0);
|
||||
|
||||
if (memoryList) {
|
||||
MemoryBlockRef block = AllocateMemory(sizeof(MemoryBlock), totalSize, sizes, count, pointers);
|
||||
|
||||
if (block) {
|
||||
block->next = NULL;
|
||||
|
||||
memoryList->last->next = block;
|
||||
memoryList->last = block;
|
||||
|
||||
return SBTrue;
|
||||
}
|
||||
} else {
|
||||
memoryList = AllocateMemory(sizeof(MemoryList), totalSize, sizes, count, pointers);
|
||||
|
||||
if (memoryList) {
|
||||
memoryList->first.next = NULL;
|
||||
memoryList->last = &memoryList->first;
|
||||
|
||||
object->_memoryList = memoryList;
|
||||
|
||||
return SBTrue;
|
||||
}
|
||||
}
|
||||
|
||||
return SBFalse;
|
||||
}
|
||||
|
||||
SB_INTERNAL void ObjectFinalize(ObjectRef object)
|
||||
{
|
||||
MemoryListRef memoryList = object->_memoryList;
|
||||
|
||||
if (memoryList) {
|
||||
MemoryBlockRef block = &memoryList->first;
|
||||
|
||||
while (block) {
|
||||
MemoryBlockRef next = block->next;
|
||||
/* Free the block along with its data as they were allocated together. */
|
||||
free(block);
|
||||
|
||||
block = next;
|
||||
}
|
||||
|
||||
object->_memoryList = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
SB_INTERNAL void ObjectDispose(ObjectRef object)
|
||||
{
|
||||
ObjectFinalize(object);
|
||||
free(object);
|
||||
}
|
||||
114
modules/juce_graphics/unicode/sheenbidi/Source/Object.h
Normal file
114
modules/juce_graphics/unicode/sheenbidi/Source/Object.h
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
/*
|
||||
* Copyright (C) 2025 Muhammad Tayyab Akram
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef _SB_INTERNAL_OBJECT_H
|
||||
#define _SB_INTERNAL_OBJECT_H
|
||||
|
||||
#include <SheenBidi/SBConfig.h>
|
||||
|
||||
#include "SBBase.h"
|
||||
|
||||
/**
|
||||
* Represents a single dynamically allocated memory block.
|
||||
* The actual memory for use starts right after the MemoryBlock structure.
|
||||
*/
|
||||
typedef struct _MemoryBlock {
|
||||
struct _MemoryBlock *next;
|
||||
} MemoryBlock, *MemoryBlockRef;
|
||||
|
||||
/**
|
||||
* Represents a linked list of memory blocks allocated by an object.
|
||||
*/
|
||||
typedef struct _MemoryList {
|
||||
MemoryBlock first;
|
||||
MemoryBlockRef last;
|
||||
} MemoryList, *MemoryListRef;
|
||||
|
||||
/**
|
||||
* Base object containing a memory list.
|
||||
*/
|
||||
typedef struct Object {
|
||||
MemoryListRef _memoryList;
|
||||
} Object, *ObjectRef;
|
||||
|
||||
/**
|
||||
* Creates and initializes an Object with one or more memory chunks.
|
||||
*
|
||||
* @param sizes
|
||||
* Array of chunk sizes.
|
||||
* @param count
|
||||
* Number of chunks.
|
||||
* @param pointers
|
||||
* Output array to receive addresses of allocated chunks.
|
||||
* @return
|
||||
* A pointer to the initialized Object, or NULL on failure.
|
||||
*/
|
||||
SB_INTERNAL ObjectRef ObjectCreate(const SBUInteger *sizes, SBUInteger count, void **pointers);
|
||||
|
||||
/**
|
||||
* Initializes an already-allocated Object.
|
||||
*
|
||||
* @param object
|
||||
* The Object to initialize.
|
||||
*/
|
||||
SB_INTERNAL void ObjectInitialize(ObjectRef object);
|
||||
|
||||
/**
|
||||
* Allocates and adds a single memory chunk to an existing Object, tracking it internally.
|
||||
*
|
||||
* @param object
|
||||
* The Object to which the memory is added.
|
||||
* @param size
|
||||
* The size of the chunk to allocate.
|
||||
* @return
|
||||
* Pointer to the newly allocated memory, or NULL on failure.
|
||||
*/
|
||||
SB_INTERNAL void *ObjectAddMemory(ObjectRef object, SBUInteger size);
|
||||
|
||||
/**
|
||||
* Allocates and adds multiple memory chunks to an existing Object, tracking them internally.
|
||||
*
|
||||
* @param object
|
||||
* The Object to which the chunks are added.
|
||||
* @param sizes
|
||||
* Array of chunk sizes.
|
||||
* @param count
|
||||
* Number of chunks.
|
||||
* @param pointers
|
||||
* Output array to receive addresses of allocated chunks.
|
||||
* @return
|
||||
* `SBTrue` if successful, `SBFalse` otherwise.
|
||||
*/
|
||||
SB_INTERNAL SBBoolean ObjectAddMemoryWithChunks(ObjectRef object,
|
||||
const SBUInteger *sizes, SBUInteger count, void **pointers);
|
||||
|
||||
/**
|
||||
* Frees all memory chunks added to the Object using ObjectAddMemory*.
|
||||
*
|
||||
* @param object
|
||||
* The Object whose internal memory is released.
|
||||
*/
|
||||
SB_INTERNAL void ObjectFinalize(ObjectRef object);
|
||||
|
||||
/**
|
||||
* Frees the Object and all associated memory.
|
||||
*
|
||||
* @param object
|
||||
* The Object to dispose.
|
||||
*/
|
||||
SB_INTERNAL void ObjectDispose(ObjectRef object);
|
||||
|
||||
#endif
|
||||
|
|
@ -6,10 +6,11 @@
|
|||
#ifndef _SB_INTERNAL_PAIRING_LOOKUP_H
|
||||
#define _SB_INTERNAL_PAIRING_LOOKUP_H
|
||||
|
||||
#include <juce_graphics/unicode/sheenbidi/Headers/SBConfig.h>
|
||||
#include <SheenBidi/SBBase.h>
|
||||
#include <SheenBidi/SBCodepoint.h>
|
||||
#include <SheenBidi/SBConfig.h>
|
||||
|
||||
#include "BracketType.h"
|
||||
#include "SBBase.h"
|
||||
|
||||
SB_INTERNAL SBCodepoint LookupMirror(SBCodepoint codepoint);
|
||||
SB_INTERNAL SBCodepoint LookupBracketPair(SBCodepoint codepoint, BracketType *bracketType);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2014-2022 Muhammad Tayyab Akram
|
||||
* Copyright (C) 2014-2025 Muhammad Tayyab Akram
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -14,13 +14,14 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <juce_graphics/unicode/sheenbidi/Headers/SBConfig.h>
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <SheenBidi/SBBase.h>
|
||||
#include <SheenBidi/SBConfig.h>
|
||||
|
||||
#include "LevelRun.h"
|
||||
#include "Object.h"
|
||||
#include "SBAssert.h"
|
||||
#include "SBBase.h"
|
||||
#include "RunQueue.h"
|
||||
|
||||
static SBBoolean RunQueueInsertElement(RunQueueRef queue)
|
||||
|
|
@ -32,7 +33,7 @@ static SBBoolean RunQueueInsertElement(RunQueueRef queue)
|
|||
RunQueueListRef rearList = previousList->next;
|
||||
|
||||
if (!rearList) {
|
||||
rearList = malloc(sizeof(RunQueueList));
|
||||
rearList = ObjectAddMemory(&queue->_object, sizeof(RunQueueList));
|
||||
if (!rearList) {
|
||||
return SBFalse;
|
||||
}
|
||||
|
|
@ -79,6 +80,8 @@ static void FindPreviousPartialRun(RunQueueRef queue)
|
|||
|
||||
SB_INTERNAL void RunQueueInitialize(RunQueueRef queue)
|
||||
{
|
||||
ObjectInitialize(&queue->_object);
|
||||
|
||||
/* Initialize first list. */
|
||||
queue->_firstList.previous = NULL;
|
||||
queue->_firstList.next = NULL;
|
||||
|
|
@ -95,7 +98,6 @@ SB_INTERNAL void RunQueueInitialize(RunQueueRef queue)
|
|||
|
||||
/* Initialize rest of the elements. */
|
||||
queue->count = 0;
|
||||
queue->peek = &queue->_frontList->elements[queue->_frontTop];
|
||||
queue->shouldDequeue = SBFalse;
|
||||
}
|
||||
|
||||
|
|
@ -146,16 +148,17 @@ SB_INTERNAL void RunQueueDequeue(RunQueueRef queue)
|
|||
}
|
||||
|
||||
queue->count -= 1;
|
||||
queue->peek = &queue->_frontList->elements[queue->_frontTop];
|
||||
}
|
||||
|
||||
SB_INTERNAL LevelRunRef RunQueueGetFront(RunQueueRef queue)
|
||||
{
|
||||
/* The queue should not be empty. */
|
||||
SBAssert(queue->count != 0);
|
||||
|
||||
return &queue->_frontList->elements[queue->_frontTop];
|
||||
}
|
||||
|
||||
SB_INTERNAL void RunQueueFinalize(RunQueueRef queue)
|
||||
{
|
||||
RunQueueListRef list = queue->_firstList.next;
|
||||
|
||||
while (list) {
|
||||
RunQueueListRef next = list->next;
|
||||
free(list);
|
||||
list = next;
|
||||
};
|
||||
ObjectFinalize(&queue->_object);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2014-2022 Muhammad Tayyab Akram
|
||||
* Copyright (C) 2014-2025 Muhammad Tayyab Akram
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -17,10 +17,11 @@
|
|||
#ifndef _SB_INTERNAL_RUN_QUEUE_H
|
||||
#define _SB_INTERNAL_RUN_QUEUE_H
|
||||
|
||||
#include <juce_graphics/unicode/sheenbidi/Headers/SBConfig.h>
|
||||
#include <SheenBidi/SBBase.h>
|
||||
#include <SheenBidi/SBConfig.h>
|
||||
|
||||
#include "LevelRun.h"
|
||||
#include "SBBase.h"
|
||||
#include "Object.h"
|
||||
|
||||
#define RunQueueList_Length 8
|
||||
#define RunQueueList_MaxIndex (RunQueueList_Length - 1)
|
||||
|
|
@ -33,6 +34,7 @@ typedef struct _RunQueueList {
|
|||
} RunQueueList, *RunQueueListRef;
|
||||
|
||||
typedef struct _RunQueue {
|
||||
Object _object;
|
||||
RunQueueList _firstList; /**< First list of elements, which is part of the queue */
|
||||
RunQueueListRef _frontList; /**< The list containing front element of the queue */
|
||||
RunQueueListRef _rearList; /**< The list containing rear element of the queue */
|
||||
|
|
@ -40,7 +42,6 @@ typedef struct _RunQueue {
|
|||
SBInteger _frontTop; /**< Index of front element in front list */
|
||||
SBInteger _rearTop; /**< Index of rear element in rear list */
|
||||
SBInteger _partialTop; /**< Index of partial run in partial list */
|
||||
LevelRunRef peek; /**< Peek element of the queue */
|
||||
SBUInteger count; /**< Number of elements the queue contains */
|
||||
SBBoolean shouldDequeue;
|
||||
} RunQueue, *RunQueueRef;
|
||||
|
|
@ -50,6 +51,8 @@ SB_INTERNAL void RunQueueInitialize(RunQueueRef queue);
|
|||
SB_INTERNAL SBBoolean RunQueueEnqueue(RunQueueRef queue, const LevelRunRef levelRun);
|
||||
SB_INTERNAL void RunQueueDequeue(RunQueueRef queue);
|
||||
|
||||
SB_INTERNAL LevelRunRef RunQueueGetFront(RunQueueRef queue);
|
||||
|
||||
SB_INTERNAL void RunQueueFinalize(RunQueueRef queue);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2016-2022 Muhammad Tayyab Akram
|
||||
* Copyright (C) 2016-2025 Muhammad Tayyab Akram
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -14,45 +14,44 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <juce_graphics/unicode/sheenbidi/Headers/SBConfig.h>
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <SheenBidi/SBConfig.h>
|
||||
|
||||
#include "BidiTypeLookup.h"
|
||||
#include "Object.h"
|
||||
#include "SBBase.h"
|
||||
#include "SBCodepoint.h"
|
||||
#include "SBCodepointSequence.h"
|
||||
#include "SBLog.h"
|
||||
#include "SBParagraph.h"
|
||||
#include "SBAlgorithm.h"
|
||||
|
||||
#define ALGORITHM 0
|
||||
#define BIDI_TYPES 1
|
||||
#define COUNT 2
|
||||
|
||||
static SBAlgorithmRef AllocateAlgorithm(SBUInteger stringLength)
|
||||
{
|
||||
const SBUInteger sizeAlgorithm = sizeof(SBAlgorithm);
|
||||
const SBUInteger sizeTypes = sizeof(SBBidiType) * stringLength;
|
||||
const SBUInteger sizeMemory = sizeAlgorithm + sizeTypes;
|
||||
void *pointers[COUNT] = { NULL };
|
||||
SBUInteger sizes[COUNT];
|
||||
|
||||
void *pointer = malloc(sizeMemory);
|
||||
sizes[ALGORITHM] = sizeof(SBAlgorithm);
|
||||
sizes[BIDI_TYPES] = sizeof(SBBidiType) * stringLength;
|
||||
|
||||
if (pointer) {
|
||||
const SBUInteger offsetAlgorithm = 0;
|
||||
const SBUInteger offsetTypes = offsetAlgorithm + sizeAlgorithm;
|
||||
|
||||
SBUInt8 *memory = (SBUInt8 *)pointer;
|
||||
SBAlgorithmRef algorithm = (SBAlgorithmRef)(memory + offsetAlgorithm);
|
||||
SBLevel *fixedTypes = (SBLevel *)(memory + offsetTypes);
|
||||
if (ObjectCreate(sizes, COUNT, pointers)) {
|
||||
SBAlgorithmRef algorithm = pointers[ALGORITHM];
|
||||
SBBidiType *fixedTypes = pointers[BIDI_TYPES];
|
||||
|
||||
algorithm->fixedTypes = fixedTypes;
|
||||
|
||||
return algorithm;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return pointers[ALGORITHM];
|
||||
}
|
||||
|
||||
static void DisposeAlgorithm(SBAlgorithmRef algorithm)
|
||||
{
|
||||
free(algorithm);
|
||||
}
|
||||
#undef ALGORITHM
|
||||
#undef BIDI_TYPES
|
||||
#undef COUNT
|
||||
|
||||
static void DetermineBidiTypes(const SBCodepointSequence *sequence, SBBidiType *types)
|
||||
{
|
||||
|
|
@ -198,6 +197,6 @@ SBAlgorithmRef SBAlgorithmRetain(SBAlgorithmRef algorithm)
|
|||
void SBAlgorithmRelease(SBAlgorithmRef algorithm)
|
||||
{
|
||||
if (algorithm && --algorithm->retainCount == 0) {
|
||||
DisposeAlgorithm(algorithm);
|
||||
ObjectDispose(&algorithm->_object);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2016-2019 Muhammad Tayyab Akram
|
||||
* Copyright (C) 2016-2025 Muhammad Tayyab Akram
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -17,13 +17,16 @@
|
|||
#ifndef _SB_INTERNAL_ALGORITHM_H
|
||||
#define _SB_INTERNAL_ALGORITHM_H
|
||||
|
||||
#include <juce_graphics/unicode/sheenbidi/Headers/SBAlgorithm.h>
|
||||
#include <juce_graphics/unicode/sheenbidi/Headers/SBBase.h>
|
||||
#include <juce_graphics/unicode/sheenbidi/Headers/SBBidiType.h>
|
||||
#include <juce_graphics/unicode/sheenbidi/Headers/SBCodepointSequence.h>
|
||||
#include <juce_graphics/unicode/sheenbidi/Headers/SBConfig.h>
|
||||
#include <SheenBidi/SBAlgorithm.h>
|
||||
#include <SheenBidi/SBBase.h>
|
||||
#include <SheenBidi/SBBidiType.h>
|
||||
#include <SheenBidi/SBCodepointSequence.h>
|
||||
#include <SheenBidi/SBConfig.h>
|
||||
|
||||
#include "Object.h"
|
||||
|
||||
typedef struct _SBAlgorithm {
|
||||
Object _object;
|
||||
SBCodepointSequence codepointSequence;
|
||||
SBBidiType *fixedTypes;
|
||||
SBUInteger retainCount;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2016-2019 Muhammad Tayyab Akram
|
||||
* Copyright (C) 2016-2025 Muhammad Tayyab Akram
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -14,14 +14,13 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <juce_graphics/unicode/sheenbidi/Headers/SBConfig.h>
|
||||
#include <SheenBidi/SBConfig.h>
|
||||
#include <SheenBidi/SBVersion.h>
|
||||
|
||||
#include "BidiTypeLookup.h"
|
||||
#include "GeneralCategoryLookup.h"
|
||||
#include "PairingLookup.h"
|
||||
#include "ScriptLookup.h"
|
||||
#include "SBBase.h"
|
||||
|
||||
static const char LibraryVersion[] = SHEENBIDI_VERSION_STRING;
|
||||
|
||||
#define TAG(a, b, c, d) \
|
||||
(SBUInt32) \
|
||||
( \
|
||||
|
|
@ -88,30 +87,10 @@ SB_INTERNAL SBBoolean SBUIntegerVerifyRange(SBUInteger actualLength,
|
|||
&& possibleLimit <= actualLength;
|
||||
}
|
||||
|
||||
SBBidiType SBCodepointGetBidiType(SBCodepoint codepoint)
|
||||
{
|
||||
return LookupBidiType(codepoint);
|
||||
}
|
||||
|
||||
SBGeneralCategory SBCodepointGetGeneralCategory(SBCodepoint codepoint)
|
||||
{
|
||||
return LookupGeneralCategory(codepoint);
|
||||
}
|
||||
|
||||
SBCodepoint SBCodepointGetMirror(SBCodepoint codepoint)
|
||||
{
|
||||
return LookupMirror(codepoint);
|
||||
}
|
||||
|
||||
SBScript SBCodepointGetScript(SBCodepoint codepoint)
|
||||
{
|
||||
return LookupScript(codepoint);
|
||||
}
|
||||
|
||||
SBUInt32 SBScriptGetOpenTypeTag(SBScript script)
|
||||
{
|
||||
/* Reference: https://docs.microsoft.com/en-us/typography/opentype/spec/scripttags */
|
||||
/* Dated: 07/24/2017 */
|
||||
/* Dated: 05/31/2024 */
|
||||
|
||||
switch (script) {
|
||||
case SBScriptADLM:
|
||||
|
|
@ -150,7 +129,7 @@ SBUInt32 SBScriptGetOpenTypeTag(SBScript script)
|
|||
return TAG('b', 'u', 'g', 'i');
|
||||
case SBScriptBUHD:
|
||||
return TAG('b', 'u', 'h', 'd');
|
||||
/* case SBScriptBYZM:
|
||||
/* case SBScript____:
|
||||
return TAG('b', 'y', 'z', 'm'); */
|
||||
case SBScriptCANS:
|
||||
return TAG('c', 'a', 'n', 's');
|
||||
|
|
@ -164,30 +143,40 @@ SBUInt32 SBScriptGetOpenTypeTag(SBScript script)
|
|||
return TAG('c', 'h', 'a', 'm');
|
||||
case SBScriptCHER:
|
||||
return TAG('c', 'h', 'e', 'r');
|
||||
case SBScriptCHRS:
|
||||
return TAG('c', 'h', 'r', 's');
|
||||
case SBScriptHANI:
|
||||
return TAG('h', 'a', 'n', 'i');
|
||||
case SBScriptCOPT:
|
||||
return TAG('c', 'o', 'p', 't');
|
||||
case SBScriptCPRT:
|
||||
return TAG('c', 'p', 'r', 't');
|
||||
case SBScriptCPMN:
|
||||
return TAG('c', 'p', 'm', 'n');
|
||||
case SBScriptCYRL:
|
||||
return TAG('c', 'y', 'r', 'l');
|
||||
/* case SBScriptDFLT:
|
||||
return TAG('D', 'F', 'L', 'T'); */
|
||||
case SBScriptDSRT:
|
||||
return TAG('d', 's', 'r', 't');
|
||||
/* case SBScriptDEVA:
|
||||
return TAG('d', 'e', 'v', 'a'); */
|
||||
case SBScriptDEVA:
|
||||
return TAG('d', 'e', 'v', '2');
|
||||
case SBScriptDIAK:
|
||||
return TAG('d', 'i', 'a', 'k');
|
||||
case SBScriptDOGR:
|
||||
return TAG('d', 'o', 'g', 'r');
|
||||
case SBScriptDUPL:
|
||||
return TAG('d', 'u', 'p', 'l');
|
||||
case SBScriptEGYP:
|
||||
return TAG('e', 'g', 'y', 'p');
|
||||
case SBScriptELBA:
|
||||
return TAG('e', 'l', 'b', 'a');
|
||||
case SBScriptELYM:
|
||||
return TAG('e', 'l', 'y', 'm');
|
||||
case SBScriptETHI:
|
||||
return TAG('e', 't', 'h', 'i');
|
||||
case SBScriptGARA:
|
||||
return TAG('g', 'a', 'r', 'a');
|
||||
case SBScriptGEOR:
|
||||
return TAG('g', 'e', 'o', 'r');
|
||||
case SBScriptGLAG:
|
||||
|
|
@ -202,14 +191,20 @@ SBUInt32 SBScriptGetOpenTypeTag(SBScript script)
|
|||
return TAG('g', 'u', 'j', 'r'); */
|
||||
case SBScriptGUJR:
|
||||
return TAG('g', 'j', 'r', '2');
|
||||
case SBScriptGONG:
|
||||
return TAG('g', 'o', 'n', 'g');
|
||||
/* case SBScriptGURU:
|
||||
return TAG('g', 'u', 'r', 'u'); */
|
||||
case SBScriptGURU:
|
||||
return TAG('g', 'u', 'r', '2');
|
||||
case SBScriptGUKH:
|
||||
return TAG('g', 'u', 'k', 'h');
|
||||
case SBScriptHANG:
|
||||
return TAG('h', 'a', 'n', 'g');
|
||||
/* case SBScriptJAMO:
|
||||
/* case SBScriptHANG:
|
||||
return TAG('j', 'a', 'm', 'o'); */
|
||||
case SBScriptROHG:
|
||||
return TAG('r', 'o', 'h', 'g');
|
||||
case SBScriptHANO:
|
||||
return TAG('h', 'a', 'n', 'o');
|
||||
case SBScriptHATR:
|
||||
|
|
@ -234,16 +229,22 @@ SBUInt32 SBScriptGetOpenTypeTag(SBScript script)
|
|||
return TAG('k', 'n', 'd', '2');
|
||||
case SBScriptKANA:
|
||||
return TAG('k', 'a', 'n', 'a');
|
||||
case SBScriptKAWI:
|
||||
return TAG('k', 'a', 'w', 'i');
|
||||
case SBScriptKALI:
|
||||
return TAG('k', 'a', 'l', 'i');
|
||||
case SBScriptKHAR:
|
||||
return TAG('k', 'h', 'a', 'r');
|
||||
case SBScriptKITS:
|
||||
return TAG('k', 'i', 't', 's');
|
||||
case SBScriptKHMR:
|
||||
return TAG('k', 'h', 'm', 'r');
|
||||
case SBScriptKHOJ:
|
||||
return TAG('k', 'h', 'o', 'j');
|
||||
case SBScriptSIND:
|
||||
return TAG('s', 'i', 'n', 'd');
|
||||
case SBScriptKRAI:
|
||||
return TAG('k', 'r', 'a', 'i');
|
||||
case SBScriptLAOO:
|
||||
return TAG('l', 'a', 'o', ' ');
|
||||
case SBScriptLATN:
|
||||
|
|
@ -264,6 +265,8 @@ SBUInt32 SBScriptGetOpenTypeTag(SBScript script)
|
|||
return TAG('l', 'y', 'd', 'i');
|
||||
case SBScriptMAHJ:
|
||||
return TAG('m', 'a', 'h', 'j');
|
||||
case SBScriptMAKA:
|
||||
return TAG('m', 'a', 'k', 'a');
|
||||
/* case SBScriptMLYM:
|
||||
return TAG('m', 'l', 'y', 'm'); */
|
||||
case SBScriptMLYM:
|
||||
|
|
@ -274,8 +277,12 @@ SBUInt32 SBScriptGetOpenTypeTag(SBScript script)
|
|||
return TAG('m', 'a', 'n', 'i');
|
||||
case SBScriptMARC:
|
||||
return TAG('m', 'a', 'r', 'c');
|
||||
/* case SBScriptMATH:
|
||||
case SBScriptGONM:
|
||||
return TAG('g', 'o', 'n', 'm');
|
||||
/* case SBScript____:
|
||||
return TAG('m', 'a', 't', 'h'); */
|
||||
case SBScriptMEDF:
|
||||
return TAG('m', 'e', 'd', 'f');
|
||||
case SBScriptMTEI:
|
||||
return TAG('m', 't', 'e', 'i');
|
||||
case SBScriptMEND:
|
||||
|
|
@ -294,7 +301,7 @@ SBUInt32 SBScriptGetOpenTypeTag(SBScript script)
|
|||
return TAG('m', 'r', 'o', 'o');
|
||||
case SBScriptMULT:
|
||||
return TAG('m', 'u', 'l', 't');
|
||||
/* case SBScriptMUSC:
|
||||
/* case SBScript___:
|
||||
return TAG('m', 'u', 's', 'c'); */
|
||||
/* case SBScriptMYMR:
|
||||
return TAG('m', 'y', 'm', 'r'); */
|
||||
|
|
@ -302,12 +309,20 @@ SBUInt32 SBScriptGetOpenTypeTag(SBScript script)
|
|||
return TAG('m', 'y', 'm', '2');
|
||||
case SBScriptNBAT:
|
||||
return TAG('n', 'b', 'a', 't');
|
||||
case SBScriptNAGM:
|
||||
return TAG('n', 'a', 'g', 'm');
|
||||
case SBScriptNAND:
|
||||
return TAG('n', 'a', 'n', 'd');
|
||||
case SBScriptNEWA:
|
||||
return TAG('n', 'e', 'w', 'a');
|
||||
case SBScriptTALU:
|
||||
return TAG('t', 'a', 'l', 'u');
|
||||
case SBScriptNKOO:
|
||||
return TAG('n', 'k', 'o', ' ');
|
||||
case SBScriptNSHU:
|
||||
return TAG('n', 's', 'h', 'u');
|
||||
case SBScriptHMNP:
|
||||
return TAG('h', 'm', 'n', 'p');
|
||||
/* case SBScriptORYA:
|
||||
return TAG('o', 'r', 'y', 'a'); */
|
||||
case SBScriptORYA:
|
||||
|
|
@ -316,6 +331,8 @@ SBUInt32 SBScriptGetOpenTypeTag(SBScript script)
|
|||
return TAG('o', 'g', 'a', 'm');
|
||||
case SBScriptOLCK:
|
||||
return TAG('o', 'l', 'c', 'k');
|
||||
case SBScriptONAO:
|
||||
return TAG('o', 'n', 'a', 'o');
|
||||
case SBScriptITAL:
|
||||
return TAG('i', 't', 'a', 'l');
|
||||
case SBScriptHUNG:
|
||||
|
|
@ -326,10 +343,14 @@ SBUInt32 SBScriptGetOpenTypeTag(SBScript script)
|
|||
return TAG('p', 'e', 'r', 'm');
|
||||
case SBScriptXPEO:
|
||||
return TAG('x', 'p', 'e', 'o');
|
||||
case SBScriptSOGO:
|
||||
return TAG('s', 'o', 'g', 'o');
|
||||
case SBScriptSARB:
|
||||
return TAG('s', 'a', 'r', 'b');
|
||||
case SBScriptORKH:
|
||||
return TAG('o', 'r', 'k', 'h');
|
||||
case SBScriptOUGR:
|
||||
return TAG('o', 'u', 'g', 'r');
|
||||
case SBScriptOSGE:
|
||||
return TAG('o', 's', 'g', 'e');
|
||||
case SBScriptOSMA:
|
||||
|
|
@ -364,12 +385,18 @@ SBUInt32 SBScriptGetOpenTypeTag(SBScript script)
|
|||
return TAG('s', 'g', 'n', 'w');
|
||||
case SBScriptSINH:
|
||||
return TAG('s', 'i', 'n', 'h');
|
||||
case SBScriptSOGD:
|
||||
return TAG('s', 'o', 'g', 'd');
|
||||
case SBScriptSORA:
|
||||
return TAG('s', 'o', 'r', 'a');
|
||||
case SBScriptSOYO:
|
||||
return TAG('s', 'o', 'y', 'o');
|
||||
case SBScriptXSUX:
|
||||
return TAG('x', 's', 'u', 'x');
|
||||
case SBScriptSUND:
|
||||
return TAG('s', 'u', 'n', 'd');
|
||||
case SBScriptSUNU:
|
||||
return TAG('s', 'u', 'n', 'u');
|
||||
case SBScriptSYLO:
|
||||
return TAG('s', 'y', 'l', 'o');
|
||||
case SBScriptSYRC:
|
||||
|
|
@ -390,6 +417,8 @@ SBUInt32 SBScriptGetOpenTypeTag(SBScript script)
|
|||
return TAG('t', 'a', 'm', 'l'); */
|
||||
case SBScriptTAML:
|
||||
return TAG('t', 'm', 'l', '2');
|
||||
case SBScriptTNSA:
|
||||
return TAG('t', 'n', 's', 'a');
|
||||
case SBScriptTANG:
|
||||
return TAG('t', 'a', 'n', 'g');
|
||||
/* case SBScriptTELU:
|
||||
|
|
@ -406,15 +435,384 @@ SBUInt32 SBScriptGetOpenTypeTag(SBScript script)
|
|||
return TAG('t', 'f', 'n', 'g');
|
||||
case SBScriptTIRH:
|
||||
return TAG('t', 'i', 'r', 'h');
|
||||
case SBScriptTODR:
|
||||
return TAG('t', 'o', 'd', 'r');
|
||||
case SBScriptTOTO:
|
||||
return TAG('t', 'o', 't', 'o');
|
||||
case SBScriptTUTG:
|
||||
return TAG('t', 'u', 't', 'g');
|
||||
case SBScriptUGAR:
|
||||
return TAG('u', 'g', 'a', 'r');
|
||||
case SBScriptVAII:
|
||||
return TAG('v', 'a', 'i', ' ');
|
||||
case SBScriptVITH:
|
||||
return TAG('v', 'i', 't', 'h');
|
||||
case SBScriptWCHO:
|
||||
return TAG('w', 'c', 'h', 'o');
|
||||
case SBScriptWARA:
|
||||
return TAG('w', 'a', 'r', 'a');
|
||||
case SBScriptYEZI:
|
||||
return TAG('y', 'e', 'z', 'i');
|
||||
case SBScriptYIII:
|
||||
return TAG('y', 'i', ' ', ' ');
|
||||
case SBScriptZANB:
|
||||
return TAG('z', 'a', 'n', 'b');
|
||||
default:
|
||||
return TAG('D', 'F', 'L', 'T');
|
||||
}
|
||||
}
|
||||
|
||||
SBUInt32 SBScriptGetUnicodeTag(SBScript script)
|
||||
{
|
||||
switch (script) {
|
||||
case SBScriptADLM:
|
||||
return TAG('A', 'd', 'l', 'm');
|
||||
case SBScriptAGHB:
|
||||
return TAG('A', 'g', 'h', 'b');
|
||||
case SBScriptAHOM:
|
||||
return TAG('A', 'h', 'o', 'm');
|
||||
case SBScriptARAB:
|
||||
return TAG('A', 'r', 'a', 'b');
|
||||
case SBScriptARMI:
|
||||
return TAG('A', 'r', 'm', 'i');
|
||||
case SBScriptARMN:
|
||||
return TAG('A', 'r', 'm', 'n');
|
||||
case SBScriptAVST:
|
||||
return TAG('A', 'v', 's', 't');
|
||||
case SBScriptBALI:
|
||||
return TAG('B', 'a', 'l', 'i');
|
||||
case SBScriptBAMU:
|
||||
return TAG('B', 'a', 'm', 'u');
|
||||
case SBScriptBASS:
|
||||
return TAG('B', 'a', 's', 's');
|
||||
case SBScriptBATK:
|
||||
return TAG('B', 'a', 't', 'k');
|
||||
case SBScriptBENG:
|
||||
return TAG('B', 'e', 'n', 'g');
|
||||
case SBScriptBHKS:
|
||||
return TAG('B', 'h', 'k', 's');
|
||||
case SBScriptBOPO:
|
||||
return TAG('B', 'o', 'p', 'o');
|
||||
case SBScriptBRAH:
|
||||
return TAG('B', 'r', 'a', 'h');
|
||||
case SBScriptBRAI:
|
||||
return TAG('B', 'r', 'a', 'i');
|
||||
case SBScriptBUGI:
|
||||
return TAG('B', 'u', 'g', 'i');
|
||||
case SBScriptBUHD:
|
||||
return TAG('B', 'u', 'h', 'd');
|
||||
case SBScriptCAKM:
|
||||
return TAG('C', 'a', 'k', 'm');
|
||||
case SBScriptCANS:
|
||||
return TAG('C', 'a', 'n', 's');
|
||||
case SBScriptCARI:
|
||||
return TAG('C', 'a', 'r', 'i');
|
||||
case SBScriptCHAM:
|
||||
return TAG('C', 'h', 'a', 'm');
|
||||
case SBScriptCHER:
|
||||
return TAG('C', 'h', 'e', 'r');
|
||||
case SBScriptCHRS:
|
||||
return TAG('C', 'h', 'r', 's');
|
||||
case SBScriptCOPT:
|
||||
return TAG('C', 'o', 'p', 't');
|
||||
case SBScriptCPMN:
|
||||
return TAG('C', 'p', 'm', 'n');
|
||||
case SBScriptCPRT:
|
||||
return TAG('C', 'p', 'r', 't');
|
||||
case SBScriptCYRL:
|
||||
return TAG('C', 'y', 'r', 'l');
|
||||
case SBScriptDEVA:
|
||||
return TAG('D', 'e', 'v', 'a');
|
||||
case SBScriptDIAK:
|
||||
return TAG('D', 'i', 'a', 'k');
|
||||
case SBScriptDOGR:
|
||||
return TAG('D', 'o', 'g', 'r');
|
||||
case SBScriptDSRT:
|
||||
return TAG('D', 's', 'r', 't');
|
||||
case SBScriptDUPL:
|
||||
return TAG('D', 'u', 'p', 'l');
|
||||
case SBScriptEGYP:
|
||||
return TAG('E', 'g', 'y', 'p');
|
||||
case SBScriptELBA:
|
||||
return TAG('E', 'l', 'b', 'a');
|
||||
case SBScriptELYM:
|
||||
return TAG('E', 'l', 'y', 'm');
|
||||
case SBScriptETHI:
|
||||
return TAG('E', 't', 'h', 'i');
|
||||
case SBScriptGARA:
|
||||
return TAG('G', 'a', 'r', 'a');
|
||||
case SBScriptGEOR:
|
||||
return TAG('G', 'e', 'o', 'r');
|
||||
case SBScriptGLAG:
|
||||
return TAG('G', 'l', 'a', 'g');
|
||||
case SBScriptGONG:
|
||||
return TAG('G', 'o', 'n', 'g');
|
||||
case SBScriptGONM:
|
||||
return TAG('G', 'o', 'n', 'm');
|
||||
case SBScriptGOTH:
|
||||
return TAG('G', 'o', 't', 'h');
|
||||
case SBScriptGRAN:
|
||||
return TAG('G', 'r', 'a', 'n');
|
||||
case SBScriptGREK:
|
||||
return TAG('G', 'r', 'e', 'k');
|
||||
case SBScriptGUJR:
|
||||
return TAG('G', 'u', 'j', 'r');
|
||||
case SBScriptGUKH:
|
||||
return TAG('G', 'u', 'k', 'h');
|
||||
case SBScriptGURU:
|
||||
return TAG('G', 'u', 'r', 'u');
|
||||
case SBScriptHANG:
|
||||
return TAG('H', 'a', 'n', 'g');
|
||||
case SBScriptHANI:
|
||||
return TAG('H', 'a', 'n', 'i');
|
||||
case SBScriptHANO:
|
||||
return TAG('H', 'a', 'n', 'o');
|
||||
case SBScriptHATR:
|
||||
return TAG('H', 'a', 't', 'r');
|
||||
case SBScriptHEBR:
|
||||
return TAG('H', 'e', 'b', 'r');
|
||||
case SBScriptHIRA:
|
||||
return TAG('H', 'i', 'r', 'a');
|
||||
case SBScriptHLUW:
|
||||
return TAG('H', 'l', 'u', 'w');
|
||||
case SBScriptHMNG:
|
||||
return TAG('H', 'm', 'n', 'g');
|
||||
case SBScriptHMNP:
|
||||
return TAG('H', 'm', 'n', 'p');
|
||||
case SBScriptHUNG:
|
||||
return TAG('H', 'u', 'n', 'g');
|
||||
case SBScriptITAL:
|
||||
return TAG('I', 't', 'a', 'l');
|
||||
case SBScriptJAVA:
|
||||
return TAG('J', 'a', 'v', 'a');
|
||||
case SBScriptKALI:
|
||||
return TAG('K', 'a', 'l', 'i');
|
||||
case SBScriptKANA:
|
||||
return TAG('K', 'a', 'n', 'a');
|
||||
case SBScriptKAWI:
|
||||
return TAG('K', 'a', 'w', 'i');
|
||||
case SBScriptKHAR:
|
||||
return TAG('K', 'h', 'a', 'r');
|
||||
case SBScriptKHMR:
|
||||
return TAG('K', 'h', 'm', 'r');
|
||||
case SBScriptKHOJ:
|
||||
return TAG('K', 'h', 'o', 'j');
|
||||
case SBScriptKITS:
|
||||
return TAG('K', 'i', 't', 's');
|
||||
case SBScriptKNDA:
|
||||
return TAG('K', 'n', 'd', 'a');
|
||||
case SBScriptKRAI:
|
||||
return TAG('K', 'r', 'a', 'i');
|
||||
case SBScriptKTHI:
|
||||
return TAG('K', 't', 'h', 'i');
|
||||
case SBScriptLANA:
|
||||
return TAG('L', 'a', 'n', 'a');
|
||||
case SBScriptLAOO:
|
||||
return TAG('L', 'a', 'o', 'o');
|
||||
case SBScriptLATN:
|
||||
return TAG('L', 'a', 't', 'n');
|
||||
case SBScriptLEPC:
|
||||
return TAG('L', 'e', 'p', 'c');
|
||||
case SBScriptLIMB:
|
||||
return TAG('L', 'i', 'm', 'b');
|
||||
case SBScriptLINA:
|
||||
return TAG('L', 'i', 'n', 'a');
|
||||
case SBScriptLINB:
|
||||
return TAG('L', 'i', 'n', 'b');
|
||||
case SBScriptLISU:
|
||||
return TAG('L', 'i', 's', 'u');
|
||||
case SBScriptLYCI:
|
||||
return TAG('L', 'y', 'c', 'i');
|
||||
case SBScriptLYDI:
|
||||
return TAG('L', 'y', 'd', 'i');
|
||||
case SBScriptMAHJ:
|
||||
return TAG('M', 'a', 'h', 'j');
|
||||
case SBScriptMAKA:
|
||||
return TAG('M', 'a', 'k', 'a');
|
||||
case SBScriptMAND:
|
||||
return TAG('M', 'a', 'n', 'd');
|
||||
case SBScriptMANI:
|
||||
return TAG('M', 'a', 'n', 'i');
|
||||
case SBScriptMARC:
|
||||
return TAG('M', 'a', 'r', 'c');
|
||||
case SBScriptMEDF:
|
||||
return TAG('M', 'e', 'd', 'f');
|
||||
case SBScriptMEND:
|
||||
return TAG('M', 'e', 'n', 'd');
|
||||
case SBScriptMERC:
|
||||
return TAG('M', 'e', 'r', 'c');
|
||||
case SBScriptMERO:
|
||||
return TAG('M', 'e', 'r', 'o');
|
||||
case SBScriptMLYM:
|
||||
return TAG('M', 'l', 'y', 'm');
|
||||
case SBScriptMODI:
|
||||
return TAG('M', 'o', 'd', 'i');
|
||||
case SBScriptMONG:
|
||||
return TAG('M', 'o', 'n', 'g');
|
||||
case SBScriptMROO:
|
||||
return TAG('M', 'r', 'o', 'o');
|
||||
case SBScriptMTEI:
|
||||
return TAG('M', 't', 'e', 'i');
|
||||
case SBScriptMULT:
|
||||
return TAG('M', 'u', 'l', 't');
|
||||
case SBScriptMYMR:
|
||||
return TAG('M', 'y', 'm', 'r');
|
||||
case SBScriptNAGM:
|
||||
return TAG('N', 'a', 'g', 'm');
|
||||
case SBScriptNAND:
|
||||
return TAG('N', 'a', 'n', 'd');
|
||||
case SBScriptNARB:
|
||||
return TAG('N', 'a', 'r', 'b');
|
||||
case SBScriptNBAT:
|
||||
return TAG('N', 'b', 'a', 't');
|
||||
case SBScriptNEWA:
|
||||
return TAG('N', 'e', 'w', 'a');
|
||||
case SBScriptNKOO:
|
||||
return TAG('N', 'k', 'o', 'o');
|
||||
case SBScriptNSHU:
|
||||
return TAG('N', 's', 'h', 'u');
|
||||
case SBScriptOGAM:
|
||||
return TAG('O', 'g', 'a', 'm');
|
||||
case SBScriptOLCK:
|
||||
return TAG('O', 'l', 'c', 'k');
|
||||
case SBScriptONAO:
|
||||
return TAG('O', 'n', 'a', 'o');
|
||||
case SBScriptORKH:
|
||||
return TAG('O', 'r', 'k', 'h');
|
||||
case SBScriptORYA:
|
||||
return TAG('O', 'r', 'y', 'a');
|
||||
case SBScriptOSGE:
|
||||
return TAG('O', 's', 'g', 'e');
|
||||
case SBScriptOSMA:
|
||||
return TAG('O', 's', 'm', 'a');
|
||||
case SBScriptOUGR:
|
||||
return TAG('O', 'u', 'g', 'r');
|
||||
case SBScriptPALM:
|
||||
return TAG('P', 'a', 'l', 'm');
|
||||
case SBScriptPAUC:
|
||||
return TAG('P', 'a', 'u', 'c');
|
||||
case SBScriptPERM:
|
||||
return TAG('P', 'e', 'r', 'm');
|
||||
case SBScriptPHAG:
|
||||
return TAG('P', 'h', 'a', 'g');
|
||||
case SBScriptPHLI:
|
||||
return TAG('P', 'h', 'l', 'i');
|
||||
case SBScriptPHLP:
|
||||
return TAG('P', 'h', 'l', 'p');
|
||||
case SBScriptPHNX:
|
||||
return TAG('P', 'h', 'n', 'x');
|
||||
case SBScriptPLRD:
|
||||
return TAG('P', 'l', 'r', 'd');
|
||||
case SBScriptPRTI:
|
||||
return TAG('P', 'r', 't', 'i');
|
||||
case SBScriptRJNG:
|
||||
return TAG('R', 'j', 'n', 'g');
|
||||
case SBScriptROHG:
|
||||
return TAG('R', 'o', 'h', 'g');
|
||||
case SBScriptRUNR:
|
||||
return TAG('R', 'u', 'n', 'r');
|
||||
case SBScriptSAMR:
|
||||
return TAG('S', 'a', 'm', 'r');
|
||||
case SBScriptSARB:
|
||||
return TAG('S', 'a', 'r', 'b');
|
||||
case SBScriptSAUR:
|
||||
return TAG('S', 'a', 'u', 'r');
|
||||
case SBScriptSGNW:
|
||||
return TAG('S', 'g', 'n', 'w');
|
||||
case SBScriptSHAW:
|
||||
return TAG('S', 'h', 'a', 'w');
|
||||
case SBScriptSHRD:
|
||||
return TAG('S', 'h', 'r', 'd');
|
||||
case SBScriptSIDD:
|
||||
return TAG('S', 'i', 'd', 'd');
|
||||
case SBScriptSIND:
|
||||
return TAG('S', 'i', 'n', 'd');
|
||||
case SBScriptSINH:
|
||||
return TAG('S', 'i', 'n', 'h');
|
||||
case SBScriptSOGD:
|
||||
return TAG('S', 'o', 'g', 'd');
|
||||
case SBScriptSOGO:
|
||||
return TAG('S', 'o', 'g', 'o');
|
||||
case SBScriptSORA:
|
||||
return TAG('S', 'o', 'r', 'a');
|
||||
case SBScriptSOYO:
|
||||
return TAG('S', 'o', 'y', 'o');
|
||||
case SBScriptSUND:
|
||||
return TAG('S', 'u', 'n', 'd');
|
||||
case SBScriptSUNU:
|
||||
return TAG('S', 'u', 'n', 'u');
|
||||
case SBScriptSYLO:
|
||||
return TAG('S', 'y', 'l', 'o');
|
||||
case SBScriptSYRC:
|
||||
return TAG('S', 'y', 'r', 'c');
|
||||
case SBScriptTAGB:
|
||||
return TAG('T', 'a', 'g', 'b');
|
||||
case SBScriptTAKR:
|
||||
return TAG('T', 'a', 'k', 'r');
|
||||
case SBScriptTALE:
|
||||
return TAG('T', 'a', 'l', 'e');
|
||||
case SBScriptTALU:
|
||||
return TAG('T', 'a', 'l', 'u');
|
||||
case SBScriptTAML:
|
||||
return TAG('T', 'a', 'm', 'l');
|
||||
case SBScriptTANG:
|
||||
return TAG('T', 'a', 'n', 'g');
|
||||
case SBScriptTAVT:
|
||||
return TAG('T', 'a', 'v', 't');
|
||||
case SBScriptTELU:
|
||||
return TAG('T', 'e', 'l', 'u');
|
||||
case SBScriptTFNG:
|
||||
return TAG('T', 'f', 'n', 'g');
|
||||
case SBScriptTGLG:
|
||||
return TAG('T', 'g', 'l', 'g');
|
||||
case SBScriptTHAA:
|
||||
return TAG('T', 'h', 'a', 'a');
|
||||
case SBScriptTHAI:
|
||||
return TAG('T', 'h', 'a', 'i');
|
||||
case SBScriptTIBT:
|
||||
return TAG('T', 'i', 'b', 't');
|
||||
case SBScriptTIRH:
|
||||
return TAG('T', 'i', 'r', 'h');
|
||||
case SBScriptTNSA:
|
||||
return TAG('T', 'n', 's', 'a');
|
||||
case SBScriptTODR:
|
||||
return TAG('T', 'o', 'd', 'r');
|
||||
case SBScriptTOTO:
|
||||
return TAG('T', 'o', 't', 'o');
|
||||
case SBScriptTUTG:
|
||||
return TAG('T', 'u', 't', 'g');
|
||||
case SBScriptUGAR:
|
||||
return TAG('U', 'g', 'a', 'r');
|
||||
case SBScriptVAII:
|
||||
return TAG('V', 'a', 'i', 'i');
|
||||
case SBScriptVITH:
|
||||
return TAG('V', 'i', 't', 'h');
|
||||
case SBScriptWARA:
|
||||
return TAG('W', 'a', 'r', 'a');
|
||||
case SBScriptWCHO:
|
||||
return TAG('W', 'c', 'h', 'o');
|
||||
case SBScriptXPEO:
|
||||
return TAG('X', 'p', 'e', 'o');
|
||||
case SBScriptXSUX:
|
||||
return TAG('X', 's', 'u', 'x');
|
||||
case SBScriptYEZI:
|
||||
return TAG('Y', 'e', 'z', 'i');
|
||||
case SBScriptYIII:
|
||||
return TAG('Y', 'i', 'i', 'i');
|
||||
case SBScriptZANB:
|
||||
return TAG('Z', 'a', 'n', 'b');
|
||||
case SBScriptZINH:
|
||||
return TAG('Z', 'i', 'n', 'h');
|
||||
case SBScriptZYYY:
|
||||
return TAG('Z', 'y', 'y', 'y');
|
||||
case SBScriptZZZZ:
|
||||
return TAG('Z', 'z', 'z', 'z');
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
const char *SBVersionGetString(void)
|
||||
{
|
||||
return LibraryVersion;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2016-2019 Muhammad Tayyab Akram
|
||||
* Copyright (C) 2016-2025 Muhammad Tayyab Akram
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -17,12 +17,10 @@
|
|||
#ifndef _SB_INTERNAL_BASE_H
|
||||
#define _SB_INTERNAL_BASE_H
|
||||
|
||||
#include <juce_graphics/unicode/sheenbidi/Headers/SBBase.h>
|
||||
#include <juce_graphics/unicode/sheenbidi/Headers/SBBidiType.h>
|
||||
#include <juce_graphics/unicode/sheenbidi/Headers/SBCodepoint.h>
|
||||
#include <juce_graphics/unicode/sheenbidi/Headers/SBConfig.h>
|
||||
#include <juce_graphics/unicode/sheenbidi/Headers/SBGeneralCategory.h>
|
||||
#include <juce_graphics/unicode/sheenbidi/Headers/SBScript.h>
|
||||
#include <SheenBidi/SBBase.h>
|
||||
#include <SheenBidi/SBBidiType.h>
|
||||
#include <SheenBidi/SBConfig.h>
|
||||
#include <SheenBidi/SBScript.h>
|
||||
|
||||
/**
|
||||
* A value that indicates an invalid unsigned index.
|
||||
|
|
@ -96,13 +94,6 @@ SB_INTERNAL SBBoolean SBUIntegerVerifyRange(SBUInteger actualLength,
|
|||
#define SBBidiTypeIsIsolateTerminator(t) SBBidiTypeIsEqual(t, SBBidiTypePDI)
|
||||
#define SBBidiTypeIsNeutralOrIsolate(t) SBUInt8InRange(t, SBBidiTypeWS, SBBidiTypePDI)
|
||||
|
||||
|
||||
#define SBCodepointMax 0x10FFFF
|
||||
#define SBCodepointInRange(v, s, e) SBUInt32InRange(v, s, e)
|
||||
#define SBCodepointIsSurrogate(c) SBCodepointInRange(c, 0xD800, 0xDFFF)
|
||||
#define SBCodepointIsValid(c) (!SBCodepointIsSurrogate(c) && (c) <= SBCodepointMax)
|
||||
|
||||
|
||||
#define SBScriptIsCommonOrInherited(s) ((s) <= SBScriptZYYY)
|
||||
|
||||
#endif
|
||||
|
|
|
|||
250
modules/juce_graphics/unicode/sheenbidi/Source/SBCodepoint.c
Normal file
250
modules/juce_graphics/unicode/sheenbidi/Source/SBCodepoint.c
Normal file
|
|
@ -0,0 +1,250 @@
|
|||
/*
|
||||
* Copyright (C) 2025 Muhammad Tayyab Akram
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <SheenBidi/SBBase.h>
|
||||
#include <SheenBidi/SBConfig.h>
|
||||
|
||||
#include "BidiTypeLookup.h"
|
||||
#include "GeneralCategoryLookup.h"
|
||||
#include "PairingLookup.h"
|
||||
#include "ScriptLookup.h"
|
||||
#include "SBCodepoint.h"
|
||||
|
||||
typedef struct {
|
||||
SBUInt8 valid;
|
||||
SBUInt8 total;
|
||||
SBUInt8 start;
|
||||
SBUInt8 end;
|
||||
} UTF8State;
|
||||
|
||||
static const UTF8State UTF8StateTable[9] = {
|
||||
{ 1, 0, 0x00, 0x00 }, { 0, 0, 0x00, 0x00 }, { 1, 2, 0x80, 0xBF }, { 1, 3, 0xA0, 0xBF },
|
||||
{ 1, 3, 0x80, 0xBF }, { 1, 3, 0x80, 0x9F }, { 1, 4, 0x90, 0xBF }, { 1, 4, 0x80, 0xBF },
|
||||
{ 1, 4, 0x80, 0x8F }
|
||||
};
|
||||
|
||||
static const SBUInt8 UTF8LookupTable[256] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/* LEAD: -- 80..BF -- */
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
/* LEAD: -- C0..C1 -- */
|
||||
1, 1,
|
||||
/* LEAD: -- C2..DF -- */
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
/* LEAD: -- E0..E0 -- */
|
||||
3,
|
||||
/* LEAD: -- E1..EC -- */
|
||||
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
|
||||
/* LEAD: -- ED..ED -- */
|
||||
5,
|
||||
/* LEAD: -- EE..EF -- */
|
||||
4, 4,
|
||||
/* LEAD: -- F0..F0 -- */
|
||||
6,
|
||||
/* LEAD: -- F1..F3 -- */
|
||||
7, 7, 7,
|
||||
/* LEAD: -- F4..F4 -- */
|
||||
8,
|
||||
/* LEAD: -- F5..F7 -- */
|
||||
1, 1, 1,
|
||||
/* LEAD: -- F8..FB -- */
|
||||
1, 1, 1, 1,
|
||||
/* LEAD: -- FC..FD -- */
|
||||
1, 1,
|
||||
/* LEAD: -- FE..FF -- */
|
||||
1, 1
|
||||
};
|
||||
|
||||
SB_INTERNAL SBBoolean SBCodepointIsCanonicalEquivalentBracket(
|
||||
SBCodepoint codepoint, SBCodepoint bracket)
|
||||
{
|
||||
SBCodepoint canonical;
|
||||
|
||||
switch (codepoint) {
|
||||
case 0x2329:
|
||||
canonical = 0x3008;
|
||||
break;
|
||||
case 0x3008:
|
||||
canonical = 0x2329;
|
||||
break;
|
||||
|
||||
case 0x232A:
|
||||
canonical = 0x3009;
|
||||
break;
|
||||
case 0x3009:
|
||||
canonical = 0x232A;
|
||||
break;
|
||||
|
||||
default:
|
||||
canonical = codepoint;
|
||||
break;
|
||||
}
|
||||
|
||||
return bracket == codepoint || bracket == canonical;
|
||||
}
|
||||
|
||||
SBBidiType SBCodepointGetBidiType(SBCodepoint codepoint)
|
||||
{
|
||||
return LookupBidiType(codepoint);
|
||||
}
|
||||
|
||||
SBGeneralCategory SBCodepointGetGeneralCategory(SBCodepoint codepoint)
|
||||
{
|
||||
return LookupGeneralCategory(codepoint);
|
||||
}
|
||||
|
||||
SBCodepoint SBCodepointGetMirror(SBCodepoint codepoint)
|
||||
{
|
||||
return LookupMirror(codepoint);
|
||||
}
|
||||
|
||||
SBScript SBCodepointGetScript(SBCodepoint codepoint)
|
||||
{
|
||||
return LookupScript(codepoint);
|
||||
}
|
||||
|
||||
SBCodepoint SBCodepointDecodeNextFromUTF8(const SBUInt8 *buffer, SBUInteger length, SBUInteger *index)
|
||||
{
|
||||
SBCodepoint codepoint = SBCodepointInvalid;
|
||||
|
||||
if (*index < length) {
|
||||
SBUInt8 lead = buffer[*index];
|
||||
UTF8State state = UTF8StateTable[UTF8LookupTable[lead]];
|
||||
SBUInteger limit = *index + state.total;
|
||||
|
||||
if (limit > length) {
|
||||
limit = length;
|
||||
state.valid = SBFalse;
|
||||
}
|
||||
|
||||
codepoint = lead & (0x7F >> state.total);
|
||||
|
||||
while (++(*index) < limit) {
|
||||
SBUInt8 byte = buffer[*index];
|
||||
|
||||
if (byte >= state.start && byte <= state.end) {
|
||||
codepoint = (codepoint << 6) | (byte & 0x3F);
|
||||
} else {
|
||||
state.valid = SBFalse;
|
||||
break;
|
||||
}
|
||||
|
||||
state.start = 0x80;
|
||||
state.end = 0xBF;
|
||||
}
|
||||
|
||||
if (!state.valid) {
|
||||
codepoint = SBCodepointFaulty;
|
||||
}
|
||||
}
|
||||
|
||||
return codepoint;
|
||||
}
|
||||
|
||||
SBCodepoint SBCodepointDecodePreviousFromUTF8(const SBUInt8 *buffer, SBUInteger length, SBUInteger *index)
|
||||
{
|
||||
SBCodepoint codepoint = SBCodepointInvalid;
|
||||
|
||||
if ((*index - 1) < length) {
|
||||
SBUInteger startIndex = *index;
|
||||
SBUInteger limitIndex;
|
||||
SBUInteger continuation;
|
||||
|
||||
continuation = 4;
|
||||
|
||||
while (continuation-- && --startIndex) {
|
||||
SBUInt8 codeUnit = buffer[startIndex];
|
||||
|
||||
if ((codeUnit & 0xC0) != 0x80) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
limitIndex = startIndex;
|
||||
codepoint = SBCodepointDecodeNextFromUTF8(buffer, length, &limitIndex);
|
||||
|
||||
if (limitIndex == *index) {
|
||||
*index = startIndex;
|
||||
} else {
|
||||
codepoint = SBCodepointFaulty;
|
||||
*index -= 1;
|
||||
}
|
||||
}
|
||||
|
||||
return codepoint;
|
||||
}
|
||||
|
||||
SBCodepoint SBCodepointDecodeNextFromUTF16(const SBUInt16 *buffer, SBUInteger length, SBUInteger *index)
|
||||
{
|
||||
SBCodepoint codepoint = SBCodepointInvalid;
|
||||
|
||||
if (*index < length) {
|
||||
SBUInt16 lead;
|
||||
|
||||
codepoint = SBCodepointFaulty;
|
||||
|
||||
lead = buffer[*index];
|
||||
*index += 1;
|
||||
|
||||
if (!SBCodepointIsSurrogate(lead)) {
|
||||
codepoint = lead;
|
||||
} else if (lead <= 0xDBFF) {
|
||||
if (*index < length) {
|
||||
SBUInt16 trail = buffer[*index];
|
||||
|
||||
if (SBUInt16InRange(trail, 0xDC00, 0xDFFF)) {
|
||||
codepoint = (lead << 10) + trail - ((0xD800 << 10) + 0xDC00 - 0x10000);
|
||||
*index += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return codepoint;
|
||||
}
|
||||
|
||||
SBCodepoint SBCodepointDecodePreviousFromUTF16(const SBUInt16 *buffer, SBUInteger length, SBUInteger *index)
|
||||
{
|
||||
SBCodepoint codepoint = SBCodepointInvalid;
|
||||
|
||||
if ((*index - 1) < length) {
|
||||
SBUInt16 trail;
|
||||
|
||||
codepoint = SBCodepointFaulty;
|
||||
|
||||
*index -= 1;
|
||||
trail = buffer[*index];
|
||||
|
||||
if (!SBCodepointIsSurrogate(trail)) {
|
||||
codepoint = trail;
|
||||
} else if (trail >= 0xDC00) {
|
||||
if (*index > 0) {
|
||||
SBUInt16 lead = buffer[*index - 1];
|
||||
|
||||
if (SBUInt16InRange(lead, 0xD800, 0xDBFF)) {
|
||||
codepoint = (lead << 10) + trail - ((0xD800 << 10) + 0xDC00 - 0x10000);
|
||||
*index -= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return codepoint;
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2014-2018 Muhammad Tayyab Akram
|
||||
* Copyright (C) 2025 Muhammad Tayyab Akram
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -14,20 +14,13 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef _SHEEN_BIDI_H
|
||||
#define _SHEEN_BIDI_H
|
||||
#ifndef _SB_INTERNAL_CODEPOINT_H
|
||||
#define _SB_INTERNAL_CODEPOINT_H
|
||||
|
||||
#include "SBAlgorithm.h"
|
||||
#include "SBBase.h"
|
||||
#include "SBBidiType.h"
|
||||
#include "SBCodepoint.h"
|
||||
#include "SBCodepointSequence.h"
|
||||
#include "SBGeneralCategory.h"
|
||||
#include "SBLine.h"
|
||||
#include "SBMirrorLocator.h"
|
||||
#include "SBParagraph.h"
|
||||
#include "SBRun.h"
|
||||
#include "SBScript.h"
|
||||
#include "SBScriptLocator.h"
|
||||
#include <SheenBidi/SBCodepoint.h>
|
||||
#include <SheenBidi/SBConfig.h>
|
||||
|
||||
SB_INTERNAL SBBoolean SBCodepointIsCanonicalEquivalentBracket(
|
||||
SBCodepoint codepoint, SBCodepoint bracket);
|
||||
|
||||
#endif
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2016-2019 Muhammad Tayyab Akram
|
||||
* Copyright (C) 2016-2025 Muhammad Tayyab Akram
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -14,72 +14,12 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <juce_graphics/unicode/sheenbidi/Headers/SBConfig.h>
|
||||
#include <SheenBidi/SBConfig.h>
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "SBAssert.h"
|
||||
#include "SBBase.h"
|
||||
#include "SBCodepoint.h"
|
||||
#include "SBCodepointSequence.h"
|
||||
|
||||
typedef struct {
|
||||
SBUInt8 valid;
|
||||
SBUInt8 total;
|
||||
SBUInt8 start;
|
||||
SBUInt8 end;
|
||||
} UTF8State;
|
||||
|
||||
static const UTF8State UTF8StateTable[9] = {
|
||||
{1,0,0x00,0x00}, {0,0,0x00,0x00}, {1,2,0x80,0xBF}, {1,3,0xA0,0xBF}, {1,3,0x80,0xBF},
|
||||
{1,3,0x80,0x9F}, {1,4,0x90,0xBF}, {1,4,0x80,0xBF}, {1,4,0x80,0x8F}
|
||||
};
|
||||
|
||||
static const SBUInt8 UTF8LookupTable[256] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/* LEAD: -- 80..BF -- */
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1,
|
||||
/* LEAD: -- C0..C1 -- */
|
||||
1, 1,
|
||||
/* LEAD: -- C2..DF -- */
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
/* LEAD: -- E0..E0 -- */
|
||||
3,
|
||||
/* LEAD: -- E1..EC -- */
|
||||
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
|
||||
/* LEAD: -- ED..ED -- */
|
||||
5,
|
||||
/* LEAD: -- EE..EF -- */
|
||||
4, 4,
|
||||
/* LEAD: -- F0..F0 -- */
|
||||
6,
|
||||
/* LEAD: -- F1..F3 -- */
|
||||
7, 7, 7,
|
||||
/* LEAD: -- F4..F4 -- */
|
||||
8,
|
||||
/* LEAD: -- F5..F7 -- */
|
||||
1, 1, 1,
|
||||
/* LEAD: -- F8..FB -- */
|
||||
1, 1, 1, 1,
|
||||
/* LEAD: -- FC..FD -- */
|
||||
1, 1,
|
||||
/* LEAD: -- FE..FF -- */
|
||||
1, 1
|
||||
};
|
||||
|
||||
static SBCodepoint GetUTF8CodepointAt(const SBCodepointSequence *codepointSequence, SBUInteger *stringIndex);
|
||||
static SBCodepoint GetUTF8CodepointBefore(const SBCodepointSequence *codepointSequence, SBUInteger *stringIndex);
|
||||
static SBCodepoint GetUTF16CodepointAt(const SBCodepointSequence *codepointSequence, SBUInteger *stringIndex);
|
||||
static SBCodepoint GetUTF16CodepointBefore(const SBCodepointSequence *codepointSequence, SBUInteger *stringIndex);
|
||||
static SBCodepoint GetUTF32CodepointAt(const SBCodepointSequence *codepointSequence, SBUInteger *stringIndex);
|
||||
static SBCodepoint GetUTF32CodepointBefore(const SBCodepointSequence *codepointSequence, SBUInteger *stringIndex);
|
||||
|
||||
SB_INTERNAL SBBoolean SBCodepointSequenceIsValid(const SBCodepointSequence *codepointSequence)
|
||||
{
|
||||
if (codepointSequence) {
|
||||
|
|
@ -103,20 +43,27 @@ SBCodepoint SBCodepointSequenceGetCodepointBefore(const SBCodepointSequence *cod
|
|||
{
|
||||
SBCodepoint codepoint = SBCodepointInvalid;
|
||||
|
||||
if ((*stringIndex - 1) < codepointSequence->stringLength) {
|
||||
switch (codepointSequence->stringEncoding) {
|
||||
case SBStringEncodingUTF8:
|
||||
codepoint = GetUTF8CodepointBefore(codepointSequence, stringIndex);
|
||||
break;
|
||||
switch (codepointSequence->stringEncoding) {
|
||||
case SBStringEncodingUTF8:
|
||||
codepoint = SBCodepointDecodePreviousFromUTF8(codepointSequence->stringBuffer, codepointSequence->stringLength, stringIndex);
|
||||
break;
|
||||
|
||||
case SBStringEncodingUTF16:
|
||||
codepoint = GetUTF16CodepointBefore(codepointSequence, stringIndex);
|
||||
break;
|
||||
case SBStringEncodingUTF16:
|
||||
codepoint = SBCodepointDecodePreviousFromUTF16(codepointSequence->stringBuffer, codepointSequence->stringLength, stringIndex);
|
||||
break;
|
||||
|
||||
case SBStringEncodingUTF32:
|
||||
codepoint = GetUTF32CodepointBefore(codepointSequence, stringIndex);
|
||||
break;
|
||||
case SBStringEncodingUTF32:
|
||||
if ((*stringIndex - 1) < codepointSequence->stringLength) {
|
||||
const SBUInt32 *buffer = codepointSequence->stringBuffer;
|
||||
|
||||
*stringIndex -= 1;
|
||||
codepoint = buffer[*stringIndex];
|
||||
|
||||
if (!SBCodepointIsValid(codepoint)) {
|
||||
codepoint = SBCodepointFaulty;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return codepoint;
|
||||
|
|
@ -126,178 +73,28 @@ SBCodepoint SBCodepointSequenceGetCodepointAt(const SBCodepointSequence *codepoi
|
|||
{
|
||||
SBCodepoint codepoint = SBCodepointInvalid;
|
||||
|
||||
if (*stringIndex < codepointSequence->stringLength) {
|
||||
switch (codepointSequence->stringEncoding) {
|
||||
case SBStringEncodingUTF8:
|
||||
codepoint = GetUTF8CodepointAt(codepointSequence, stringIndex);
|
||||
break;
|
||||
switch (codepointSequence->stringEncoding) {
|
||||
case SBStringEncodingUTF8:
|
||||
codepoint = SBCodepointDecodeNextFromUTF8(codepointSequence->stringBuffer, codepointSequence->stringLength, stringIndex);
|
||||
break;
|
||||
|
||||
case SBStringEncodingUTF16:
|
||||
codepoint = GetUTF16CodepointAt(codepointSequence, stringIndex);
|
||||
break;
|
||||
case SBStringEncodingUTF16:
|
||||
codepoint = SBCodepointDecodeNextFromUTF16(codepointSequence->stringBuffer, codepointSequence->stringLength, stringIndex);
|
||||
break;
|
||||
|
||||
case SBStringEncodingUTF32:
|
||||
codepoint = GetUTF32CodepointAt(codepointSequence, stringIndex);
|
||||
break;
|
||||
}
|
||||
}
|
||||
case SBStringEncodingUTF32:
|
||||
if (*stringIndex < codepointSequence->stringLength) {
|
||||
const SBUInt32 *buffer = codepointSequence->stringBuffer;
|
||||
|
||||
return codepoint;
|
||||
}
|
||||
codepoint = buffer[*stringIndex];
|
||||
*stringIndex += 1;
|
||||
|
||||
static SBCodepoint GetUTF8CodepointAt(const SBCodepointSequence *sequence, SBUInteger *index)
|
||||
{
|
||||
const SBUInt8 *buffer = sequence->stringBuffer;
|
||||
SBUInteger length = sequence->stringLength;
|
||||
SBUInt8 lead;
|
||||
UTF8State state;
|
||||
SBUInteger limit;
|
||||
SBCodepoint codepoint;
|
||||
|
||||
lead = buffer[*index];
|
||||
state = UTF8StateTable[UTF8LookupTable[lead]];
|
||||
limit = *index + state.total;
|
||||
|
||||
if (limit > length) {
|
||||
limit = length;
|
||||
state.valid = SBFalse;
|
||||
}
|
||||
|
||||
codepoint = lead & (0x7F >> state.total);
|
||||
|
||||
while (++(*index) < limit) {
|
||||
SBUInt8 byte = buffer[*index];
|
||||
|
||||
if (byte >= state.start && byte <= state.end) {
|
||||
codepoint = (codepoint << 6) | (byte & 0x3F);
|
||||
} else {
|
||||
state.valid = SBFalse;
|
||||
break;
|
||||
}
|
||||
|
||||
state.start = 0x80;
|
||||
state.end = 0xBF;
|
||||
}
|
||||
|
||||
if (state.valid) {
|
||||
return codepoint;
|
||||
}
|
||||
|
||||
return SBCodepointFaulty;
|
||||
}
|
||||
|
||||
static SBCodepoint GetUTF8CodepointBefore(const SBCodepointSequence *sequence, SBUInteger *index)
|
||||
{
|
||||
const SBUInt8 *buffer = sequence->stringBuffer;
|
||||
SBUInteger startIndex = *index;
|
||||
SBUInteger limitIndex;
|
||||
SBUInteger continuation;
|
||||
SBCodepoint codepoint;
|
||||
|
||||
continuation = 7;
|
||||
|
||||
while (--continuation && --startIndex) {
|
||||
SBUInt8 codeunit = buffer[startIndex];
|
||||
|
||||
if ((codeunit & 0xC0) != 0x80) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
limitIndex = startIndex;
|
||||
codepoint = GetUTF8CodepointAt(sequence, &limitIndex);
|
||||
|
||||
if (limitIndex == *index) {
|
||||
*index = startIndex;
|
||||
} else {
|
||||
codepoint = SBCodepointFaulty;
|
||||
*index -= 1;
|
||||
}
|
||||
|
||||
return codepoint;
|
||||
}
|
||||
|
||||
static SBCodepoint GetUTF16CodepointAt(const SBCodepointSequence *sequence, SBUInteger *index)
|
||||
{
|
||||
const SBUInt16 *buffer = sequence->stringBuffer;
|
||||
SBUInteger length = sequence->stringLength;
|
||||
SBCodepoint codepoint;
|
||||
SBUInt16 lead;
|
||||
|
||||
codepoint = SBCodepointFaulty;
|
||||
|
||||
lead = buffer[*index];
|
||||
*index += 1;
|
||||
|
||||
if (!SBCodepointIsSurrogate(lead)) {
|
||||
codepoint = lead;
|
||||
} else if (lead <= 0xDBFF) {
|
||||
if (*index < length) {
|
||||
SBUInt16 trail = buffer[*index];
|
||||
|
||||
if (SBUInt16InRange(trail, 0xDC00, 0xDFFF)) {
|
||||
codepoint = (lead << 10) + trail - ((0xD800 << 10) + 0xDC00 - 0x10000);
|
||||
*index += 1;
|
||||
if (!SBCodepointIsValid(codepoint)) {
|
||||
codepoint = SBCodepointFaulty;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return codepoint;
|
||||
}
|
||||
|
||||
static SBCodepoint GetUTF16CodepointBefore(const SBCodepointSequence *sequence, SBUInteger *index)
|
||||
{
|
||||
const SBUInt16 *buffer = sequence->stringBuffer;
|
||||
SBCodepoint codepoint;
|
||||
SBUInt16 trail;
|
||||
|
||||
codepoint = SBCodepointFaulty;
|
||||
|
||||
*index -= 1;
|
||||
trail = buffer[*index];
|
||||
|
||||
if (!SBCodepointIsSurrogate(trail)) {
|
||||
codepoint = trail;
|
||||
} else if (trail >= 0xDC00) {
|
||||
if (*index > 0) {
|
||||
SBUInt16 lead = buffer[*index - 1];
|
||||
|
||||
if (SBUInt16InRange(lead, 0xD800, 0xDBFF)) {
|
||||
codepoint = (lead << 10) + trail - ((0xD800 << 10) + 0xDC00 - 0x10000);
|
||||
*index -= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return codepoint;
|
||||
}
|
||||
|
||||
static SBCodepoint GetUTF32CodepointAt(const SBCodepointSequence *sequence, SBUInteger *index)
|
||||
{
|
||||
const SBUInt32 *buffer = sequence->stringBuffer;
|
||||
SBCodepoint codepoint;
|
||||
|
||||
codepoint = buffer[*index];
|
||||
*index += 1;
|
||||
|
||||
if (SBCodepointIsValid(codepoint)) {
|
||||
return codepoint;
|
||||
}
|
||||
|
||||
return SBCodepointFaulty;
|
||||
}
|
||||
|
||||
static SBCodepoint GetUTF32CodepointBefore(const SBCodepointSequence *sequence, SBUInteger *index)
|
||||
{
|
||||
const SBUInt32 *buffer = sequence->stringBuffer;
|
||||
SBCodepoint codepoint;
|
||||
|
||||
*index -= 1;
|
||||
codepoint = buffer[*index];
|
||||
|
||||
if (SBCodepointIsValid(codepoint)) {
|
||||
return codepoint;
|
||||
}
|
||||
|
||||
return SBCodepointFaulty;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2016 Muhammad Tayyab Akram
|
||||
* Copyright (C) 2016-2025 Muhammad Tayyab Akram
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -17,8 +17,9 @@
|
|||
#ifndef _SB_INTERNAL_CODEPOINT_SEQUENCE_H
|
||||
#define _SB_INTERNAL_CODEPOINT_SEQUENCE_H
|
||||
|
||||
#include <juce_graphics/unicode/sheenbidi/Headers/SBConfig.h>
|
||||
#include <juce_graphics/unicode/sheenbidi/Headers/SBCodepointSequence.h>
|
||||
#include <SheenBidi/SBBase.h>
|
||||
#include <SheenBidi/SBCodepointSequence.h>
|
||||
#include <SheenBidi/SBConfig.h>
|
||||
|
||||
SB_INTERNAL SBBoolean SBCodepointSequenceIsValid(const SBCodepointSequence *codepointSequence);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2014-2022 Muhammad Tayyab Akram
|
||||
* Copyright (C) 2014-2025 Muhammad Tayyab Akram
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -14,12 +14,12 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <juce_graphics/unicode/sheenbidi/Headers/SBConfig.h>
|
||||
#include <juce_graphics/unicode/sheenbidi/Headers/SBRun.h>
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <SheenBidi/SBConfig.h>
|
||||
#include <SheenBidi/SBRun.h>
|
||||
|
||||
#include "Object.h"
|
||||
#include "PairingLookup.h"
|
||||
#include "SBAlgorithm.h"
|
||||
#include "SBAssert.h"
|
||||
|
|
@ -29,22 +29,91 @@
|
|||
#include "SBLine.h"
|
||||
|
||||
typedef struct _LineContext {
|
||||
Object object;
|
||||
const SBBidiType *refTypes;
|
||||
SBLevel *fixedLevels;
|
||||
SBUInteger runCount;
|
||||
SBLevel maxLevel;
|
||||
} LineContext, *LineContextRef;
|
||||
|
||||
static SBLevel CopyLevels(SBLevel *destination,
|
||||
const SBLevel *source, SBUInteger length, SBUInteger *runCount);
|
||||
static void ResetLevels(LineContextRef context, SBLevel baseLevel, SBUInteger charCount);
|
||||
|
||||
#define LEVELS 0
|
||||
#define COUNT 1
|
||||
|
||||
static SBBoolean InitializeLineContext(LineContextRef context,
|
||||
const SBBidiType *types, const SBLevel *levels, SBUInteger length, SBLevel baseLevel)
|
||||
{
|
||||
SBBoolean isInitialized = SBFalse;
|
||||
void *pointers[COUNT] = { NULL };
|
||||
SBUInteger sizes[COUNT];
|
||||
|
||||
sizes[LEVELS] = sizeof(SBLevel) * length;
|
||||
|
||||
ObjectInitialize(&context->object);
|
||||
|
||||
if (ObjectAddMemoryWithChunks(&context->object, sizes, COUNT, pointers)) {
|
||||
SBLevel *fixedLevels = pointers[LEVELS];
|
||||
|
||||
context->refTypes = types;
|
||||
context->fixedLevels = fixedLevels;
|
||||
context->maxLevel = CopyLevels(fixedLevels, levels, length, &context->runCount);
|
||||
|
||||
ResetLevels(context, baseLevel, length);
|
||||
|
||||
isInitialized = SBTrue;
|
||||
}
|
||||
|
||||
return isInitialized;
|
||||
}
|
||||
|
||||
#undef LEVELS
|
||||
#undef COUNT
|
||||
|
||||
static void FinalizeLineContext(LineContextRef context)
|
||||
{
|
||||
ObjectFinalize(&context->object);
|
||||
}
|
||||
|
||||
#define LINE 0
|
||||
#define RUNS 1
|
||||
#define COUNT 2
|
||||
|
||||
static SBLineRef AllocateLine(SBUInteger runCount)
|
||||
{
|
||||
void *pointers[COUNT] = { NULL };
|
||||
SBUInteger sizes[COUNT];
|
||||
|
||||
sizes[LINE] = sizeof(SBLine);
|
||||
sizes[RUNS] = sizeof(SBRun) * runCount;
|
||||
|
||||
if (runCount > 0 && ObjectCreate(sizes, COUNT, pointers)) {
|
||||
SBLineRef line = pointers[LINE];
|
||||
SBRun *runs = pointers[RUNS];
|
||||
|
||||
line->fixedRuns = runs;
|
||||
}
|
||||
|
||||
return pointers[LINE];
|
||||
}
|
||||
|
||||
#undef LINE
|
||||
#undef RUNS
|
||||
#undef COUNT
|
||||
|
||||
static SBLevel CopyLevels(SBLevel *destination,
|
||||
const SBLevel *source, SBUInteger length, SBUInteger *runCount)
|
||||
{
|
||||
SBLevel lastLevel = SBLevelInvalid;
|
||||
SBLevel maxLevel = 0;
|
||||
SBUInteger totalRuns = 0;
|
||||
SBUInteger index;
|
||||
|
||||
while (length--) {
|
||||
SBLevel level = *(source++);
|
||||
*(destination++) = level;
|
||||
for (index = 0; index < length; index++) {
|
||||
SBLevel level = source[index];
|
||||
destination[index] = level;
|
||||
|
||||
if (level != lastLevel) {
|
||||
totalRuns += 1;
|
||||
|
|
@ -60,66 +129,11 @@ static SBLevel CopyLevels(SBLevel *destination,
|
|||
return maxLevel;
|
||||
}
|
||||
|
||||
static LineContextRef CreateLineContext(const SBBidiType *types, const SBLevel *levels, SBUInteger length)
|
||||
{
|
||||
const SBUInteger sizeContext = sizeof(LineContext);
|
||||
const SBUInteger sizeLevels = sizeof(SBLevel) * length;
|
||||
const SBUInteger sizeMemory = sizeContext + sizeLevels;
|
||||
|
||||
void *pointer = malloc(sizeMemory);
|
||||
|
||||
if (pointer) {
|
||||
const SBUInteger offsetContext = 0;
|
||||
const SBUInteger offsetLevels = offsetContext + sizeContext;
|
||||
|
||||
SBUInt8 *memory = (SBUInt8 *)pointer;
|
||||
LineContextRef context = (LineContextRef)(memory + offsetContext);
|
||||
SBLevel *fixedLevels = (SBLevel *)(memory + offsetLevels);
|
||||
|
||||
context->refTypes = types;
|
||||
context->fixedLevels = fixedLevels;
|
||||
context->maxLevel = CopyLevels(fixedLevels, levels, length, &context->runCount);
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void DisposeLineContext(LineContextRef context)
|
||||
{
|
||||
free(context);
|
||||
}
|
||||
|
||||
static SBLineRef AllocateLine(SBUInteger runCount)
|
||||
{
|
||||
const SBUInteger sizeLine = sizeof(SBLine);
|
||||
const SBUInteger sizeRuns = sizeof(SBRun) * runCount;
|
||||
const SBUInteger sizeMemory = sizeLine + sizeRuns;
|
||||
|
||||
void *pointer = malloc(sizeMemory);
|
||||
|
||||
if (pointer) {
|
||||
const SBUInteger offsetLine = 0;
|
||||
const SBUInteger offsetRuns = offsetLine + sizeLine;
|
||||
|
||||
SBUInt8 *memory = (SBUInt8 *)pointer;
|
||||
SBLineRef line = (SBLineRef)(memory + offsetLine);
|
||||
SBRun *runs = (SBRun *)(memory + offsetRuns);
|
||||
|
||||
line->fixedRuns = runs;
|
||||
|
||||
return line;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void SetNewLevel(SBLevel *levels, SBUInteger length, SBLevel newLevel)
|
||||
{
|
||||
SBUInteger index = length;
|
||||
SBUInteger index;
|
||||
|
||||
while (index--) {
|
||||
for (index = 0; index < length; index++) {
|
||||
levels[index] = newLevel;
|
||||
}
|
||||
}
|
||||
|
|
@ -181,29 +195,27 @@ static void ResetLevels(LineContextRef context, SBLevel baseLevel, SBUInteger ch
|
|||
static SBUInteger InitializeRuns(SBRun *runs,
|
||||
const SBLevel *levels, SBUInteger length, SBUInteger lineOffset)
|
||||
{
|
||||
SBUInteger runIndex = 0;
|
||||
SBUInteger index;
|
||||
SBUInteger runCount = 1;
|
||||
|
||||
(*runs).offset = lineOffset;
|
||||
(*runs).level = levels[0];
|
||||
runs[runIndex].offset = lineOffset;
|
||||
runs[runIndex].level = levels[0];
|
||||
|
||||
for (index = 0; index < length; index++) {
|
||||
SBLevel level = levels[index];
|
||||
|
||||
if (level != (*runs).level) {
|
||||
(*runs).length = index + lineOffset - (*runs).offset;
|
||||
if (level != runs[runIndex].level) {
|
||||
runs[runIndex].length = index + lineOffset - runs[runIndex].offset;
|
||||
|
||||
++runs;
|
||||
(*runs).offset = lineOffset + index;
|
||||
(*runs).level = level;
|
||||
|
||||
runCount += 1;
|
||||
runIndex += 1;
|
||||
runs[runIndex].offset = lineOffset + index;
|
||||
runs[runIndex].level = level;
|
||||
}
|
||||
}
|
||||
|
||||
(*runs).length = index + lineOffset - (*runs).offset;
|
||||
runs[runIndex].length = index + lineOffset - runs[runIndex].offset;
|
||||
|
||||
return runCount;
|
||||
return runIndex + 1;
|
||||
}
|
||||
|
||||
static void ReverseRunSequence(SBRun *runs, SBUInteger runCount)
|
||||
|
|
@ -251,24 +263,20 @@ SB_INTERNAL SBLineRef SBLineCreate(SBParagraphRef paragraph,
|
|||
SBUInteger innerOffset = lineOffset - paragraph->offset;
|
||||
const SBBidiType *refTypes = paragraph->refTypes + innerOffset;
|
||||
const SBLevel *refLevels = paragraph->fixedLevels + innerOffset;
|
||||
LineContextRef context;
|
||||
SBLineRef line;
|
||||
SBLineRef line = NULL;
|
||||
LineContext context;
|
||||
|
||||
/* Line range MUST be valid. */
|
||||
SBAssert(lineOffset < (lineOffset + lineLength)
|
||||
&& lineOffset >= paragraph->offset
|
||||
&& (lineOffset + lineLength) <= (paragraph->offset + paragraph->length));
|
||||
|
||||
context = CreateLineContext(refTypes, refLevels, lineLength);
|
||||
|
||||
if (context) {
|
||||
ResetLevels(context, paragraph->baseLevel, lineLength);
|
||||
|
||||
line = AllocateLine(context->runCount);
|
||||
if (InitializeLineContext(&context, refTypes, refLevels, lineLength, paragraph->baseLevel)) {
|
||||
line = AllocateLine(context.runCount);
|
||||
|
||||
if (line) {
|
||||
line->runCount = InitializeRuns(line->fixedRuns, context->fixedLevels, lineLength, lineOffset);
|
||||
ReorderRuns(line->fixedRuns, line->runCount, context->maxLevel);
|
||||
line->runCount = InitializeRuns(line->fixedRuns, context.fixedLevels, lineLength, lineOffset);
|
||||
ReorderRuns(line->fixedRuns, line->runCount, context.maxLevel);
|
||||
|
||||
line->codepointSequence = paragraph->algorithm->codepointSequence;
|
||||
line->offset = lineOffset;
|
||||
|
|
@ -276,12 +284,10 @@ SB_INTERNAL SBLineRef SBLineCreate(SBParagraphRef paragraph,
|
|||
line->retainCount = 1;
|
||||
}
|
||||
|
||||
DisposeLineContext(context);
|
||||
|
||||
return line;
|
||||
FinalizeLineContext(&context);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return line;
|
||||
}
|
||||
|
||||
SBUInteger SBLineGetOffset(SBLineRef line)
|
||||
|
|
@ -316,6 +322,6 @@ SBLineRef SBLineRetain(SBLineRef line)
|
|||
void SBLineRelease(SBLineRef line)
|
||||
{
|
||||
if (line && --line->retainCount == 0) {
|
||||
free(line);
|
||||
ObjectDispose(&line->_object);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2014-2019 Muhammad Tayyab Akram
|
||||
* Copyright (C) 2014-2025 Muhammad Tayyab Akram
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -17,14 +17,17 @@
|
|||
#ifndef _SB_INTERNAL_LINE_H
|
||||
#define _SB_INTERNAL_LINE_H
|
||||
|
||||
#include <juce_graphics/unicode/sheenbidi/Headers/SBBase.h>
|
||||
#include <juce_graphics/unicode/sheenbidi/Headers/SBCodepointSequence.h>
|
||||
#include <juce_graphics/unicode/sheenbidi/Headers/SBConfig.h>
|
||||
#include <juce_graphics/unicode/sheenbidi/Headers/SBLine.h>
|
||||
#include <juce_graphics/unicode/sheenbidi/Headers/SBParagraph.h>
|
||||
#include <juce_graphics/unicode/sheenbidi/Headers/SBRun.h>
|
||||
#include <SheenBidi/SBBase.h>
|
||||
#include <SheenBidi/SBCodepointSequence.h>
|
||||
#include <SheenBidi/SBConfig.h>
|
||||
#include <SheenBidi/SBLine.h>
|
||||
#include <SheenBidi/SBParagraph.h>
|
||||
#include <SheenBidi/SBRun.h>
|
||||
|
||||
#include "Object.h"
|
||||
|
||||
typedef struct _SBLine {
|
||||
Object _object;
|
||||
SBCodepointSequence codepointSequence;
|
||||
SBRun *fixedRuns;
|
||||
SBUInteger runCount;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2014-2019 Muhammad Tayyab Akram
|
||||
* Copyright (C) 2014-2025 Muhammad Tayyab Akram
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -14,14 +14,16 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <juce_graphics/unicode/sheenbidi/Headers/SBConfig.h>
|
||||
#include <SheenBidi/SBConfig.h>
|
||||
|
||||
#ifdef SB_CONFIG_LOG
|
||||
|
||||
#include "BidiChain.h"
|
||||
#include "IsolatingRun.h"
|
||||
#include "LevelRun.h"
|
||||
#include "SBBase.h"
|
||||
#include "SBBidiChain.h"
|
||||
#include "SBBidiType.h"
|
||||
#include "SBIsolatingRun.h"
|
||||
#include "SBCodepoint.h"
|
||||
#include "SBCodepointSequence.h"
|
||||
#include "SBLog.h"
|
||||
|
||||
int _SBLogPosition = 0;
|
||||
|
|
@ -246,7 +248,7 @@ static void PrintTypesOperation(IsolatingRunRef isolatingRun, IsolatingContext *
|
|||
SB_INTERNAL void PrintRunTypes(IsolatingRunRef isolatingRun)
|
||||
{
|
||||
IsolatingContext context;
|
||||
IsolatingRunForEach(isolatingRun, &context, _SBPrintTypesOperation);
|
||||
IsolatingRunForEach(isolatingRun, &context, PrintTypesOperation);
|
||||
}
|
||||
|
||||
static void PrintLevelsOperation(IsolatingRunRef isolatingRun, IsolatingContext *context)
|
||||
|
|
@ -262,7 +264,7 @@ static void PrintLevelsOperation(IsolatingRunRef isolatingRun, IsolatingContext
|
|||
SB_INTERNAL void PrintRunLevels(IsolatingRunRef isolatingRun)
|
||||
{
|
||||
IsolatingContext context;
|
||||
IsolatingRunForEach(isolatingRun, &context, _SBPrintLevelsOperation);
|
||||
IsolatingRunForEach(isolatingRun, &context, PrintLevelsOperation);
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
|
|
@ -295,7 +297,7 @@ SB_INTERNAL void PrintRunRange(IsolatingRunRef isolatingRun)
|
|||
IsolatingContext context;
|
||||
context.object = ⦥
|
||||
|
||||
IsolatingRunForEach(isolatingRun, &context, _SBPrintRangeOperation);
|
||||
IsolatingRunForEach(isolatingRun, &context, PrintRangeOperation);
|
||||
SB_LOG_RANGE(range.offset, range.length);
|
||||
SB_LOG_DIVIDER(1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2014-2019 Muhammad Tayyab Akram
|
||||
* Copyright (C) 2014-2025 Muhammad Tayyab Akram
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -17,16 +17,15 @@
|
|||
#ifndef _SB_INTERNAL_LOG_H
|
||||
#define _SB_INTERNAL_LOG_H
|
||||
|
||||
#include <juce_graphics/unicode/sheenbidi/Headers/SBConfig.h>
|
||||
#include <SheenBidi/SBConfig.h>
|
||||
|
||||
#ifdef SB_CONFIG_LOG
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "IsolatingRun.h"
|
||||
#include "SBBase.h"
|
||||
#include "SBBidiType.h"
|
||||
#include "SBCodepointSequence.h"
|
||||
#include "SBIsolatingRun.h"
|
||||
|
||||
SB_INTERNAL void PrintBaseLevel(SBLevel baseLevel);
|
||||
SB_INTERNAL void PrintBidiType(SBBidiType type);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2014-2022 Muhammad Tayyab Akram
|
||||
* Copyright (C) 2014-2025 Muhammad Tayyab Akram
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -15,25 +15,28 @@
|
|||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "Object.h"
|
||||
#include "PairingLookup.h"
|
||||
#include "SBBase.h"
|
||||
#include "SBCodepoint.h"
|
||||
#include "SBLine.h"
|
||||
#include "SBMirrorLocator.h"
|
||||
|
||||
SBMirrorLocatorRef SBMirrorLocatorCreate(void)
|
||||
{
|
||||
SBMirrorLocatorRef locator = malloc(sizeof(SBMirrorLocator));
|
||||
const SBUInteger size = sizeof(SBMirrorLocator);
|
||||
void *pointer = NULL;
|
||||
|
||||
if (locator) {
|
||||
if (ObjectCreate(&size, 1, &pointer)) {
|
||||
SBMirrorLocatorRef locator = pointer;
|
||||
locator->_line = NULL;
|
||||
locator->retainCount = 1;
|
||||
|
||||
SBMirrorLocatorReset(locator);
|
||||
}
|
||||
|
||||
return locator;
|
||||
return pointer;
|
||||
}
|
||||
|
||||
void SBMirrorLocatorLoadLine(SBMirrorLocatorRef locator, SBLineRef line, void *stringBuffer)
|
||||
|
|
@ -118,6 +121,6 @@ void SBMirrorLocatorRelease(SBMirrorLocatorRef locator)
|
|||
{
|
||||
if (locator && --locator->retainCount == 0) {
|
||||
SBLineRelease(locator->_line);
|
||||
free(locator);
|
||||
ObjectDispose(&locator->_object);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2014-2019 Muhammad Tayyab Akram
|
||||
* Copyright (C) 2014-2025 Muhammad Tayyab Akram
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -17,11 +17,14 @@
|
|||
#ifndef _SB_INTERNAL_MIRROR_LOCATOR_H
|
||||
#define _SB_INTERNAL_MIRROR_LOCATOR_H
|
||||
|
||||
#include <juce_graphics/unicode/sheenbidi/Headers/SBBase.h>
|
||||
#include <juce_graphics/unicode/sheenbidi/Headers/SBMirrorLocator.h>
|
||||
#include <juce_graphics/unicode/sheenbidi/Headers/SBLine.h>
|
||||
#include <SheenBidi/SBBase.h>
|
||||
#include <SheenBidi/SBLine.h>
|
||||
#include <SheenBidi/SBMirrorLocator.h>
|
||||
|
||||
#include "Object.h"
|
||||
|
||||
typedef struct _SBMirrorLocator {
|
||||
Object _object;
|
||||
SBLineRef _line;
|
||||
SBUInteger _runIndex;
|
||||
SBUInteger _stringIndex;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2014-2022 Muhammad Tayyab Akram
|
||||
* Copyright (C) 2014-2025 Muhammad Tayyab Akram
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -14,14 +14,16 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <juce_graphics/unicode/sheenbidi/Headers/SBConfig.h>
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <SheenBidi/SBConfig.h>
|
||||
|
||||
#include "BidiChain.h"
|
||||
#include "BidiTypeLookup.h"
|
||||
#include "IsolatingRun.h"
|
||||
#include "LevelRun.h"
|
||||
#include "Object.h"
|
||||
#include "RunQueue.h"
|
||||
#include "SBAlgorithm.h"
|
||||
#include "SBAssert.h"
|
||||
|
|
@ -33,6 +35,7 @@
|
|||
#include "SBParagraph.h"
|
||||
|
||||
typedef struct _ParagraphContext {
|
||||
Object object;
|
||||
BidiChain bidiChain;
|
||||
StatusStack statusStack;
|
||||
RunQueue runQueue;
|
||||
|
|
@ -42,73 +45,84 @@ typedef struct _ParagraphContext {
|
|||
static void PopulateBidiChain(BidiChainRef chain, const SBBidiType *types, SBUInteger length);
|
||||
static SBBoolean ProcessRun(ParagraphContextRef context, const LevelRunRef levelRun, SBBoolean forceFinish);
|
||||
|
||||
static ParagraphContextRef CreateParagraphContext(const SBBidiType *types, SBLevel *levels, SBUInteger length)
|
||||
#define BIDI_LINKS 0
|
||||
#define BIDI_TYPES 1
|
||||
#define BIDI_FLAGS 2
|
||||
#define COUNT 3
|
||||
|
||||
static SBBoolean InitializeParagraphContext(ParagraphContextRef context,
|
||||
const SBBidiType *types, SBLevel *levels, SBUInteger length)
|
||||
{
|
||||
const SBUInteger sizeContext = sizeof(ParagraphContext);
|
||||
const SBUInteger sizeLinks = sizeof(BidiLink) * (length + 2);
|
||||
const SBUInteger sizeTypes = sizeof(SBBidiType) * (length + 2);
|
||||
const SBUInteger sizeMemory = sizeContext + sizeLinks + sizeTypes;
|
||||
SBBoolean isInitialized = SBFalse;
|
||||
void *pointers[COUNT] = { NULL };
|
||||
SBUInteger sizes[COUNT];
|
||||
|
||||
void *pointer = malloc(sizeMemory);
|
||||
sizes[BIDI_LINKS] = sizeof(BidiLink) * (length + 2);
|
||||
sizes[BIDI_TYPES] = sizeof(SBBidiType) * (length + 2);
|
||||
sizes[BIDI_FLAGS] = sizeof(BidiFlag) * (length + 2);
|
||||
|
||||
if (pointer) {
|
||||
const SBUInteger offsetContext = 0;
|
||||
const SBUInteger offsetLinks = offsetContext + sizeContext;
|
||||
const SBUInteger offsetTypes = offsetLinks + sizeLinks;
|
||||
ObjectInitialize(&context->object);
|
||||
|
||||
SBUInt8 *memory = (SBUInt8 *)pointer;
|
||||
ParagraphContextRef context = (ParagraphContextRef)(memory + offsetContext);
|
||||
BidiLink *fixedLinks = (BidiLink *)(memory + offsetLinks);
|
||||
SBBidiType *fixedTypes = (SBBidiType *)(memory + offsetTypes);
|
||||
if (ObjectAddMemoryWithChunks(&context->object, sizes, COUNT, pointers)) {
|
||||
BidiLink *fixedLinks = pointers[BIDI_LINKS];
|
||||
SBBidiType *fixedTypes = pointers[BIDI_TYPES];
|
||||
BidiFlag *fixedFlags = pointers[BIDI_FLAGS];
|
||||
|
||||
BidiChainInitialize(&context->bidiChain, fixedTypes, levels, fixedLinks);
|
||||
BidiChainInitialize(&context->bidiChain, fixedTypes, levels, fixedFlags, fixedLinks);
|
||||
StatusStackInitialize(&context->statusStack);
|
||||
RunQueueInitialize(&context->runQueue);
|
||||
IsolatingRunInitialize(&context->isolatingRun);
|
||||
|
||||
PopulateBidiChain(&context->bidiChain, types, length);
|
||||
|
||||
return context;
|
||||
isInitialized = SBTrue;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return isInitialized;
|
||||
}
|
||||
|
||||
static void DisposeParagraphContext(ParagraphContextRef context)
|
||||
#undef BIDI_LINKS
|
||||
#undef BIDI_TYPES
|
||||
#undef BIDI_FLAGS
|
||||
#undef COUNT
|
||||
|
||||
static void FinalizeParagraphContext(ParagraphContextRef context)
|
||||
{
|
||||
StatusStackFinalize(&context->statusStack);
|
||||
RunQueueFinalize(&context->runQueue);
|
||||
IsolatingRunFinalize(&context->isolatingRun);
|
||||
free(context);
|
||||
ObjectFinalize(&context->object);
|
||||
}
|
||||
|
||||
#define PARAGRAPH 0
|
||||
#define LEVELS 1
|
||||
#define COUNT 2
|
||||
|
||||
static SBParagraphRef AllocateParagraph(SBUInteger length)
|
||||
{
|
||||
const SBUInteger sizeParagraph = sizeof(SBParagraph);
|
||||
const SBUInteger sizeLevels = sizeof(SBLevel) * (length + 2);
|
||||
const SBUInteger sizeMemory = sizeParagraph + sizeLevels;
|
||||
void *pointers[COUNT] = { NULL };
|
||||
SBUInteger sizes[COUNT];
|
||||
|
||||
void *pointer = malloc(sizeMemory);
|
||||
sizes[PARAGRAPH] = sizeof(SBParagraph);
|
||||
sizes[LEVELS] = sizeof(SBLevel) * (length + 2);
|
||||
|
||||
if (pointer) {
|
||||
const SBUInteger offsetParagraph = 0;
|
||||
const SBUInteger offsetLevels = offsetParagraph + sizeParagraph;
|
||||
|
||||
SBUInt8 *memory = (SBUInt8 *)pointer;
|
||||
SBParagraphRef paragraph = (SBParagraphRef)(memory + offsetParagraph);
|
||||
SBLevel *levels = (SBLevel *)(memory + offsetLevels);
|
||||
if (ObjectCreate(sizes, COUNT, pointers)) {
|
||||
SBParagraphRef paragraph = pointers[PARAGRAPH];
|
||||
SBLevel *levels = pointers[LEVELS];
|
||||
|
||||
paragraph->fixedLevels = levels;
|
||||
|
||||
return paragraph;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return pointers[PARAGRAPH];
|
||||
}
|
||||
|
||||
#undef PARAGRAPH
|
||||
#undef LEVELS
|
||||
#undef COUNT
|
||||
|
||||
static void DisposeParagraph(SBParagraphRef paragraph)
|
||||
{
|
||||
free(paragraph);
|
||||
ObjectDispose(¶graph->_object);
|
||||
}
|
||||
|
||||
static SBUInteger DetermineBoundary(SBAlgorithmRef algorithm, SBUInteger paragraphOffset, SBUInteger suggestedLength)
|
||||
|
|
@ -303,7 +317,7 @@ static SBBoolean DetermineLevels(ParagraphContextRef context, SBLevel baseLevel)
|
|||
|
||||
#define MergeLinkIfNeeded() \
|
||||
{ \
|
||||
if (BidiChainMergeIfEqual(chain, priorLink, link)) { \
|
||||
if (BidiChainMergeNext(chain, priorLink)) { \
|
||||
continue; \
|
||||
} \
|
||||
}
|
||||
|
|
@ -470,7 +484,6 @@ static SBBoolean DetermineLevels(ParagraphContextRef context, SBLevel baseLevel)
|
|||
/* Rule X9 */
|
||||
if (bnEquivalent) {
|
||||
/* The type of this link is BN equivalent, so abandon it and continue the loop. */
|
||||
BidiChainSetType(chain, link, SBBidiTypeBN);
|
||||
BidiChainAbandonNext(chain, priorLink);
|
||||
continue;
|
||||
}
|
||||
|
|
@ -526,16 +539,16 @@ static SBBoolean ProcessRun(ParagraphContextRef context, const LevelRunRef level
|
|||
|
||||
if (queue->shouldDequeue || forceFinish) {
|
||||
IsolatingRunRef isolatingRun = &context->isolatingRun;
|
||||
LevelRunRef peek;
|
||||
|
||||
/* Rule X10 */
|
||||
for (; queue->count != 0; RunQueueDequeue(queue)) {
|
||||
peek = queue->peek;
|
||||
if (RunKindIsAttachedTerminating(peek->kind)) {
|
||||
LevelRunRef front = RunQueueGetFront(queue);
|
||||
|
||||
if (RunKindIsAttachedTerminating(front->kind)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
isolatingRun->baseLevelRun = peek;
|
||||
isolatingRun->baseLevelRun = front;
|
||||
|
||||
if (!IsolatingRunResolve(isolatingRun)) {
|
||||
return SBFalse;
|
||||
|
|
@ -570,26 +583,23 @@ static SBBoolean ResolveParagraph(SBParagraphRef paragraph,
|
|||
{
|
||||
const SBBidiType *bidiTypes = algorithm->fixedTypes + offset;
|
||||
SBBoolean isSucceeded = SBFalse;
|
||||
ParagraphContextRef context;
|
||||
SBLevel resolvedLevel;
|
||||
ParagraphContext context;
|
||||
|
||||
context = CreateParagraphContext(bidiTypes, paragraph->fixedLevels, length);
|
||||
|
||||
if (context) {
|
||||
resolvedLevel = DetermineParagraphLevel(&context->bidiChain, baseLevel);
|
||||
if (InitializeParagraphContext(&context, bidiTypes, paragraph->fixedLevels, length)) {
|
||||
SBLevel resolvedLevel = DetermineParagraphLevel(&context.bidiChain, baseLevel);
|
||||
|
||||
SB_LOG_BLOCK_OPENER("Determined Paragraph Level");
|
||||
SB_LOG_STATEMENT("Base Level", 1, SB_LOG_LEVEL(resolvedLevel));
|
||||
SB_LOG_BLOCK_CLOSER();
|
||||
|
||||
context->isolatingRun.codepointSequence = &algorithm->codepointSequence;
|
||||
context->isolatingRun.bidiTypes = bidiTypes;
|
||||
context->isolatingRun.bidiChain = &context->bidiChain;
|
||||
context->isolatingRun.paragraphOffset = offset;
|
||||
context->isolatingRun.paragraphLevel = resolvedLevel;
|
||||
context.isolatingRun.codepointSequence = &algorithm->codepointSequence;
|
||||
context.isolatingRun.bidiTypes = bidiTypes;
|
||||
context.isolatingRun.bidiChain = &context.bidiChain;
|
||||
context.isolatingRun.paragraphOffset = offset;
|
||||
context.isolatingRun.paragraphLevel = resolvedLevel;
|
||||
|
||||
if (DetermineLevels(context, resolvedLevel)) {
|
||||
SaveLevels(&context->bidiChain, ++paragraph->fixedLevels, resolvedLevel);
|
||||
if (DetermineLevels(&context, resolvedLevel)) {
|
||||
SaveLevels(&context.bidiChain, ++paragraph->fixedLevels, resolvedLevel);
|
||||
|
||||
SB_LOG_BLOCK_OPENER("Determined Embedding Levels");
|
||||
SB_LOG_STATEMENT("Levels", 1, SB_LOG_LEVELS_ARRAY(paragraph->fixedLevels, length));
|
||||
|
|
@ -605,7 +615,7 @@ static SBBoolean ResolveParagraph(SBParagraphRef paragraph,
|
|||
isSucceeded = SBTrue;
|
||||
}
|
||||
|
||||
DisposeParagraphContext(context);
|
||||
FinalizeParagraphContext(&context);
|
||||
}
|
||||
|
||||
return isSucceeded;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2014-2019 Muhammad Tayyab Akram
|
||||
* Copyright (C) 2014-2025 Muhammad Tayyab Akram
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -17,12 +17,15 @@
|
|||
#ifndef _SB_INTERNAL_PARAGRAPH_H
|
||||
#define _SB_INTERNAL_PARAGRAPH_H
|
||||
|
||||
#include <juce_graphics/unicode/sheenbidi/Headers/SBAlgorithm.h>
|
||||
#include <juce_graphics/unicode/sheenbidi/Headers/SBBase.h>
|
||||
#include <juce_graphics/unicode/sheenbidi/Headers/SBConfig.h>
|
||||
#include <juce_graphics/unicode/sheenbidi/Headers/SBParagraph.h>
|
||||
#include <SheenBidi/SBAlgorithm.h>
|
||||
#include <SheenBidi/SBBase.h>
|
||||
#include <SheenBidi/SBConfig.h>
|
||||
#include <SheenBidi/SBParagraph.h>
|
||||
|
||||
#include "Object.h"
|
||||
|
||||
typedef struct _SBParagraph {
|
||||
Object _object;
|
||||
SBAlgorithmRef algorithm;
|
||||
const SBBidiType *refTypes;
|
||||
SBLevel *fixedLevels;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2022 Muhammad Tayyab Akram
|
||||
* Copyright (C) 2018-2025 Muhammad Tayyab Akram
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -15,11 +15,12 @@
|
|||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "GeneralCategoryLookup.h"
|
||||
#include "Object.h"
|
||||
#include "PairingLookup.h"
|
||||
#include "SBBase.h"
|
||||
#include "SBCodepoint.h"
|
||||
#include "SBCodepointSequence.h"
|
||||
#include "ScriptLookup.h"
|
||||
#include "ScriptStack.h"
|
||||
|
|
@ -34,9 +35,11 @@ static SBBoolean IsSimilarScript(SBScript lhs, SBScript rhs)
|
|||
|
||||
SBScriptLocatorRef SBScriptLocatorCreate(void)
|
||||
{
|
||||
SBScriptLocatorRef locator = malloc(sizeof(SBScriptLocator));
|
||||
const SBUInteger size = sizeof(SBScriptLocator);
|
||||
void *pointer = NULL;
|
||||
|
||||
if (locator) {
|
||||
if (ObjectCreate(&size, 1, &pointer)) {
|
||||
SBScriptLocatorRef locator = pointer;
|
||||
locator->_codepointSequence.stringEncoding = SBStringEncodingUTF8;
|
||||
locator->_codepointSequence.stringBuffer = NULL;
|
||||
locator->_codepointSequence.stringLength = 0;
|
||||
|
|
@ -45,7 +48,7 @@ SBScriptLocatorRef SBScriptLocatorCreate(void)
|
|||
SBScriptLocatorReset(locator);
|
||||
}
|
||||
|
||||
return locator;
|
||||
return pointer;
|
||||
}
|
||||
|
||||
void SBScriptLocatorLoadCodepoints(SBScriptLocatorRef locator, const SBCodepointSequence *codepointSequence)
|
||||
|
|
@ -171,6 +174,6 @@ SBScriptLocatorRef SBScriptLocatorRetain(SBScriptLocatorRef locator)
|
|||
void SBScriptLocatorRelease(SBScriptLocatorRef locator)
|
||||
{
|
||||
if (locator && --locator->retainCount == 0) {
|
||||
free(locator);
|
||||
ObjectDispose(&locator->_object);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2019 Muhammad Tayyab Akram
|
||||
* Copyright (C) 2018-2025 Muhammad Tayyab Akram
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -17,13 +17,15 @@
|
|||
#ifndef _SB_INTERNAL_SCRIPT_LOCATOR_H
|
||||
#define _SB_INTERNAL_SCRIPT_LOCATOR_H
|
||||
|
||||
#include <juce_graphics/unicode/sheenbidi/Headers/SBBase.h>
|
||||
#include <juce_graphics/unicode/sheenbidi/Headers/SBCodepointSequence.h>
|
||||
#include <juce_graphics/unicode/sheenbidi/Headers/SBScriptLocator.h>
|
||||
#include <SheenBidi/SBBase.h>
|
||||
#include <SheenBidi/SBCodepointSequence.h>
|
||||
#include <SheenBidi/SBScriptLocator.h>
|
||||
|
||||
#include "Object.h"
|
||||
#include "ScriptStack.h"
|
||||
|
||||
typedef struct _SBScriptLocator {
|
||||
Object _object;
|
||||
SBCodepointSequence _codepointSequence;
|
||||
ScriptStack _scriptStack;
|
||||
SBScriptAgent agent;
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -6,10 +6,10 @@
|
|||
#ifndef _SB_INTERNAL_SCRIPT_LOOKUP_H
|
||||
#define _SB_INTERNAL_SCRIPT_LOOKUP_H
|
||||
|
||||
#include <juce_graphics/unicode/sheenbidi/Headers/SBConfig.h>
|
||||
#include <juce_graphics/unicode/sheenbidi/Headers/SBScript.h>
|
||||
|
||||
#include "SBBase.h"
|
||||
#include <SheenBidi/SBBase.h>
|
||||
#include <SheenBidi/SBCodepoint.h>
|
||||
#include <SheenBidi/SBConfig.h>
|
||||
#include <SheenBidi/SBScript.h>
|
||||
|
||||
SB_INTERNAL SBScript LookupScript(SBCodepoint codepoint);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2019 Muhammad Tayyab Akram
|
||||
* Copyright (C) 2018-2025 Muhammad Tayyab Akram
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -14,10 +14,11 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <juce_graphics/unicode/sheenbidi/Headers/SBConfig.h>
|
||||
#include <SheenBidi/SBConfig.h>
|
||||
|
||||
#include "SBAssert.h"
|
||||
#include "SBBase.h"
|
||||
#include "SBCodepoint.h"
|
||||
#include "ScriptStack.h"
|
||||
|
||||
SB_INTERNAL void ScriptStackReset(ScriptStackRef stack)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2019 Muhammad Tayyab Akram
|
||||
* Copyright (C) 2018-2025 Muhammad Tayyab Akram
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -17,8 +17,9 @@
|
|||
#ifndef _SB_INTERNAL_SCRIPT_STACK_H
|
||||
#define _SB_INTERNAL_SCRIPT_STACK_H
|
||||
|
||||
#include <juce_graphics/unicode/sheenbidi/Headers/SBBase.h>
|
||||
#include <juce_graphics/unicode/sheenbidi/Headers/SBConfig.h>
|
||||
#include <SheenBidi/SBBase.h>
|
||||
#include <SheenBidi/SBCodepoint.h>
|
||||
#include <SheenBidi/SBConfig.h>
|
||||
|
||||
#define _SBScriptStackCapacity 63
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2014-2019 Muhammad Tayyab Akram
|
||||
* Copyright (C) 2014-2025 Muhammad Tayyab Akram
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -14,8 +14,8 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <juce_graphics/unicode/sheenbidi/Headers/SBConfig.h>
|
||||
#include <juce_graphics/unicode/sheenbidi/Headers/SheenBidi.h>
|
||||
#include <SheenBidi/SBConfig.h>
|
||||
#include <SheenBidi/SheenBidi.h>
|
||||
|
||||
#ifdef SB_CONFIG_UNITY
|
||||
|
||||
|
|
@ -25,10 +25,12 @@
|
|||
#include "GeneralCategoryLookup.c"
|
||||
#include "IsolatingRun.c"
|
||||
#include "LevelRun.c"
|
||||
#include "Object.c"
|
||||
#include "PairingLookup.c"
|
||||
#include "RunQueue.c"
|
||||
#include "SBAlgorithm.c"
|
||||
#include "SBBase.c"
|
||||
#include "SBCodepoint.c"
|
||||
#include "SBCodepointSequence.c"
|
||||
#include "SBLine.c"
|
||||
#include "SBLog.c"
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2014-2022 Muhammad Tayyab Akram
|
||||
* Copyright (C) 2014-2025 Muhammad Tayyab Akram
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -14,10 +14,11 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <juce_graphics/unicode/sheenbidi/Headers/SBConfig.h>
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <SheenBidi/SBConfig.h>
|
||||
|
||||
#include "Object.h"
|
||||
#include "SBAssert.h"
|
||||
#include "SBBase.h"
|
||||
#include "StatusStack.h"
|
||||
|
|
@ -31,7 +32,7 @@ static SBBoolean StatusStackInsertElement(StatusStackRef stack)
|
|||
_StatusStackListRef peekList = previousList->next;
|
||||
|
||||
if (!peekList) {
|
||||
peekList = malloc(sizeof(_StatusStackList));
|
||||
peekList = ObjectAddMemory(&stack->_object, sizeof(_StatusStackList));
|
||||
if (!peekList) {
|
||||
return SBFalse;
|
||||
}
|
||||
|
|
@ -52,6 +53,8 @@ static SBBoolean StatusStackInsertElement(StatusStackRef stack)
|
|||
|
||||
SB_INTERNAL void StatusStackInitialize(StatusStackRef stack)
|
||||
{
|
||||
ObjectInitialize(&stack->_object);
|
||||
|
||||
stack->_firstList.previous = NULL;
|
||||
stack->_firstList.next = NULL;
|
||||
|
||||
|
|
@ -114,11 +117,5 @@ SB_INTERNAL SBBoolean StatusStackGetIsolateStatus(StatusStackRef stack)
|
|||
|
||||
SB_INTERNAL void StatusStackFinalize(StatusStackRef stack)
|
||||
{
|
||||
_StatusStackListRef list = stack->_firstList.next;
|
||||
|
||||
while (list) {
|
||||
_StatusStackListRef next = list->next;
|
||||
free(list);
|
||||
list = next;
|
||||
};
|
||||
ObjectFinalize(&stack->_object);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2014-2022 Muhammad Tayyab Akram
|
||||
* Copyright (C) 2014-2025 Muhammad Tayyab Akram
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -17,7 +17,9 @@
|
|||
#ifndef _SB_INTERNAL_STATUS_STACK_H
|
||||
#define _SB_INTERNAL_STATUS_STACK_H
|
||||
|
||||
#include <juce_graphics/unicode/sheenbidi/Headers/SBConfig.h>
|
||||
#include <SheenBidi/SBConfig.h>
|
||||
|
||||
#include "Object.h"
|
||||
#include "SBBase.h"
|
||||
|
||||
#define _StatusStackList_Length 16
|
||||
|
|
@ -37,6 +39,7 @@ typedef struct _StatusStackList {
|
|||
} _StatusStackList, *_StatusStackListRef;
|
||||
|
||||
typedef struct _StatusStack {
|
||||
Object _object;
|
||||
_StatusStackList _firstList;
|
||||
_StatusStackListRef _peekList;
|
||||
SBUInteger _peekTop;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue