SuperTuxKart 1.5 upstream source (from official release tarball)
This commit is contained in:
@@ -0,0 +1,119 @@
|
||||
/*
|
||||
* Copyright (C) 2016-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_ALGORITHM_H
|
||||
#define _SB_PUBLIC_ALGORITHM_H
|
||||
|
||||
#include "SBBase.h"
|
||||
#include "SBBidiType.h"
|
||||
#include "SBCodepointSequence.h"
|
||||
#include "SBParagraph.h"
|
||||
|
||||
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.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
void SBAlgorithmRelease(SBAlgorithmRef algorithm);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,119 @@
|
||||
/*
|
||||
* Copyright (C) 2014-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_BASE_H
|
||||
#define _SB_PUBLIC_BASE_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* 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_BIDI_TYPE_H
|
||||
#define _SB_PUBLIC_BIDI_TYPE_H
|
||||
|
||||
#include "SBBase.h"
|
||||
|
||||
/**
|
||||
* 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)
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
* 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
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright (C) 2016-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_SEQUENCE_H
|
||||
#define _SB_PUBLIC_CODEPOINT_SEQUENCE_H
|
||||
|
||||
#include "SBBase.h"
|
||||
#include "SBCodepoint.h"
|
||||
|
||||
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. */
|
||||
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.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
SBCodepoint SBCodepointSequenceGetCodepointAt(const SBCodepointSequence *codepointSequence,
|
||||
SBUInteger *stringIndex);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright (C) 2014 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_LOG */
|
||||
/* #define SB_CONFIG_UNITY */
|
||||
|
||||
#ifdef SB_CONFIG_UNITY
|
||||
#define SB_INTERNAL static
|
||||
#else
|
||||
#define SB_INTERNAL
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
* 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_GENERAL_CATEGORY_H
|
||||
#define _SB_PUBLIC_GENERAL_CATEGORY_H
|
||||
|
||||
#include "SBBase.h"
|
||||
|
||||
/**
|
||||
* 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)
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* Copyright (C) 2014-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_LINE_H
|
||||
#define _SB_PUBLIC_LINE_H
|
||||
|
||||
#include "SBBase.h"
|
||||
#include "SBRun.h"
|
||||
|
||||
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.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
void SBLineRelease(SBLineRef line);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
* Copyright (C) 2014-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_MIRROR_LOCATOR_H
|
||||
#define _SB_PUBLIC_MIRROR_LOCATOR_H
|
||||
|
||||
#include "SBBase.h"
|
||||
#include "SBCodepoint.h"
|
||||
#include "SBLine.h"
|
||||
|
||||
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.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
void SBMirrorLocatorRelease(SBMirrorLocatorRef locator);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
* Copyright (C) 2014-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_PARAGRAPH_H
|
||||
#define _SB_PUBLIC_PARAGRAPH_H
|
||||
|
||||
#include "SBBase.h"
|
||||
#include "SBLine.h"
|
||||
|
||||
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.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
void SBParagraphRelease(SBParagraphRef paragraph);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright (C) 2016-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_RUN_H
|
||||
#define _SB_PUBLIC_RUN_H
|
||||
|
||||
#include "SBBase.h"
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,247 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2019 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 "SBBase.h"
|
||||
|
||||
/**
|
||||
* 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 */
|
||||
};
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
SBUInt32 SBScriptGetOpenTypeTag(SBScript script);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,101 @@
|
||||
/*
|
||||
* 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_SCRIPT_LOCATOR_H
|
||||
#define _SB_PUBLIC_SCRIPT_LOCATOR_H
|
||||
|
||||
#include "SBBase.h"
|
||||
#include "SBCodepointSequence.h"
|
||||
#include "SBScript.h"
|
||||
|
||||
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.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
void SBScriptLocatorRelease(SBScriptLocatorRef locator);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (C) 2014-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 _SHEEN_BIDI_H
|
||||
#define _SHEEN_BIDI_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"
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user