адаптация s13bby/osc под vst и gui. (вайбкод)

вайбкод потому что мне в моменте стало понятно. что проще было сразу писать на фреймворке JUCE, чем адаптировать консольное приложение на MiniAudio.
обновляться данный репозиторий не будет. СmakeLists адаптирован онли под linux.
This commit is contained in:
2026-11-20 14:52:33 +06:00
parent 8384123f87
commit b0a75e98db
10387 changed files with 4025195 additions and 0 deletions
@@ -0,0 +1,123 @@
/*
* 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.
* 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_ALGORITHM_H
#define _SB_PUBLIC_ALGORITHM_H
#include <juce_graphics/unicode/sheenbidi/Headers/SheenBidi/SBBase.h>
#include <juce_graphics/unicode/sheenbidi/Headers/SheenBidi/SBBidiType.h>
#include <juce_graphics/unicode/sheenbidi/Headers/SheenBidi/SBCodepointSequence.h>
#include <juce_graphics/unicode/sheenbidi/Headers/SheenBidi/SBParagraph.h>
SB_EXTERN_C_BEGIN
typedef struct _SBAlgorithm *SBAlgorithmRef;
/**
* Creates an algorithm object for the specified code point sequence. The source string inside the
* code point sequence should not be freed until the algorithm object is in use.
*
* @param codepointSequence
* The code point sequence to apply bidirectional algorithm on.
* @return
* A reference to an algorithm object if the call was successful, NULL otherwise.
*/
SB_PUBLIC SBAlgorithmRef SBAlgorithmCreate(const SBCodepointSequence *codepointSequence);
/**
* Returns a direct pointer to the bidirectional types of code units, stored in the algorithm
* object.
*
* @param algorithm
* The algorithm object from which to access the bidirectional types of code units.
* @return
* A valid pointer to an array of SBBidiType structures, whose length will be equal to that of
* string buffer.
*/
SB_PUBLIC const SBBidiType *SBAlgorithmGetBidiTypesPtr(SBAlgorithmRef algorithm);
/**
* Determines the boundary of first paragraph within the specified range.
*
* The boundary of the paragraph occurs after a code point whose bidirectional type is Paragraph
* Separator (B), or at the suggestedLength if no such code point exists before it. The exception to
* this rule is when a Carriage Return (CR) is followed by a Line Feed (LF). Both CR and LF are
* paragraph separators, but in that case, the boundary of the paragraph is considered after LF code
* point.
*
* @param algorithm
* The algorithm object to use for determining paragraph boundary.
* @param paragraphOffset
* The index to the first code unit of the paragraph in source string.
* @param suggestedLength
* The number of code units covering the suggested length of the paragraph.
* @param acutalLength
* The actual length of the first paragraph, including the paragraph separator, within the
* given range.
* @param separatorLength
* On output, the length of paragraph separator. This parameter can be set to NULL if not
* needed.
*/
SB_PUBLIC void SBAlgorithmGetParagraphBoundary(SBAlgorithmRef algorithm,
SBUInteger paragraphOffset, SBUInteger suggestedLength,
SBUInteger *acutalLength, SBUInteger *separatorLength);
/**
* Creates a paragraph object processed with Unicode Bidirectional Algorithm.
*
* This function processes only first paragraph starting at paragraphOffset with length less than or
* equal to suggestedLength, in accordance with Rule P1 of Unicode Bidirectional Algorithm.
*
* The paragraph level is determined by applying Rules P2-P3 and embedding levels are resolved by
* applying Rules X1-I2.
*
* @param algorithm
* The algorithm object to use for creating the desired paragraph.
* @param paragraphOffset
* The index to the first code unit of the paragraph in source string.
* @param suggestedLength
* The number of code units covering the suggested length of the paragraph.
* @param baseLevel
* The desired base level of the paragraph. Rules P2-P3 would be ignored if it is neither
* SBLevelDefaultLTR nor SBLevelDefaultRTL.
* @return
* A reference to a paragraph object if the call was successful, NULL otherwise.
*/
SB_PUBLIC SBParagraphRef SBAlgorithmCreateParagraph(SBAlgorithmRef algorithm,
SBUInteger paragraphOffset, SBUInteger suggestedLength, SBLevel baseLevel);
/**
* Increments the reference count of an algorithm object.
*
* @param algorithm
* The algorithm object whose reference count will be incremented.
* @return
* The same algorithm object passed in as the parameter.
*/
SB_PUBLIC SBAlgorithmRef SBAlgorithmRetain(SBAlgorithmRef algorithm);
/**
* Decrements the reference count of an algorithm object. The object will be deallocated when its
* reference count reaches zero.
*
* @param algorithm
* The algorithm object whose reference count will be decremented.
*/
SB_PUBLIC void SBAlgorithmRelease(SBAlgorithmRef algorithm);
SB_EXTERN_C_END
#endif
@@ -0,0 +1,156 @@
/*
* 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 _SB_PUBLIC_BASE_H
#define _SB_PUBLIC_BASE_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.
*/
typedef int8_t SBInt8;
/**
* A type to represent a 16-bit signed integer.
*/
typedef int16_t SBInt16;
/**
* A type to represent a 32-bit signed integer.
*/
typedef int32_t SBInt32;
/**
* A type to represent an 8-bit unsigned integer.
*/
typedef uint8_t SBUInt8;
/**
* A type to represent a 16-bit unsigned integer.
*/
typedef uint16_t SBUInt16;
/**
* A type to represent a 32-bit unsigned integer.
*/
typedef uint32_t SBUInt32;
/**
* A signed integer type whose width is equal to the width of the machine word.
*/
typedef intptr_t SBInteger;
/**
* An unsigned integer type whose width is equal to the width of the machine word.
*/
typedef uintptr_t SBUInteger;
/**
* Constants that specify the states of a boolean.
*/
enum {
SBFalse = 0, /**< A value representing the false state. */
SBTrue = 1 /**< A value representing the true state. */
};
/**
* A type to represent a boolean value.
*/
typedef SBUInt8 SBBoolean;
#define SBUInt8InRange(v, s, e) \
( \
(SBUInt8)((v) - (s)) \
<= (SBUInt8)((e) - (s)) \
)
#define SBUInt16InRange(v, s, e) \
( \
(SBUInt16)((v) - (s)) \
<= (SBUInt16)((e) - (s)) \
)
#define SBUInt32InRange(v, s, e) \
( \
(SBUInt32)((v) - (s)) \
<= (SBUInt32)((e) - (s)) \
)
/**
* A type to represent a bidi level.
*/
typedef SBUInt8 SBLevel;
/**
* A value representing an invalid bidi level.
*/
#define SBLevelInvalid 0xFF
/**
* A value representing maximum explicit embedding level.
*/
#define SBLevelMax 125
/**
* A value specifying to set base level to zero (left-to-right) if there is no strong character.
*/
#define SBLevelDefaultLTR 0xFE
/**
* A value specifying to set base level to one (right-to-left) if there is no strong character.
*/
#define SBLevelDefaultRTL 0xFD
SB_EXTERN_C_END
#endif
@@ -0,0 +1,85 @@
/*
* 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_BIDI_TYPE_H
#define _SB_PUBLIC_BIDI_TYPE_H
#include <juce_graphics/unicode/sheenbidi/Headers/SheenBidi/SBBase.h>
SB_EXTERN_C_BEGIN
/**
* Constants that specify the bidirectional types of a character.
*/
enum {
SBBidiTypeNil = 0x00,
SBBidiTypeL = 0x01, /**< Strong: Left-to-Right */
SBBidiTypeR = 0x02, /**< Strong: Right-to-Left */
SBBidiTypeAL = 0x03, /**< Strong: Right-to-Left Arabic */
SBBidiTypeBN = 0x04, /**< Weak: Boundary Neutral */
SBBidiTypeNSM = 0x05, /**< Weak: Non-Spacing Mark */
SBBidiTypeAN = 0x06, /**< Weak: Arabic Number */
SBBidiTypeEN = 0x07, /**< Weak: European Number */
SBBidiTypeET = 0x08, /**< Weak: European Number Terminator */
SBBidiTypeES = 0x09, /**< Weak: European Number Separator */
SBBidiTypeCS = 0x0A, /**< Weak: Common Number Separator */
SBBidiTypeWS = 0x0B, /**< Neutral: White Space */
SBBidiTypeS = 0x0C, /**< Neutral: Segment Separator */
SBBidiTypeB = 0x0D, /**< Neutral: Paragraph Separator */
SBBidiTypeON = 0x0E, /**< Neutral: Other Neutral */
SBBidiTypeLRI = 0x0F, /**< Format: Left-to-Right Isolate */
SBBidiTypeRLI = 0x10, /**< Format: Right-to-Left Isolate */
SBBidiTypeFSI = 0x11, /**< Format: First Strong Isolate */
SBBidiTypePDI = 0x12, /**< Format: Pop Directional Isolate */
SBBidiTypeLRE = 0x13, /**< Format: Left-to-Right Embedding */
SBBidiTypeRLE = 0x14, /**< Format: Right-to-Left Embedding */
SBBidiTypeLRO = 0x15, /**< Format: Left-to-Right Override */
SBBidiTypeRLO = 0x16, /**< Format: Right-to-Left Override */
SBBidiTypePDF = 0x17 /**< Format: Pop Directional Formatting */
};
/**
* A type to represent the bidirectional type of a character.
*/
typedef SBUInt8 SBBidiType;
/**
* Checks whether specified bidirectional type is strong.
*/
#define SBBidiTypeIsStrong(t) SBUInt8InRange(t, SBBidiTypeL, SBBidiTypeAL)
/**
* Checks whether specified bidirectional type is weak.
*/
#define SBBidiTypeIsWeak(t) SBUInt8InRange(t, SBBidiTypeBN, SBBidiTypeCS)
/**
* Checks whether specified bidirectional type is neutral.
*/
#define SBBidiTypeIsNeutral(t) SBUInt8InRange(t, SBBidiTypeWS, SBBidiTypeON)
/**
* Checks whether specified bidirectional type is format.
*/
#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 <juce_graphics/unicode/sheenbidi/Headers/SheenBidi/SBBase.h>
#include <juce_graphics/unicode/sheenbidi/Headers/SheenBidi/SBBidiType.h>
#include <juce_graphics/unicode/sheenbidi/Headers/SheenBidi/SBGeneralCategory.h>
#include <juce_graphics/unicode/sheenbidi/Headers/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
@@ -0,0 +1,70 @@
/*
* 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.
* 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_SEQUENCE_H
#define _SB_PUBLIC_CODEPOINT_SEQUENCE_H
#include <juce_graphics/unicode/sheenbidi/Headers/SheenBidi/SBBase.h>
#include <juce_graphics/unicode/sheenbidi/Headers/SheenBidi/SBCodepoint.h>
SB_EXTERN_C_BEGIN
enum {
SBStringEncodingUTF8 = 0, /**< An 8-bit representation of Unicode code points. */
SBStringEncodingUTF16 = 1, /**< 16-bit UTF encoding in native endianness. */
SBStringEncodingUTF32 = 2 /**< 32-bit UTF encoding in native endianness. */
};
typedef SBUInt32 SBStringEncoding;
typedef struct _SBCodepointSequence {
SBStringEncoding stringEncoding; /**< The encoding of the string. */
const void *stringBuffer; /**< The source string containing the code units. */
SBUInteger stringLength; /**< The length of the string in terms of code units. */
} SBCodepointSequence;
/**
* Returns the code point before the given string index.
*
* @param codepointSequence
* The object holding the information of the string.
* @param stringIndex
* The index of code unit before which to get the code point. On output, it is set to point to
* the first code unit of returned code point.
* @return
* The code point before the given string index, or SBCodepointInvalid if stringIndex is equal
* to zero or larger than actual length of source string.
*/
SB_PUBLIC SBCodepoint SBCodepointSequenceGetCodepointBefore(
const SBCodepointSequence *codepointSequence, SBUInteger *stringIndex);
/**
* Returns the code point at the given string index.
*
* @param codepointSequence
* The object holding the information of the string.
* @param stringIndex
* The index of code unit at which to get the code point. On output, it is set to point to the
* first code unit of next code point.
* @return
* The code point at the given string index, or SBCodepointInvalid if stringIndex is larger
* than or equal to actual length of source string.
*/
SB_PUBLIC SBCodepoint SBCodepointSequenceGetCodepointAt(
const SBCodepointSequence *codepointSequence, SBUInteger *stringIndex);
SB_EXTERN_C_END
#endif
@@ -0,0 +1,31 @@
/*
* 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 _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 */
#ifdef SB_CONFIG_UNITY
#define SB_INTERNAL static
#else
#define SB_INTERNAL
#endif
#endif
@@ -0,0 +1,110 @@
/*
* 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_GENERAL_CATEGORY_H
#define _SB_PUBLIC_GENERAL_CATEGORY_H
#include <juce_graphics/unicode/sheenbidi/Headers/SheenBidi/SBBase.h>
SB_EXTERN_C_BEGIN
/**
* Constants that specify the general category of a character.
*/
enum {
SBGeneralCategoryNil = 0x00,
SBGeneralCategoryLU = 0x01, /**< Letter: Uppercase Letter */
SBGeneralCategoryLL = 0x02, /**< Letter: Lowercase Letter */
SBGeneralCategoryLT = 0x03, /**< Letter: Titlecase Letter */
SBGeneralCategoryLM = 0x04, /**< Letter: Modifier Letter */
SBGeneralCategoryLO = 0x05, /**< Letter: Other Letter */
SBGeneralCategoryMN = 0x06, /**< Mark: Nonspacing Mark */
SBGeneralCategoryMC = 0x07, /**< Mark: Spacing Mark */
SBGeneralCategoryME = 0x08, /**< Mark: Enclosing Mark */
SBGeneralCategoryND = 0x09, /**< Number: Decimal Number */
SBGeneralCategoryNL = 0x0A, /**< Number: Letter Number */
SBGeneralCategoryNO = 0x0B, /**< Number: Other Number */
SBGeneralCategoryPC = 0x0C, /**< Punctuation: Connector Punctuation */
SBGeneralCategoryPD = 0x0D, /**< Punctuation: Dash Punctuation */
SBGeneralCategoryPS = 0x0E, /**< Punctuation: Open Punctuation */
SBGeneralCategoryPE = 0x0F, /**< Punctuation: Close Punctuation */
SBGeneralCategoryPI = 0x10, /**< Punctuation: Initial Punctuation */
SBGeneralCategoryPF = 0x11, /**< Punctuation: Final Punctuation */
SBGeneralCategoryPO = 0x12, /**< Punctuation: Other Punctuation */
SBGeneralCategorySM = 0x13, /**< Symbol: Math Symbol */
SBGeneralCategorySC = 0x14, /**< Symbol: Currency Symbol */
SBGeneralCategorySK = 0x15, /**< Symbol: Modifier Symbol */
SBGeneralCategorySO = 0x16, /**< Symbol: Other Symbol */
SBGeneralCategoryZS = 0x17, /**< Separator: Space Separator */
SBGeneralCategoryZL = 0x18, /**< Separator: Line Separator */
SBGeneralCategoryZP = 0x19, /**< Separator: Paragraph Separator */
SBGeneralCategoryCC = 0x1A, /**< Other: Control */
SBGeneralCategoryCF = 0x1B, /**< Other: Format */
SBGeneralCategoryCS = 0x1C, /**< Other: Surrogate */
SBGeneralCategoryCO = 0x1D, /**< Other: Private_Use */
SBGeneralCategoryCN = 0x1E /**< Other: Unassigned */
};
/**
* A type to represent the general category of a character.
*/
typedef SBUInt8 SBGeneralCategory;
/**
* Checks whether specified general category is letter.
*/
#define SBGeneralCategoryIsLetter(gc) SBUInt8InRange(gc, SBGeneralCategoryLU, SBGeneralCategoryLO)
/**
* Checks whether specified general category is mark.
*/
#define SBGeneralCategoryIsMark(gc) SBUInt8InRange(gc, SBGeneralCategoryMN, SBGeneralCategoryME)
/**
* Checks whether specified general category is number.
*/
#define SBGeneralCategoryIsNumber(gc) SBUInt8InRange(gc, SBGeneralCategoryND, SBGeneralCategoryNO)
/**
* Checks whether specified general category is punctuation.
*/
#define SBGeneralCategoryIsPunctuation(gc) SBUInt8InRange(gc, SBGeneralCategoryPC, SBGeneralCategoryPO)
/**
* Checks whether specified general category is symbol.
*/
#define SBGeneralCategoryIsSymbol(gc) SBUInt8InRange(gc, SBGeneralCategorySM, SBGeneralCategorySO)
/**
* Checks whether specified general category is separator.
*/
#define SBGeneralCategoryIsSeparator(gc) SBUInt8InRange(gc, SBGeneralCategoryZS, SBGeneralCategoryZP)
/**
* Checks whether specified general category is other.
*/
#define SBGeneralCategoryIsOther(gc) SBUInt8InRange(gc, SBGeneralCategoryCC, SBGeneralCategoryCN)
SB_EXTERN_C_END
#endif
@@ -0,0 +1,88 @@
/*
* 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 _SB_PUBLIC_LINE_H
#define _SB_PUBLIC_LINE_H
#include <juce_graphics/unicode/sheenbidi/Headers/SheenBidi/SBBase.h>
#include <juce_graphics/unicode/sheenbidi/Headers/SheenBidi/SBRun.h>
SB_EXTERN_C_BEGIN
typedef struct _SBLine *SBLineRef;
/**
* Returns the index to the first code unit of the line in source string.
*
* @param line
* The line whose offset is returned.
* @return
* The offset of the line passed in.
*/
SB_PUBLIC SBUInteger SBLineGetOffset(SBLineRef line);
/**
* Returns the number of code units coverting the length of the line.
*
* @param line
* The line whose length is returned.
* @return
* The length of the line passed in.
*/
SB_PUBLIC SBUInteger SBLineGetLength(SBLineRef line);
/**
* Returns the number of runs in the line.
*
* @param line
* The line whose run count is returned.
* @return
* The number of runs in the line passed in.
*/
SB_PUBLIC SBUInteger SBLineGetRunCount(SBLineRef line);
/**
* Returns a direct pointer to the run array, stored in the line.
*
* @param line
* The line from which to access the runs.
* @return
* A valid pointer to an array of SBRun structures.
*/
SB_PUBLIC const SBRun *SBLineGetRunsPtr(SBLineRef line);
/**
* Increments the reference count of a line object.
*
* @param line
* The line object whose reference count will be incremented.
* @return
* The same line object passed in as the parameter.
*/
SB_PUBLIC SBLineRef SBLineRetain(SBLineRef line);
/**
* Decrements the reference count of a line object. The object will be deallocated when its
* reference count reaches zero.
*
* @param line
* The line object whose reference count will be decremented.
*/
SB_PUBLIC void SBLineRelease(SBLineRef line);
SB_EXTERN_C_END
#endif
@@ -0,0 +1,108 @@
/*
* 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 _SB_PUBLIC_MIRROR_LOCATOR_H
#define _SB_PUBLIC_MIRROR_LOCATOR_H
#include <juce_graphics/unicode/sheenbidi/Headers/SheenBidi/SBBase.h>
#include <juce_graphics/unicode/sheenbidi/Headers/SheenBidi/SBCodepoint.h>
#include <juce_graphics/unicode/sheenbidi/Headers/SheenBidi/SBLine.h>
SB_EXTERN_C_BEGIN
typedef struct _SBMirrorLocator *SBMirrorLocatorRef;
/**
* A structure containing the information about a code point having Bidi_Mirrored property.
*/
typedef struct _SBMirrorAgent {
SBUInteger index; /**< The absolute index of the code point. */
SBCodepoint mirror; /**< The mirrored code point. */
SBCodepoint codepoint; /**< The actual code point. */
} SBMirrorAgent;
/**
* Creates a mirror locator object which can be used to find mirrors in a line.
*
* @return
* A reference to a mirror locator object.
*/
SB_PUBLIC SBMirrorLocatorRef SBMirrorLocatorCreate(void);
/**
* Loads a line in the locator so that its mirror can be located.
*
* @param locator
* The locator in which the line will be loaded.
* @param line
* The line which will be loaded in the locator.
* @param stringBuffer
* The string buffer from which the line's algorithm was created.
*/
SB_PUBLIC void SBMirrorLocatorLoadLine(SBMirrorLocatorRef locator, SBLineRef line,
void *stringBuffer);
/**
* Returns the agent containing the information of current located mirror.
*
* @param locator
* The locator whose agent is returned.
*/
SB_PUBLIC const SBMirrorAgent *SBMirrorLocatorGetAgent(SBMirrorLocatorRef locator);
/**
* Instructs the locator to find next mirror in the loaded line.
*
* @param locator
* The locator whom you want to instruct.
* @return
* SBTrue if another mirror is available, SBFalse otherwise.
* @note
* The locator will be reset after locating last mirror.
*/
SB_PUBLIC SBBoolean SBMirrorLocatorMoveNext(SBMirrorLocatorRef locator);
/**
* Instructs the locator to reset itself so that mirrors of the loaded line can be obatained from
* the beginning.
*
* @param locator
* The locator whom you want to reset.
*/
SB_PUBLIC void SBMirrorLocatorReset(SBMirrorLocatorRef locator);
/**
* Increments the reference count of a mirror locator object.
*
* @param locator
* The mirror locator object whose reference count will be incremented.
* @return
* The same mirror locator object passed in as the parameter.
*/
SB_PUBLIC SBMirrorLocatorRef SBMirrorLocatorRetain(SBMirrorLocatorRef locator);
/**
* Decrements the reference count of a mirror locator object. The object will be deallocated when
* its reference count reaches zero.
*
* @param locator
* The mirror locator object whose reference count will be decremented.
*/
SB_PUBLIC void SBMirrorLocatorRelease(SBMirrorLocatorRef locator);
SB_EXTERN_C_END
#endif
@@ -0,0 +1,105 @@
/*
* 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 _SB_PUBLIC_PARAGRAPH_H
#define _SB_PUBLIC_PARAGRAPH_H
#include <juce_graphics/unicode/sheenbidi/Headers/SheenBidi/SBBase.h>
#include <juce_graphics/unicode/sheenbidi/Headers/SheenBidi/SBLine.h>
SB_EXTERN_C_BEGIN
typedef struct _SBParagraph *SBParagraphRef;
/**
* Returns the index to the first code unit of the paragraph in source string.
*
* @param paragraph
* The paragraph whose offset is returned.
* @return
* The offset of the paragraph passed in.
*/
SB_PUBLIC SBUInteger SBParagraphGetOffset(SBParagraphRef paragraph);
/**
* Returns the number of code units covering the length of the paragraph.
*
* @param paragraph
* The paragraph whose length is returned.
* @return
* The length of the paragraph passed in.
*/
SB_PUBLIC SBUInteger SBParagraphGetLength(SBParagraphRef paragraph);
/**
* Returns the base level of the paragraph.
*
* @param paragraph
* The paragraph whose base level is returned.
* @return
* The base level of the paragraph passed in.
*/
SB_PUBLIC SBLevel SBParagraphGetBaseLevel(SBParagraphRef paragraph);
/**
* Returns a direct pointer to the embedding levels, stored in the paragraph.
*
* @param paragraph
* The paragraph from which to access the embedding levels.
* @return
* A valid pointer to an array of SBLevel structures.
*/
SB_PUBLIC const SBLevel *SBParagraphGetLevelsPtr(SBParagraphRef paragraph);
/**
* Creates a line object of specified range by applying rules L1-L2 of Unicode Bidirectional
* Algorithm.
*
* @param paragraph
* The paragraph that creates the line.
* @param lineOffset
* The index to the first code unit of the line in source string. It should occur within the
* range of paragraph.
* @param lineLength
* The number of code units covering the length of the line.
* @return
* A reference to a line object if the call was successful, NULL otherwise.
*/
SB_PUBLIC SBLineRef SBParagraphCreateLine(SBParagraphRef paragraph, SBUInteger lineOffset,
SBUInteger lineLength);
/**
* Increments the reference count of a paragraph object.
*
* @param paragraph
* The paragraph object whose reference count will be incremented.
* @return
* The same paragraph object passed in as the parameter.
*/
SB_PUBLIC SBParagraphRef SBParagraphRetain(SBParagraphRef paragraph);
/**
* Decrements the reference count of a paragraph object. The object will be deallocated when its
* reference count reaches zero.
*
* @param paragraph
* The paragraph object whose reference count will be decremented.
*/
SB_PUBLIC void SBParagraphRelease(SBParagraphRef paragraph);
SB_EXTERN_C_END
#endif
@@ -0,0 +1,36 @@
/*
* 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.
* 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_RUN_H
#define _SB_PUBLIC_RUN_H
#include <juce_graphics/unicode/sheenbidi/Headers/SheenBidi/SBBase.h>
SB_EXTERN_C_BEGIN
/**
* A structure containing the information of a sequence of characters having the same embedding
* level.
*/
typedef struct _SBRun {
SBUInteger offset; /**< The index to the first code unit of the run in source string. */
SBUInteger length; /**< The number of code units covering the length of the run. */
SBLevel level; /**< The embedding level of the run. */
} SBRun;
SB_EXTERN_C_END
#endif
@@ -0,0 +1,289 @@
/*
* 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_SCRIPT_H
#define _SB_PUBLIC_SCRIPT_H
#include <juce_graphics/unicode/sheenbidi/Headers/SheenBidi/SBBase.h>
SB_EXTERN_C_BEGIN
/**
* Constants that specify the script of a character.
*/
enum {
SBScriptNil = 0x00,
SBScriptZINH = 0x01, /**< Inherited */
SBScriptZYYY = 0x02, /**< Common */
SBScriptZZZZ = 0x03, /**< Unknown */
/* Unicode 1.1 */
SBScriptARAB = 0x04, /**< Arabic */
SBScriptARMN = 0x05, /**< Armenian */
SBScriptBENG = 0x06, /**< Bengali */
SBScriptBOPO = 0x07, /**< Bopomofo */
SBScriptCYRL = 0x08, /**< Cyrillic */
SBScriptDEVA = 0x09, /**< Devanagari */
SBScriptGEOR = 0x0A, /**< Georgian */
SBScriptGREK = 0x0B, /**< Greek */
SBScriptGUJR = 0x0C, /**< Gujarati */
SBScriptGURU = 0x0D, /**< Gurmukhi */
SBScriptHANG = 0x0E, /**< Hangul */
SBScriptHANI = 0x0F, /**< Han */
SBScriptHEBR = 0x10, /**< Hebrew */
SBScriptHIRA = 0x11, /**< Hiragana */
SBScriptKANA = 0x12, /**< Katakana */
SBScriptKNDA = 0x13, /**< Kannada */
SBScriptLAOO = 0x14, /**< Lao */
SBScriptLATN = 0x15, /**< Latin */
SBScriptMLYM = 0x16, /**< Malayalam */
SBScriptORYA = 0x17, /**< Oriya */
SBScriptTAML = 0x18, /**< Tamil */
SBScriptTELU = 0x19, /**< Telugu */
SBScriptTHAI = 0x1A, /**< Thai */
/* Unicode 2.0 */
SBScriptTIBT = 0x1B, /**< Tibetan */
/* Unicode 3.0 */
SBScriptBRAI = 0x1C, /**< Braille */
SBScriptCANS = 0x1D, /**< Canadian_Aboriginal */
SBScriptCHER = 0x1E, /**< Cherokee */
SBScriptETHI = 0x1F, /**< Ethiopic */
SBScriptKHMR = 0x20, /**< Khmer */
SBScriptMONG = 0x21, /**< Mongolian */
SBScriptMYMR = 0x22, /**< Myanmar */
SBScriptOGAM = 0x23, /**< Ogham */
SBScriptRUNR = 0x24, /**< Runic */
SBScriptSINH = 0x25, /**< Sinhala */
SBScriptSYRC = 0x26, /**< Syriac */
SBScriptTHAA = 0x27, /**< Thaana */
SBScriptYIII = 0x28, /**< Yi */
/* Unicode 3.1 */
SBScriptDSRT = 0x29, /**< Deseret */
SBScriptGOTH = 0x2A, /**< Gothic */
SBScriptITAL = 0x2B, /**< Old_Italic */
/* Unicode 3.2 */
SBScriptBUHD = 0x2C, /**< Buhid */
SBScriptHANO = 0x2D, /**< Hanunoo */
SBScriptTAGB = 0x2E, /**< Tagbanwa */
SBScriptTGLG = 0x2F, /**< Tagalog */
/* Unicode 4.0 */
SBScriptCPRT = 0x30, /**< Cypriot */
SBScriptLIMB = 0x31, /**< Limbu */
SBScriptLINB = 0x32, /**< Linear_B */
SBScriptOSMA = 0x33, /**< Osmanya */
SBScriptSHAW = 0x34, /**< Shavian */
SBScriptTALE = 0x35, /**< Tai_Le */
SBScriptUGAR = 0x36, /**< Ugaritic */
/* Unicode 4.1 */
SBScriptBUGI = 0x37, /**< Buginese */
SBScriptCOPT = 0x38, /**< Coptic */
SBScriptGLAG = 0x39, /**< Glagolitic */
SBScriptKHAR = 0x3A, /**< Kharoshthi */
SBScriptSYLO = 0x3B, /**< Syloti_Nagri */
SBScriptTALU = 0x3C, /**< New_Tai_Lue */
SBScriptTFNG = 0x3D, /**< Tifinagh */
SBScriptXPEO = 0x3E, /**< Old_Persian */
/* Unicode 5.0 */
SBScriptBALI = 0x3F, /**< Balinese */
SBScriptNKOO = 0x40, /**< Nko */
SBScriptPHAG = 0x41, /**< Phags_Pa */
SBScriptPHNX = 0x42, /**< Phoenician */
SBScriptXSUX = 0x43, /**< Cuneiform */
/* Unicode 5.1 */
SBScriptCARI = 0x44, /**< Carian */
SBScriptCHAM = 0x45, /**< Cham */
SBScriptKALI = 0x46, /**< Kayah_Li */
SBScriptLEPC = 0x47, /**< Lepcha */
SBScriptLYCI = 0x48, /**< Lycian */
SBScriptLYDI = 0x49, /**< Lydian */
SBScriptOLCK = 0x4A, /**< Ol_Chiki */
SBScriptRJNG = 0x4B, /**< Rejang */
SBScriptSAUR = 0x4C, /**< Saurashtra */
SBScriptSUND = 0x4D, /**< Sundanese */
SBScriptVAII = 0x4E, /**< Vai */
/* Unicode 5.2 */
SBScriptARMI = 0x4F, /**< Imperial_Aramaic */
SBScriptAVST = 0x50, /**< Avestan */
SBScriptBAMU = 0x51, /**< Bamum */
SBScriptEGYP = 0x52, /**< Egyptian_Hieroglyphs */
SBScriptJAVA = 0x53, /**< Javanese */
SBScriptKTHI = 0x54, /**< Kaithi */
SBScriptLANA = 0x55, /**< Tai_Tham */
SBScriptLISU = 0x56, /**< Lisu */
SBScriptMTEI = 0x57, /**< Meetei_Mayek */
SBScriptORKH = 0x58, /**< Old_Turkic */
SBScriptPHLI = 0x59, /**< Inscriptional_Pahlavi */
SBScriptPRTI = 0x5A, /**< Inscriptional_Parthian */
SBScriptSAMR = 0x5B, /**< Samaritan */
SBScriptSARB = 0x5C, /**< Old_South_Arabian */
SBScriptTAVT = 0x5D, /**< Tai_Viet */
/* Unicode 6.0 */
SBScriptBATK = 0x5E, /**< Batak */
SBScriptBRAH = 0x5F, /**< Brahmi */
SBScriptMAND = 0x60, /**< Mandaic */
/* Unicode 6.1 */
SBScriptCAKM = 0x61, /**< Chakma */
SBScriptMERC = 0x62, /**< Meroitic_Cursive */
SBScriptMERO = 0x63, /**< Meroitic_Hieroglyphs */
SBScriptPLRD = 0x64, /**< Miao */
SBScriptSHRD = 0x65, /**< Sharada */
SBScriptSORA = 0x66, /**< Sora_Sompeng */
SBScriptTAKR = 0x67, /**< Takri */
/* Unicode 7.0 */
SBScriptAGHB = 0x68, /**< Caucasian_Albanian */
SBScriptBASS = 0x69, /**< Bassa_Vah */
SBScriptDUPL = 0x6A, /**< Duployan */
SBScriptELBA = 0x6B, /**< Elbasan */
SBScriptGRAN = 0x6C, /**< Grantha */
SBScriptHMNG = 0x6D, /**< Pahawh_Hmong */
SBScriptKHOJ = 0x6E, /**< Khojki */
SBScriptLINA = 0x6F, /**< Linear_A */
SBScriptMAHJ = 0x70, /**< Mahajani */
SBScriptMANI = 0x71, /**< Manichaean */
SBScriptMEND = 0x72, /**< Mende_Kikakui */
SBScriptMODI = 0x73, /**< Modi */
SBScriptMROO = 0x74, /**< Mro */
SBScriptNARB = 0x75, /**< Old_North_Arabian */
SBScriptNBAT = 0x76, /**< Nabataean */
SBScriptPALM = 0x77, /**< Palmyrene */
SBScriptPAUC = 0x78, /**< Pau_Cin_Hau */
SBScriptPERM = 0x79, /**< Old_Permic */
SBScriptPHLP = 0x7A, /**< Psalter_Pahlavi */
SBScriptSIDD = 0x7B, /**< Siddham */
SBScriptSIND = 0x7C, /**< Khudawadi */
SBScriptTIRH = 0x7D, /**< Tirhuta */
SBScriptWARA = 0x7E, /**< Warang_Citi */
/* Unicode 8.0 */
SBScriptAHOM = 0x7F, /**< Ahom */
SBScriptHATR = 0x80, /**< Hatran */
SBScriptHLUW = 0x81, /**< Anatolian_Hieroglyphs */
SBScriptHUNG = 0x82, /**< Old_Hungarian */
SBScriptMULT = 0x83, /**< Multani */
SBScriptSGNW = 0x84, /**< SignWriting */
/* Unicode 9.0 */
SBScriptADLM = 0x85, /**< Adlam */
SBScriptBHKS = 0x86, /**< Bhaiksuki */
SBScriptMARC = 0x87, /**< Marchen */
SBScriptNEWA = 0x88, /**< Newa */
SBScriptOSGE = 0x89, /**< Osage */
SBScriptTANG = 0x8A, /**< Tangut */
/* Unicode 10.0 */
SBScriptGONM = 0x8B, /**< Masaram_Gondi */
SBScriptNSHU = 0x8C, /**< Nushu */
SBScriptSOYO = 0x8D, /**< Soyombo */
SBScriptZANB = 0x8E, /**< Zanabazar_Square */
/* Unicode 11.0 */
SBScriptDOGR = 0x8F, /**< Dogra */
SBScriptGONG = 0x90, /**< Gunjala_Gondi */
SBScriptMAKA = 0x91, /**< Makasar */
SBScriptMEDF = 0x92, /**< Medefaidrin */
SBScriptROHG = 0x93, /**< Hanifi_Rohingya */
SBScriptSOGD = 0x94, /**< Sogdian */
SBScriptSOGO = 0x95, /**< Old_Sogdian */
/* Unicode 12.0 */
SBScriptELYM = 0x96, /**< Elymaic */
SBScriptHMNP = 0x97, /**< Nyiakeng_Puachue_Hmong */
SBScriptNAND = 0x98, /**< Nandinagari */
SBScriptWCHO = 0x99, /**< Wancho */
/* Unicde 13.0 */
SBScriptCHRS = 0x9A, /**< Chorasmian */
SBScriptDIAK = 0x9B, /**< Dives_Akuru */
SBScriptKITS = 0x9C, /**< Khitan_Small_Script */
SBScriptYEZI = 0x9D, /**< Yezidi */
/* Unicde 14.0 */
SBScriptCPMN = 0x9E, /**< Cypro_Minoan */
SBScriptOUGR = 0x9F, /**< Old_Uyghur */
SBScriptTNSA = 0xA0, /**< Tangsa */
SBScriptTOTO = 0xA1, /**< Toto */
SBScriptVITH = 0xA2, /**< Vithkuqi */
/* Unicde 15.1 */
SBScriptKAWI = 0xA3, /**< Kawi */
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 */
};
/**
* A type to represent the script of a character.
*/
typedef SBUInt8 SBScript;
/**
* Returns the OpenType tag of a script as UInt32 in big endian byte order. The association between
* Unicode Script property and OpenType script tags is taken from the specification:
* https://docs.microsoft.com/en-us/typography/opentype/spec/scripttags.
*
* If more than one tag is associated with a script, then the latest one is retured. For example,
* Devanagari script has two tags, `deva` and `dev2`. So in this case, `dev2` will be returned.
*
* If no tag is associated with a script, then `DFLT` is returned.
*
* @param script
* The script whose OpenType tag is returned.
* @return
* The OpenType tag of specified script as UInt32 in big endian byte order.
*/
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
@@ -0,0 +1,106 @@
/*
* 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_SCRIPT_LOCATOR_H
#define _SB_PUBLIC_SCRIPT_LOCATOR_H
#include <juce_graphics/unicode/sheenbidi/Headers/SheenBidi/SBBase.h>
#include <juce_graphics/unicode/sheenbidi/Headers/SheenBidi/SBCodepointSequence.h>
#include <juce_graphics/unicode/sheenbidi/Headers/SheenBidi/SBScript.h>
SB_EXTERN_C_BEGIN
typedef struct _SBScriptLocator *SBScriptLocatorRef;
/**
* A structure containing the information about a run of code points having same script.
*/
typedef struct _SBScriptAgent {
SBUInteger offset; /**< The index to the first code unit of the run in source string. */
SBUInteger length; /**< The number of code units covering the length of the run. */
SBScript script; /**< The script of the run. */
} SBScriptAgent;
/**
* Creates a script locator object which can be used to find script runs in a string.
*
* @return
* A reference to a script locator object.
*/
SB_PUBLIC SBScriptLocatorRef SBScriptLocatorCreate(void);
/**
* Loads a code point sequence in the locator so that its script runs can be located.
*
* @param locator
* The locator in which the code point sequence will be loaded.
* @param codepointSequence
* The code point sequence which will be loaded in the locator.
*/
SB_PUBLIC void SBScriptLocatorLoadCodepoints(SBScriptLocatorRef locator,
const SBCodepointSequence *codepointSequence);
/**
* Returns the agent containing the information of current located script run.
*
* @param locator
* The locator whose agent is returned.
*/
SB_PUBLIC const SBScriptAgent *SBScriptLocatorGetAgent(SBScriptLocatorRef locator);
/**
* Instructs the locator to find next script run in the loaded code point sequence.
*
* @param locator
* The locator whom you want to instruct.
* @return
* SBTrue if another script run is available, SBFalse otherwise.
* @note
* The locator will be reset after locating last script run.
*/
SB_PUBLIC SBBoolean SBScriptLocatorMoveNext(SBScriptLocatorRef locator);
/**
* Instructs the locator to reset itself so that script runs of the loaded line can be obatained
* from the beginning.
*
* @param locator
* The locator whom you want to reset.
*/
SB_PUBLIC void SBScriptLocatorReset(SBScriptLocatorRef locator);
/**
* Increments the reference count of a script locator object.
*
* @param locator
* The script locator object whose reference count will be incremented.
* @return
* The same script locator object passed in as the parameter.
*/
SB_PUBLIC SBScriptLocatorRef SBScriptLocatorRetain(SBScriptLocatorRef locator);
/**
* Decrements the reference count of a script locator object. The object will be deallocated when
* its reference count reaches zero.
*
* @param locator
* The script locator object whose reference count will be decremented.
*/
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 <juce_graphics/unicode/sheenbidi/Headers/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 <juce_graphics/unicode/sheenbidi/Headers/SheenBidi/SBAlgorithm.h>
#include <juce_graphics/unicode/sheenbidi/Headers/SheenBidi/SBBase.h>
#include <juce_graphics/unicode/sheenbidi/Headers/SheenBidi/SBBidiType.h>
#include <juce_graphics/unicode/sheenbidi/Headers/SheenBidi/SBCodepoint.h>
#include <juce_graphics/unicode/sheenbidi/Headers/SheenBidi/SBCodepointSequence.h>
#include <juce_graphics/unicode/sheenbidi/Headers/SheenBidi/SBGeneralCategory.h>
#include <juce_graphics/unicode/sheenbidi/Headers/SheenBidi/SBLine.h>
#include <juce_graphics/unicode/sheenbidi/Headers/SheenBidi/SBMirrorLocator.h>
#include <juce_graphics/unicode/sheenbidi/Headers/SheenBidi/SBParagraph.h>
#include <juce_graphics/unicode/sheenbidi/Headers/SheenBidi/SBRun.h>
#include <juce_graphics/unicode/sheenbidi/Headers/SheenBidi/SBScript.h>
#include <juce_graphics/unicode/sheenbidi/Headers/SheenBidi/SBScriptLocator.h>
#include <juce_graphics/unicode/sheenbidi/Headers/SheenBidi/SBVersion.h>
#endif