1
0
Fork 0
mirror of https://github.com/geometer/FBReaderJ.git synced 2025-10-05 19:42:17 +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: author photos
* do not read CSS file multiple times
* "modes" for wallpapers: tile, fullscreen, etc.
* zip: re-use open files
DONE Screen orientation by default: not selected?
@ -26,9 +25,17 @@ DONE Chinese/Tamil UTF16 files
* scale-to-fullscreen for all pictures
* show-hide temporary activity after brightness changing (to switch off the button lights)
DONE encodings list for native plugins
* native: CSS!
* CSS: parse tag lists like 'h1,h2,h3'
* CSS: embedded fonts
* CSS:
** why do we use CSS stack?
** 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
* Two-page view

View file

@ -20,7 +20,6 @@
#include <cstdlib>
#include <ZLStringUtil.h>
#include <ZLLogger.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");
if (!bold.empty()) {
ZLLogger::Instance().println(ZLLogger::DEFAULT_CLASS, "bold: " + bold[0]);
int num = -1;
if (bold[0] == "bold") {
num = 700;

View file

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

View file

@ -43,7 +43,26 @@ public final class ZLTextStyleEntry {
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 Length[] myLengths = new Length[Feature.NUMBER_OF_LENGTHS];
private byte myAlignmentType;
private byte myFontSizeMagnification;
private String myFontFamily;
@ -58,19 +77,17 @@ public final class ZLTextStyleEntry {
return isFeatureSupported(myFeatureMask, featureId);
}
//private short myLeftIndent;
//private short myRightIndent;
public ZLTextStyleEntry() {
}
/*
public short getLeftIndent() {
return myLeftIndent;
void setLength(int featureId, short size, byte unit) {
myFeatureMask |= 1 << featureId;
myLengths[featureId] = new Length(size, unit);
}
public short getRightIndent() {
return myRightIndent;
/*
public Length getLength(int featureId) {
return myLengths[featureId];
}
*/