1
0
Fork 0
mirror of https://github.com/geometer/FBReaderJ.git synced 2025-10-04 18:29:23 +02:00

java version of FontManager

This commit is contained in:
Nikolay Pultsin 2014-03-31 12:04:39 +03:00
parent 43bfe572f7
commit 7ca30d0c9e
2 changed files with 40 additions and 0 deletions

View file

@ -312,6 +312,9 @@ JNIEXPORT jint JNICALL Java_org_geometerplus_fbreader_formats_NativeFormatPlugin
} }
env->DeleteLocalRef(javaFootnoteModel); env->DeleteLocalRef(javaFootnoteModel);
} }
// TODO: synchronize FontManager
return 0; return 0;
} }

View file

@ -0,0 +1,37 @@
/*
* Copyright (C) 2007-2014 Geometer Plus <contact@geometerplus.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
package org.geometerplus.zlibrary.text.fonts;
import java.util.ArrayList;
import java.util.List;
public class FontManager {
private final ArrayList<List<String>> myFamilyLists = new ArrayList<List<String>>();
public synchronized int index(List<String> families) {
for (int i = 0; i < myFamilyLists.size(); ++i) {
if (myFamilyLists.get(i).equals(families)) {
return i;
}
}
myFamilyLists.add(new ArrayList<String>(families));
return myFamilyLists.size() - 1;
}
}