Back to index

scribus-ng  1.3.4.dfsg+svn20071115
hyphen.h
Go to the documentation of this file.
00001 /*
00002 For general Scribus (>=1.3.2) copyright and licensing information please refer
00003 to the COPYING file provided with the program. Following this notice may exist
00004 a copyright and/or license notice that predates the release of Scribus 1.3.2
00005 for which a new license (GPL+exception) is in place.
00006 */
00007 /* LibHnj is dual licensed under LGPL and MPL. Boilerplate for both
00008  * licenses follows.
00009  */
00010 
00011 /* LibHnj - a library for high quality hyphenation and justification
00012  * Copyright (C) 1998 Raph Levien, (C) 2001 ALTLinux, Moscow
00013  *
00014  * This library is free software; you can redistribute it and/or
00015  * modify it under the terms of the GNU Library General Public
00016  * License as published by the Free Software Foundation; either
00017  * version 2 of the License, or (at your option) any later version.
00018  *
00019  * This library is distributed in the hope that it will be useful,
00020  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00021  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00022  * Library General Public License for more details.
00023  *
00024  * You should have received a copy of the GNU Library General Public
00025  * License along with this library; if not, write to the 
00026  * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 
00027  * Boston, MA  02111-1307  USA.
00028 */
00029 
00030 /*
00031  * The contents of this file are subject to the Mozilla Public License
00032  * Version 1.0 (the "MPL"); you may not use this file except in
00033  * compliance with the MPL.  You may obtain a copy of the MPL at
00034  * http://www.mozilla.org/MPL/
00035  *
00036  * Software distributed under the MPL is distributed on an "AS IS" basis,
00037  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the MPL
00038  * for the specific language governing rights and limitations under the
00039  * MPL.
00040  *
00041  */
00042 #ifndef __HYPHEN_H__
00043 #define __HYPHEN_H__
00044 
00045 #ifdef __cplusplus
00046 extern "C" {
00047 #endif /* __cplusplus */
00048 
00049 typedef struct _HyphenDict HyphenDict;
00050 typedef struct _HyphenState HyphenState;
00051 typedef struct _HyphenTrans HyphenTrans;
00052 #define MAX_CHARS 256
00053 #define MAX_NAME 20
00054 
00055 struct _HyphenDict {
00056   int num_states;
00057   char cset[MAX_NAME];
00058   HyphenState *states;
00059 };
00060 
00061 struct _HyphenState {
00062   char *match;
00063   int fallback_state;
00064   int num_trans;
00065   HyphenTrans *trans;
00066 };
00067 
00068 struct _HyphenTrans {
00069   char ch;
00070   int new_state;
00071 };
00072 
00073 HyphenDict *hnj_hyphen_load (const char *fn);
00074 void hnj_hyphen_free (HyphenDict *dict);
00075 int hnj_hyphen_hyphenate (HyphenDict *dict,
00076                         const char *word, int word_size,
00077                         char *hyphens);
00078 
00079 #ifdef __cplusplus
00080 }
00081 #endif /* __cplusplus */
00082 
00083 #endif /* __HYPHEN_H__ */