more btex styling

This commit is contained in:
minjaesong
2024-04-26 03:30:59 +09:00
parent 6de340bde6
commit bb10c55739
8 changed files with 22 additions and 11 deletions

View File

@@ -54,8 +54,8 @@
<section>Full Control of the Shape</section> <section>Full Control of the Shape</section>
<p><index id="btex language" />With <btex /> you can fully control how your publishing would look like, <p><index id="btex language" />With <btex /> you can fully control how your publishing would look like,
from a pile of papers that look like they have been typed out using typewriter, a pile of papers but a from a pile of papers that look like they have been typed out using typewriter, a pile of printouts
fully-featured printouts that have illustrations in it, to a true hardcover book.</p> that have pictures in it, to a true hardcover book.</p>
<p><index id="cover" />This style is controlled using the <code>cover</code> attribute on the root tag, <p><index id="cover" />This style is controlled using the <code>cover</code> attribute on the root tag,
with following values: <code>typewriter</code>, <code>printout</code> and <code>hardcover</code>.</p> with following values: <code>typewriter</code>, <code>printout</code> and <code>hardcover</code>.</p>

View File

@@ -18,7 +18,7 @@ class BTeXDocument {
var textWidth = 480 var textWidth = 480
var lineHeightInPx = 24 var lineHeightInPx = 24
var pageLines = 20 var pageLines = 25
var textHeight = pageLines * lineHeightInPx var textHeight = pageLines * lineHeightInPx
val pageMarginH = 15 val pageMarginH = 15

View File

@@ -407,10 +407,12 @@ object BTeXParser {
) )
private val pageWidthMap = hashMapOf( private val pageWidthMap = hashMapOf(
"standard" to 480 "standard" to 480,
"examination" to 640,
) )
private val pageHeightMap = hashMapOf( private val pageHeightMap = hashMapOf(
"standard" to 20 "standard" to 25,
"examination" to 18,
) )
@@ -522,6 +524,9 @@ object BTeXParser {
fun closeElemEDITION(handler: BTeXHandler, doc: BTeXDocument, theTag: String, uri: String, siblingIndex: Int) = closeElemP(handler, doc, theTag, uri, siblingIndex) fun closeElemEDITION(handler: BTeXHandler, doc: BTeXDocument, theTag: String, uri: String, siblingIndex: Int) = closeElemP(handler, doc, theTag, uri, siblingIndex)
@CloseTag // reflective access is impossible with 'private' @CloseTag // reflective access is impossible with 'private'
fun closeElemCHAPTER(handler: BTeXHandler, doc: BTeXDocument, theTag: String, uri: String, siblingIndex: Int) { fun closeElemCHAPTER(handler: BTeXHandler, doc: BTeXDocument, theTag: String, uri: String, siblingIndex: Int) {
// if current line is the last line, proceed to the next page
if (doc.currentLine == doc.pageLines - 1) doc.addNewPage()
val indent = 16 val indent = 16
val thePar = "\n" + handler.paragraphBuffer.toString().trim() val thePar = "\n" + handler.paragraphBuffer.toString().trim()
typesetParagraphs(thePar, handler, doc.textWidth - indent).also { typesetParagraphs(thePar, handler, doc.textWidth - indent).also {
@@ -541,6 +546,9 @@ object BTeXParser {
} }
@CloseTag // reflective access is impossible with 'private' @CloseTag // reflective access is impossible with 'private'
fun closeElemSECTION(handler: BTeXHandler, doc: BTeXDocument, theTag: String, uri: String, siblingIndex: Int) { fun closeElemSECTION(handler: BTeXHandler, doc: BTeXDocument, theTag: String, uri: String, siblingIndex: Int) {
// if current line is the last line, proceed to the next page
if (doc.currentLine == doc.pageLines - 1) doc.addNewPage()
val indent = 8 val indent = 8
val thePar = "\n" + handler.paragraphBuffer.toString().trim() val thePar = "\n" + handler.paragraphBuffer.toString().trim()
typesetParagraphs(thePar, handler, doc.textWidth - indent).also { typesetParagraphs(thePar, handler, doc.textWidth - indent).also {

View File

@@ -67,7 +67,7 @@ class UICrafting(val full: UIInventoryFull?) : UICanvas(
UIInventoryFull.drawBackground(batch, opacity) UIInventoryFull.drawBackground(batch, opacity)
} }
uiItems.forEach { it.render(frameDelta, batch, camera) } // uiItems.forEach { it.render(frameDelta, batch, camera) }
} }
override fun dispose() { override fun dispose() {

View File

@@ -83,8 +83,8 @@ class BTeXTest : ApplicationAdapter() {
<section>Full Control of the Shape</section> <section>Full Control of the Shape</section>
<p><index id="btex language" />With <btex /> you can fully control how your publishing would look like, <p><index id="btex language" />With <btex /> you can fully control how your publishing would look like,
from a pile of papers that look like they have been typed out using typewriter, a pile of papers but a from a pile of papers that look like they have been typed out using typewriter, a pile of printouts
fully-featured printouts that have illustrations in it, to a true hardcover book.</p> that have pictures in it, to a true hardcover book.</p>
<p><index id="cover" />This style is controlled using the <code>cover</code> attribute on the root tag, <p><index id="cover" />This style is controlled using the <code>cover</code> attribute on the root tag,
with following values: <code>typewriter</code>, <code>printout</code> and <code>hardcover</code>.</p> with following values: <code>typewriter</code>, <code>printout</code> and <code>hardcover</code>.</p>
@@ -114,7 +114,7 @@ class BTeXTest : ApplicationAdapter() {
camera.update() camera.update()
batch.projectionMatrix = camera.combined batch.projectionMatrix = camera.combined
bg = TextureRegion(Texture(Gdx.files.internal("test_assets/Screenshot-1714034883660.png"))) bg = TextureRegion(Texture(Gdx.files.internal("test_assets/real_bg_with_guides.png")))
document = BTeXParser.invoke(tex) document = BTeXParser.invoke(tex)
} }
@@ -127,7 +127,7 @@ class BTeXTest : ApplicationAdapter() {
gdxClearAndEnableBlend(.063f, .070f, .086f, 1f) gdxClearAndEnableBlend(.063f, .070f, .086f, 1f)
val drawX = (1280 - (pageGap + document.pageWidth*2)) / 2 val drawX = (1280 - (pageGap + document.pageWidth*2)) / 2
val drawY = 100 val drawY = 24
batch.inUse { batch.inUse {
batch.color = Color.WHITE batch.color = Color.WHITE

View File

@@ -713,7 +713,7 @@ internal object BlocksDrawer {
} }
private var _tilesBufferAsTex: Texture = Texture(1, 1, Pixmap.Format.RGBA8888) private var _tilesBufferAsTex: Texture = Texture(1, 1, Pixmap.Format.RGBA8888)
private val occlusionIntensity = 0.5f//0.22222222f // too low value and dark-coloured walls won't darken enough private val occlusionIntensity = 0.22222222f // too low value and dark-coloured walls won't darken enough
private fun renderUsingBuffer(mode: Int, projectionMatrix: Matrix4, drawGlow: Boolean, drawEmissive: Boolean) { private fun renderUsingBuffer(mode: Int, projectionMatrix: Matrix4, drawGlow: Boolean, drawEmissive: Boolean) {
//Gdx.gl.glClearColor(.094f, .094f, .094f, 0f) //Gdx.gl.glClearColor(.094f, .094f, .094f, 0f)

Binary file not shown.