Skip to content

Commit

Permalink
Merge branch 'master' of github.com:buggins/coolreader
Browse files Browse the repository at this point in the history
  • Loading branch information
buggins committed Apr 21, 2021
2 parents e51df85 + 8f974f4 commit 0345ca3
Show file tree
Hide file tree
Showing 121 changed files with 2,604 additions and 1,871 deletions.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ else()
ADD_DEFINITIONS( -DLINUX=1 -D_LINUX=1 )
endif(MAC)

# Large files support
ADD_DEFINITIONS( -D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64 -DLVLONG_FILE_SUPPORT=1 )

if (NOT DEFINED GRAY_BACKBUFFER_BITS)
SET(GRAY_BACKBUFFER_BITS 2)
endif (NOT DEFINED GRAY_BACKBUFFER_BITS)
Expand Down
1 change: 1 addition & 0 deletions android/app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ add_definitions(-DDOC_DATA_COMPRESSION_LEVEL=1 -DDOC_BUFFER_SIZE=0x1000000)
add_definitions(-DENABLE_CACHE_FILE_CONTENTS_VALIDATION=1)
add_definitions(-DLDOM_USE_OWN_MEM_MAN=0)
add_definitions(-DCR3_ANTIWORD_PATCH=1 -DENABLE_ANTIWORD=1)
add_definitions(-DLVLONG_FILE_SUPPORT=1)
add_definitions(-DMAX_IMAGE_SCALE_MUL=2)
add_definitions(-DUSE_NANOSVG=1)
add_definitions(-DBUNDLED_FRIBIDI=1)
Expand Down
2 changes: 1 addition & 1 deletion android/app/thirdparty_libs/harfbuzz/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ LOCAL_SRC_FILES := \
$(HARFBUZZ_SRC_DIR)/src/hb-ot-shape-complex-indic-table.cc \
$(HARFBUZZ_SRC_DIR)/src/hb-ot-shape-complex-khmer.cc \
$(HARFBUZZ_SRC_DIR)/src/hb-ot-shape-complex-myanmar.cc \
$(HARFBUZZ_SRC_DIR)/src/hb-ot-shape-complex-syllabic.cc \
$(HARFBUZZ_SRC_DIR)/src/hb-ot-shape-complex-thai.cc \
$(HARFBUZZ_SRC_DIR)/src/hb-ot-shape-complex-use.cc \
$(HARFBUZZ_SRC_DIR)/src/hb-ot-shape-complex-use-table.cc \
$(HARFBUZZ_SRC_DIR)/src/hb-ot-shape-complex-vowel-constraints.cc \
$(HARFBUZZ_SRC_DIR)/src/hb-ot-shape-fallback.cc \
$(HARFBUZZ_SRC_DIR)/src/hb-ot-shape-normalize.cc \
Expand Down
2 changes: 1 addition & 1 deletion android/app/thirdparty_libs/harfbuzz/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ set(HARFBUZZ_SRC_FILES
${HARFBUZZ_SRC_DIR}/src/hb-ot-shape-complex-indic-table.cc
${HARFBUZZ_SRC_DIR}/src/hb-ot-shape-complex-khmer.cc
${HARFBUZZ_SRC_DIR}/src/hb-ot-shape-complex-myanmar.cc
${HARFBUZZ_SRC_DIR}/src/hb-ot-shape-complex-syllabic.cc
${HARFBUZZ_SRC_DIR}/src/hb-ot-shape-complex-thai.cc
${HARFBUZZ_SRC_DIR}/src/hb-ot-shape-complex-use.cc
${HARFBUZZ_SRC_DIR}/src/hb-ot-shape-complex-use-table.cc
${HARFBUZZ_SRC_DIR}/src/hb-ot-shape-complex-vowel-constraints.cc
${HARFBUZZ_SRC_DIR}/src/hb-ot-shape-fallback.cc
${HARFBUZZ_SRC_DIR}/src/hb-ot-shape-normalize.cc
Expand Down
18 changes: 3 additions & 15 deletions android/app/thirdparty_libs/harfbuzz/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#define HAVE_FREETYPE 1

/* Define to 1 if you have the `FT_Done_MM_Var' function. */
/* #undef HAVE_FT_DONE_MM_VAR */
#define HAVE_FT_DONE_MM_VAR 1

/* Define to 1 if you have the `FT_Get_Var_Blend_Coordinates' function. */
/* #undef HAVE_FT_GET_VAR_BLEND_COORDINATES */
Expand Down Expand Up @@ -64,9 +64,6 @@
/* Use hb-icu Unicode callbacks */
/* #undef HAVE_ICU_BUILTIN */

/* Have Intel __sync_* atomic primitives */
#define HAVE_INTEL_ATOMIC_PRIMITIVES 1

/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1

Expand All @@ -88,15 +85,6 @@
/* Have PTHREAD_PRIO_INHERIT. */
#define HAVE_PTHREAD_PRIO_INHERIT 1

/* Define to 1 if you have the <sched.h> header file. */
/* #undef HAVE_SCHED_H */

/* Have sched_yield */
/* #undef HAVE_SCHED_YIELD */

/* Have Solaris __machine_*_barrier and atomic_* operations */
/* #undef HAVE_SOLARIS_ATOMIC_OPS */

/* Define to 1 if you have the <stdbool.h> header file. */
#define HAVE_STDBOOL_H 1

Expand Down Expand Up @@ -146,7 +134,7 @@
#define PACKAGE_NAME "HarfBuzz"

/* Define to the full name and version of this package. */
#define PACKAGE_STRING "HarfBuzz 2.7.4"
#define PACKAGE_STRING "HarfBuzz 2.8.0"

/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "harfbuzz"
Expand All @@ -155,7 +143,7 @@
#define PACKAGE_URL "http://harfbuzz.org/"

/* Define to the version of this package. */
#define PACKAGE_VERSION "2.7.4"
#define PACKAGE_VERSION "2.8.0"

/* Define to necessary symbol if this constant uses a non-standard name on
your system. */
Expand Down
1 change: 1 addition & 0 deletions android/jni/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ CRFLAGS := -DLINUX=1 -D_LINUX=1 -DFOR_ANDROID=1 -DCR3_PATCH \
-DENABLE_CACHE_FILE_CONTENTS_VALIDATION=1 \
-DLDOM_USE_OWN_MEM_MAN=0 \
-DCR3_ANTIWORD_PATCH=1 -DENABLE_ANTIWORD=1 \
-DLVLONG_FILE_SUPPORT=1 \
-DMAX_IMAGE_SCALE_MUL=2 \
-DUSE_NANOSVG=1 \
-DBUNDLED_FRIBIDI=1 \
Expand Down
53 changes: 51 additions & 2 deletions android/jni/cr3engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class BookProperties
lString32 title;
lString32 author;
lString32 series;
int filesize;
long filesize;
lString32 filedate;
int seriesNumber;
lString32 language;
Expand Down Expand Up @@ -336,7 +336,7 @@ static bool GetBookProperties(const char *name, BookProperties * pBookProps)
time_t t = (time_t)time(0);

if ( isArchiveFile ) {
int arcsize = (int)stream->GetSize();
lvsize_t arcsize = stream->GetSize();
LVContainerRef container = LVOpenArchieve(stream);
if ( container.isNull() ) {
CRLog::error( "Cannot read archive contents from %s", LCSTR(arcPathName) );
Expand Down Expand Up @@ -921,6 +921,52 @@ JNIEXPORT jobjectArray JNICALL Java_org_coolreader_crengine_Engine_getFontFileNa
return env.toJavaStringArray(list);
}

/*
* Class: org_coolreader_crengine_Engine
* Method: getAvailableFontWeightInternal
* Signature: (Ljava/lang/String;)[I
*/
JNIEXPORT jintArray JNICALL Java_org_coolreader_crengine_Engine_getAvailableFontWeightInternal
(JNIEnv * penv, jclass cls, jstring fontFace)
{
LOGI("getAvailableFontWeightInternal called");
CRJNIEnv env(penv);
lString32 fontFace32 = env.fromJavaString(fontFace);
LVArray<int> weights;
fontMan->GetAvailableFontWeights(weights, UnicodeToUtf8(fontFace32));
int len = weights.length();
jintArray array = env->NewIntArray(len);
if (NULL != array)
env->SetIntArrayRegion(array, 0, len, weights.get());
return array;
}

/*
* Class: org_coolreader_crengine_Engine
* Method: getAvailableSynthFontWeightInternal
* Signature: ()[I
*/
JNIEXPORT jintArray JNICALL Java_org_coolreader_crengine_Engine_getAvailableSynthFontWeightInternal
(JNIEnv * penv, jclass cls)
{
LOGI("getAvailableSynthFontWeightInternal called");
CRJNIEnv env(penv);
#if USE_FT_EMBOLDEN
int available_synth_weight[] = {
300, 400, 450, 475, 500, 525, 550, 600, 700, 800, 900
};
#else
int available_synth_weight[] = {
600
};
#endif
int len = sizeof(available_synth_weight)/sizeof(int);
jintArray array = env->NewIntArray(len);
if (NULL != array)
env->SetIntArrayRegion(array, 0, len, available_synth_weight);
return array;
}

/*
* Class: org_coolreader_crengine_Engine
* Method: setCacheDirectoryInternal
Expand Down Expand Up @@ -1121,6 +1167,9 @@ static JNINativeMethod sEngineMethods[] = {
{"uninitInternal", "()V", (void*)Java_org_coolreader_crengine_Engine_uninitInternal},
{"initDictionaries", "([Lorg/coolreader/crengine/Engine$HyphDict;)Z", (void*)Java_org_coolreader_crengine_Engine_initDictionaries},
{"getFontFaceListInternal", "()[Ljava/lang/String;", (void*)Java_org_coolreader_crengine_Engine_getFontFaceListInternal},
{"getFontFileNameListInternal", "()[Ljava/lang/String;", (void*)Java_org_coolreader_crengine_Engine_getFontFileNameListInternal},
{"getAvailableFontWeightInternal", "(Ljava/lang/String;)[I", (void*)Java_org_coolreader_crengine_Engine_getAvailableFontWeightInternal},
{"getAvailableSynthFontWeightInternal", "()[I", (void*)Java_org_coolreader_crengine_Engine_getAvailableSynthFontWeightInternal},
{"setCacheDirectoryInternal", "(Ljava/lang/String;I)Z", (void*)Java_org_coolreader_crengine_Engine_setCacheDirectoryInternal},
{"scanBookPropertiesInternal", "(Lorg/coolreader/crengine/FileInfo;)Z", (void*)Java_org_coolreader_crengine_Engine_scanBookPropertiesInternal},
{"updateFileCRC32Internal", "(Lorg/coolreader/crengine/FileInfo;)Z", (void*)Java_org_coolreader_crengine_Engine_updateFileCRC32Internal},
Expand Down
8 changes: 0 additions & 8 deletions android/jni/org_coolreader_crengine_DocView.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions android/jni/org_coolreader_crengine_Engine.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions android/res/color/label_dark.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_window_focused="false" android:state_enabled="false" android:color="#909090"/>
<item android:state_window_focused="false" android:color="#f3f3f3"/>
<!-- Since there is only one selector (for both light and dark), the light's selected state shouldn't be inversed like the dark's. -->
<item android:state_pressed="true" android:state_enabled="false" android:color="#909090"/>
<item android:state_selected="true" android:state_enabled="false" android:color="#909090"/>
<item android:state_pressed="true" android:color="#f3f3f3"/>
<item android:state_selected="true" android:color="#f3f3f3"/>
<item android:state_enabled="false" android:color="#909090"/>
<item android:color="#f3f3f3"/> <!-- not selected -->
</selector>
12 changes: 12 additions & 0 deletions android/res/color/label_hc_dark.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_window_focused="false" android:state_enabled="false" android:color="#888888"/>
<item android:state_window_focused="false" android:color="@android:color/white"/>
<!-- Since there is only one selector (for both light and dark), the light's selected state shouldn't be inversed like the dark's. -->
<item android:state_pressed="true" android:state_enabled="false" android:color="#888888"/>
<item android:state_selected="true" android:state_enabled="false" android:color="#888888"/>
<item android:state_pressed="true" android:color="@android:color/white"/>
<item android:state_selected="true" android:color="@android:color/white"/>
<item android:state_enabled="false" android:color="#888888"/>
<item android:color="@android:color/white"/> <!-- not selected -->
</selector>
12 changes: 12 additions & 0 deletions android/res/color/label_hc_light.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_window_focused="false" android:state_enabled="false" android:color="#888888"/>
<item android:state_window_focused="false" android:color="@android:color/black"/>
<!-- Since there is only one selector (for both light and dark), the light's selected state shouldn't be inversed like the dark's. -->
<item android:state_pressed="true" android:state_enabled="false" android:color="#888888"/>
<item android:state_selected="true" android:state_enabled="false" android:color="#888888"/>
<item android:state_pressed="true" android:color="@android:color/black"/>
<item android:state_selected="true" android:color="@android:color/black"/>
<item android:state_enabled="false" android:color="#888888"/>
<item android:color="@android:color/black"/> <!-- not selected -->
</selector>
12 changes: 12 additions & 0 deletions android/res/color/label_light.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_window_focused="false" android:state_enabled="false" android:color="#808080"/>
<item android:state_window_focused="false" android:color="@android:color/black"/>
<!-- Since there is only one selector (for both light and dark), the light's selected state shouldn't be inversed like the dark's. -->
<item android:state_pressed="true" android:state_enabled="false" android:color="#808080"/>
<item android:state_selected="true" android:state_enabled="false" android:color="#808080"/>
<item android:state_pressed="true" android:color="@android:color/black"/>
<item android:state_selected="true" android:color="@android:color/black"/>
<item android:state_enabled="false" android:color="#808080"/>
<item android:color="@android:color/black"/> <!-- not selected -->
</selector>
12 changes: 12 additions & 0 deletions android/res/color/value_dark.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_window_focused="false" android:state_enabled="false" android:color="#808080"/>
<item android:state_window_focused="false" android:color="#d0d0d0"/>
<!-- Since there is only one selector (for both light and dark), the light's selected state shouldn't be inversed like the dark's. -->
<item android:state_pressed="true" android:state_enabled="false" android:color="#808080"/>
<item android:state_selected="true" android:state_enabled="false" android:color="#808080"/>
<item android:state_pressed="true" android:color="#d0d0d0"/>
<item android:state_selected="true" android:color="#d0d0d0"/>
<item android:state_enabled="false" android:color="#808080"/>
<item android:color="#d0d0d0"/> <!-- not selected -->
</selector>
12 changes: 12 additions & 0 deletions android/res/color/value_light.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_window_focused="false" android:state_enabled="false" android:color="#808080"/>
<item android:state_window_focused="false" android:color="#323232"/>
<!-- Since there is only one selector (for both light and dark), the light's selected state shouldn't be inversed like the dark's. -->
<item android:state_pressed="true" android:state_enabled="false" android:color="#808080"/>
<item android:state_selected="true" android:state_enabled="false" android:color="#808080"/>
<item android:state_pressed="true" android:color="#323232"/>
<item android:state_selected="true" android:color="#323232"/>
<item android:state_enabled="false" android:color="#808080"/>
<item android:color="#323232"/> <!-- not selected -->
</selector>
Binary file modified android/res/drawable-hdpi/cr3_option_text_multilang.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/res/drawable-ldpi/cr3_option_text_multilang.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/res/drawable-mdpi/cr3_option_text_multilang.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes.
File renamed without changes
6 changes: 0 additions & 6 deletions android/res/drawable-v3/background_tiled_dark_v3.xml

This file was deleted.

6 changes: 0 additions & 6 deletions android/res/drawable-v3/background_tiled_light_v3.xml

This file was deleted.

5 changes: 0 additions & 5 deletions android/res/drawable-v3/divider_dark_tiled_v3.xml

This file was deleted.

Binary file removed android/res/drawable-v3/divider_dark_v3.png
Binary file not shown.
5 changes: 0 additions & 5 deletions android/res/drawable-v3/divider_light_tiled_v3.xml

This file was deleted.

Binary file removed android/res/drawable-v3/divider_light_v3.png
Binary file not shown.
Binary file removed android/res/drawable-v3/tx_wood_dark_v3.jpg
Binary file not shown.
Binary file removed android/res/drawable-v3/tx_wood_v3.jpg
Binary file not shown.
Binary file modified android/res/drawable-xhdpi/cr3_option_text_multilang.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/res/drawable-xxhdpi/cr3_option_text_multilang.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
52 changes: 28 additions & 24 deletions android/res/layout/browser_status_bar.xml
Original file line number Diff line number Diff line change
@@ -1,28 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content">

<TextView
android:id="@+id/title"
style="@style/TextAppearance.Medium"
android:text="@null"
android:singleLine="true"
android:layout_marginLeft="3dip"
android:layout_marginRight="3dip"
android:paddingTop="3dip"
android:paddingBottom="3dip"

android:ellipsize="start"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
android:layout_height="wrap_content"
android:orientation="horizontal">

<TextView
android:id="@+id/title"
style="@style/TextAppearance.Medium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="3dip"
android:layout_marginRight="3dip"
android:layout_weight="10"
android:ellipsize="start"
android:paddingTop="3dip"

android:paddingBottom="3dip"
android:singleLine="true"
android:text="@null" />

<ProgressBar
android:id="@+id/progress"
style="@android:style/Widget.ProgressBar.Small"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="0"
android:visibility="gone" />

</LinearLayout>
<!-- /LinearLayout-->
Loading

0 comments on commit 0345ca3

Please sign in to comment.