1 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 * This file is based on usc_impl.c from ICU 4.2.0.1, slightly adapted
8 * for use within Mozilla Gecko, separate from a standard ICU build.
10 * The original ICU license of the code follows:
12 * ICU License - ICU 1.8.1 and later
14 * COPYRIGHT AND PERMISSION NOTICE
16 * Copyright (c) 1995-2009 International Business Machines Corporation and
19 * All rights reserved.
21 * Permission is hereby granted, free of charge, to any person obtaining a
22 * copy of this software and associated documentation files (the "Software"),
23 * to deal in the Software without restriction, including without limitation
24 * the rights to use, copy, modify, merge, publish, distribute, and/or sell
25 * copies of the Software, and to permit persons to whom the Software is
26 * furnished to do so, provided that the above copyright notice(s) and this
27 * permission notice appear in all copies of the Software and that both the
28 * above copyright notice(s) and this permission notice appear in supporting
31 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
32 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
33 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
34 * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE
35 * BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES,
36 * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
37 * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
38 * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
41 * Except as contained in this notice, the name of a copyright holder shall
42 * not be used in advertising or otherwise to promote the sale, use or other
43 * dealings in this Software without prior written authorization of the
46 * All trademarks and registered trademarks mentioned herein are the property
47 * of their respective owners.
50 #ifndef GFX_SCRIPTITEMIZER_H
51 #define GFX_SCRIPTITEMIZER_H
54 #include "mozilla/intl/UnicodeScriptCodes.h"
56 #define PAREN_STACK_DEPTH 32
58 class gfxScriptItemizer
{
60 typedef mozilla::intl::Script Script
;
62 gfxScriptItemizer(const char16_t
* src
, uint32_t length
);
64 void SetText(const char16_t
* src
, uint32_t length
);
66 bool Next(uint32_t& aRunStart
, uint32_t& aRunLimit
, Script
& aRunScript
);
72 scriptCode
= Script::INVALID
;
78 void push(uint32_t endPairChar
, Script newScriptCode
);
80 void fixup(Script newScriptCode
);
82 struct ParenStackEntry
{
87 const char16_t
* textPtr
;
94 struct ParenStackEntry parenStack
[PAREN_STACK_DEPTH
];
100 #endif /* GFX_SCRIPTITEMIZER_H */