1
0
Fork 0
mirror of https://github.com/geometer/FBReaderJ.git synced 2025-10-05 10:49:24 +02:00

CSS support (in progress)

This commit is contained in:
Nikolay Pultsin 2012-05-08 21:08:45 +01:00
parent 74434ce274
commit 7661f69aa6
4 changed files with 40 additions and 17 deletions

View file

@ -5,7 +5,6 @@ Larger icon on the site
litres: top/hot lists (what's happen?) litres: top/hot lists (what's happen?)
litres: author photos litres: author photos
* do not read CSS file multiple times
* "modes" for wallpapers: tile, fullscreen, etc. * "modes" for wallpapers: tile, fullscreen, etc.
* zip: re-use open files * zip: re-use open files
DONE Screen orientation by default: not selected? DONE Screen orientation by default: not selected?
@ -26,9 +25,17 @@ DONE Chinese/Tamil UTF16 files
* scale-to-fullscreen for all pictures * scale-to-fullscreen for all pictures
* show-hide temporary activity after brightness changing (to switch off the button lights) * show-hide temporary activity after brightness changing (to switch off the button lights)
DONE encodings list for native plugins DONE encodings list for native plugins
* native: CSS! * CSS:
* CSS: parse tag lists like 'h1,h2,h3' ** why do we use CSS stack?
* CSS: embedded fonts ** parse tag lists like 'h1,h2,h3'
** "metric" style params
** font size
** underline
** strikethrough
** embedded fonts
** list of fonts
** do not read style file multiple times
** page breaks
* предупреждение "не могу открыть зашифрованный файл" * предупреждение "не могу открыть зашифрованный файл"
* API от Paragon * API от Paragon
* Two-page view * Two-page view

View file

@ -20,7 +20,6 @@
#include <cstdlib> #include <cstdlib>
#include <ZLStringUtil.h> #include <ZLStringUtil.h>
#include <ZLLogger.h>
#include "StyleSheetTable.h" #include "StyleSheetTable.h"
@ -156,7 +155,6 @@ shared_ptr<ZLTextStyleEntry> StyleSheetTable::createControl(const AttributeMap &
const std::vector<std::string> &bold = values(styles, "font-weight"); const std::vector<std::string> &bold = values(styles, "font-weight");
if (!bold.empty()) { if (!bold.empty()) {
ZLLogger::Instance().println(ZLLogger::DEFAULT_CLASS, "bold: " + bold[0]);
int num = -1; int num = -1;
if (bold[0] == "bold") { if (bold[0] == "bold") {
num = 700; num = 700;

View file

@ -189,8 +189,9 @@ public class ZLTextPlainModel implements ZLTextModel, ZLTextStyleEntry.Feature {
final short mask = (short)data[dataOffset++]; final short mask = (short)data[dataOffset++];
for (int i = 0; i < NUMBER_OF_LENGTHS; ++i) { for (int i = 0; i < NUMBER_OF_LENGTHS; ++i) {
if (ZLTextStyleEntry.isFeatureSupported(mask, i)) { if (ZLTextStyleEntry.isFeatureSupported(mask, i)) {
// TODO: read length final short size = (short)data[dataOffset++];
dataOffset += 2; final byte unit = (byte)data[dataOffset++];
entry.setLength(i, size, unit);
} }
} }
if (ZLTextStyleEntry.isFeatureSupported(mask, ALIGNMENT_TYPE) || if (ZLTextStyleEntry.isFeatureSupported(mask, ALIGNMENT_TYPE) ||

View file

@ -43,7 +43,26 @@ public final class ZLTextStyleEntry {
byte FONT_MODIFIER_SMALLCAPS = 1 << 4; byte FONT_MODIFIER_SMALLCAPS = 1 << 4;
} }
public interface SizeUnit {
byte SIZE_UNIT_PIXEL = 0;
byte SIZE_UNIT_EM_100 = 1;
byte SIZE_UNIT_EX_100 = 2;
byte SIZE_UNIT_PERCENT = 3;
}
class Length {
public final short Size;
public final byte Unit;
Length(short size, byte unit) {
Size = size;
Unit = unit;
}
}
private short myFeatureMask; private short myFeatureMask;
private Length[] myLengths = new Length[Feature.NUMBER_OF_LENGTHS];
private byte myAlignmentType; private byte myAlignmentType;
private byte myFontSizeMagnification; private byte myFontSizeMagnification;
private String myFontFamily; private String myFontFamily;
@ -58,19 +77,17 @@ public final class ZLTextStyleEntry {
return isFeatureSupported(myFeatureMask, featureId); return isFeatureSupported(myFeatureMask, featureId);
} }
//private short myLeftIndent;
//private short myRightIndent;
public ZLTextStyleEntry() { public ZLTextStyleEntry() {
} }
/* void setLength(int featureId, short size, byte unit) {
public short getLeftIndent() { myFeatureMask |= 1 << featureId;
return myLeftIndent; myLengths[featureId] = new Length(size, unit);
} }
public short getRightIndent() { /*
return myRightIndent; public Length getLength(int featureId) {
return myLengths[featureId];
} }
*/ */