Skip to content

Commit

Permalink
Merge pull request #29 from Azeirah/Big-update
Browse files Browse the repository at this point in the history
Big update
  • Loading branch information
ricklupton authored Feb 4, 2025
2 parents 07b2f9b + 385e863 commit 94960bc
Show file tree
Hide file tree
Showing 7 changed files with 97 additions and 4 deletions.
60 changes: 60 additions & 0 deletions flake.lock

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

30 changes: 30 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
description = "Nix flakes";

inputs = {
nixpkgs.url = "nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
};

outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pythonEnv = pkgs.python312.withPackages (ps: []);
pkgs = import nixpkgs {
inherit system;
};
in
{
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
sqlite.dev
poetry
inkscape
];

LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath [
pkgs.sqlite.out
];
};
});
}
9 changes: 6 additions & 3 deletions src/rmc/exporters/svg.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import typing as tp
from pathlib import Path

from rmscene import read_tree, SceneTree, CrdtId
from rmscene import CrdtId, SceneTree, read_tree
from rmscene import scene_items as si
from rmscene.text import TextDocument

Expand Down Expand Up @@ -42,8 +42,11 @@ def scale(screen_unit: float) -> float:
# 69.5, but decided on 70 (to keep integer values)
si.ParagraphStyle.PLAIN: 70,
si.ParagraphStyle.BULLET: 35,
si.ParagraphStyle.BULLET2: 35,
si.ParagraphStyle.BOLD: 70,
si.ParagraphStyle.HEADING: 150,
si.ParagraphStyle.CHECKBOX: 35,
si.ParagraphStyle.CHECKBOX_CHECKED: 35,

# There appears to be another format code (value 0) which is used when the
# text starts far down the page, which case it has a negative offset (line
Expand Down Expand Up @@ -127,7 +130,7 @@ def build_anchor_pos(text: tp.Optional[si.Text]) -> tp.Dict[CrdtId, int]:
for subp in p.contents:
for k in subp.i:
anchor_pos[k] = ypos # TODO check these anchor are used
ypos += LINE_HEIGHTS[p.style.value]
ypos += LINE_HEIGHTS.get(p.style.value, 70)

return anchor_pos

Expand Down Expand Up @@ -267,7 +270,7 @@ def draw_text(text: si.Text, output):

doc = TextDocument.from_scene_item(text)
for p in doc.contents:
y_offset += LINE_HEIGHTS[p.style.value]
y_offset += LINE_HEIGHTS.get(p.style.value, 70)

xpos = text.pos_x
ypos = text.pos_y + y_offset
Expand Down
2 changes: 1 addition & 1 deletion src/rmc/exporters/writing_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def __init__(self, base_width, base_color_id):
class Shader(Pen):

def __init__(self, base_width, base_color_id):
super().__init__(base_width, base_color_id)
super().__init__("Shader", base_width, base_color_id)
self.stroke_linecap = "round"
self.base_opacity = 0.1
# self.stroke_opacity = 0.2
Expand Down
Binary file added tests/rm/edc580a6-1c32-471e-823c-678f975eaf81.rm
Binary file not shown.
Binary file added tests/rm/erasers.rm
Binary file not shown.
Binary file added tests/rm/keyboard-checkboxes-and-bullets.rm
Binary file not shown.

0 comments on commit 94960bc

Please sign in to comment.